Search found 12 matches

by rmdMoba
Sat May 20, 2017 2:39 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

After several tests I did not find a reason why pwm doesn't work again after SPI has been active. The only solution I found is to remap the SPI pins ( or execute a hardware reset ). It seems that SPI blocks the AF on this pin if it once has been activated. Even setting all SPI registers back to '0' ...
by rmdMoba
Fri May 19, 2017 9:42 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

Did you check if the end() method for the SPI port disables the SPI peripheral? It seems to do so ... void SPIClass::end(void) { if (!spi_is_enabled(_currentSetting->spi_d)) { return; } // Follows RM0008's sequence for disabling a SPI in master/slave // full duplex mode. while (spi_is_rx_nonempty(_...
by rmdMoba
Fri May 19, 2017 9:36 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

victor_pv wrote:or you were using the normal ones, then if you switch to the alternate ones for SPI1 then PWM works again?
That's it
by rmdMoba
Fri May 19, 2017 9:21 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

I confirmed it, does not enable the timer device, only the channel. That's true, but it's not the problem. Activating SPI also disables only the channel. The timer itself is still running. This is essential, because there are other channels where pwm may be active on non SPI pins. The problem is ob...
by rmdMoba
Fri May 19, 2017 7:14 am
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

So you will need to enable the timer device again. Yes, sure. But that is what pinMode( test1P, PWM ); // The following PWM sequence doesn't work should do. After a reset the timer is disabled too, and pinMode() sets it accordingly to create PWM pulses. Why does this not work when SPI disabled the ...
by rmdMoba
Thu May 18, 2017 9:01 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

I checked the output on PA7 with a scope: // Test PWM on maplemini pin 4 / PA7 ( general Output / SPI and PWM ) #include <SPI.h> const byte Led1P = 16; // Led active during PWM Output const byte test1P = 4; // = port A7 ( SPI1-MOSI or TIM3 Ch2 ) SPIClass mySPI(1); void setup() { // put your setup co...
by rmdMoba
Thu May 18, 2017 8:34 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

I suspect the case may be that when SPI or Serial end, the pins are not configured completely back to default and something extra may need to be done. I supposed this too, and changed the end method of SPI tentatively. I set all the control registers to '0' ( the reset state ), but it changed nothi...
by rmdMoba
Thu May 18, 2017 3:39 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

Hello all, I did several tests and my fix worked so far. But I found some strange behaviour with pins that provide two alternate functions, e.g. PWM and Serial or PWM and SPI. If once SPI or Serial was activated ( and then deactivated with the end method ) PWM did not work anymore. The other way rou...
by rmdMoba
Mon May 15, 2017 8:45 am
Forum: Maple mini
Topic: Using SPI1 disables TIMER1 compare interupt
Replies: 5
Views: 155

Re: Using SPI1 disables TIMER1 compare interupt

Yes, I found this issue when using timer 4. But it's not limited to timer 4. If you set a non-pwm mode on any pwm capable pin, then the corresponding timerchannel is disabled. The timer_set_mode() function for this timer/channel ist called with parameter 'TIMER_DISABLED'. This clears the compareOutp...
by rmdMoba
Sat May 13, 2017 8:49 pm
Forum: STM core: Bugs and enhancements
Topic: pinMode() disables timer even if no PWM mode involved
Replies: 23
Views: 332

Re: pinMode() disables timer even if no PWM mode involved

Hi all, if we decide to never disable the timer in the pinMode function, the fix is even more simple: gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, outputMode); if (pwm && PIN_MAP[pin].timer_device != NULL) { /* Enable timer channels if we're switching into PWM. */ timer_set...

Go to advanced search