Hello everyone,
Now, I'm studying on how to use HardwareTimer Library as described in https://github.com/stm32duino/wiki/wiki ... er-library
I've tested the Timebase_callback.ino example, it's worked as expected.
However, when I tried to run the All-in-one_setPWM.ino or PWM_Fullconfiguration.ino, there was no output at both LED_BUILTIN pin (D13) and D3 pin (tested with oscilloscope)
The board I'm currently using is "Nucleo-F303K8"
I don't think that there should be any change in the code, or am I missing something?
Any help would be grateful
Thanks,
[Solved] Problem with Hardware Timer Examples
[Solved] Problem with Hardware Timer Examples
Last edited by oakx on Tue Mar 10, 2020 7:25 pm, edited 1 time in total.
Re: Problem with Hardware Timer Examples
Hi @oakx ,
I just checked on my Nucleo-F303K8 and you are right it doesn't work out of the box:
Timebase_callback.ino doesn't associate a pin to HardwareTimer, so any instance is working.
But other examples like All-in-one_setPWM.ino need to associate a pin to and HardwareTimer.
For Nucleo-F303K8, the HardwareTimer capability for LED_BUILTIN (= D13 = PB3) has been commented out. So it can't work.
If you are familiar with stm32duino varaints, you can uncomment following line in ...\variants\NUCLEO_F303K8\PeripheralPins.c
Otherwise I suggest to change pin and test on D2:
replace
by
I just checked on my Nucleo-F303K8 and you are right it doesn't work out of the box:
Timebase_callback.ino doesn't associate a pin to HardwareTimer, so any instance is working.
But other examples like All-in-one_setPWM.ino need to associate a pin to and HardwareTimer.
For Nucleo-F303K8, the HardwareTimer capability for LED_BUILTIN (= D13 = PB3) has been commented out. So it can't work.
If you are familiar with stm32duino varaints, you can uncomment following line in ...\variants\NUCLEO_F303K8\PeripheralPins.c
Code: Select all
{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2
replace
Code: Select all
#if defined(LED_BUILTIN)
#define pin LED_BUILTIN
#else
#define pin D2
#endif
Code: Select all
#define pin D2
Re: Problem with Hardware Timer Examples
@ABOSTM I managed to uncomment out that line in the file from
~/.arduino15/packages/STM32/hardware/stm32/1.8.0/variants/NUCLEO_F303K8/PeripheralPins.c
and it works like a charm
Thank you so much
~/.arduino15/packages/STM32/hardware/stm32/1.8.0/variants/NUCLEO_F303K8/PeripheralPins.c
and it works like a charm
Thank you so much