9 years, 6 months ago.

Nucleo F411RE, PWM Pins

Hello! I want to create a PWM signal with a period of 4 seconds (for example). Through my experiments with Nucleo i came up with 3 observations - questions:

1) In order to create such a period i must use 32-bit Timer TIM2

2) Not all PWM - TIM2 pins can create the desires period. For example, i create successfully the signal through pin PB_10 but it does nothing with PA_2, although they use the exact same Timer and Channel (2-3) !! Why is this happening?

3) What are the initialization Clock speeds that mbed uses for Nucleo? For example, a Timer would perform in different ways with different input clocks eg for low input clock speeds a 16-bit Timer could create the desired output.

The code i use is the second example in PWMout in Handbook (4 seconds period, with 50% Duty Cycle), changing the PWM pin.

I would appreciate some help. Thanks in advance.

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

As i can see PA_2 and PA_3 can't operate properly in DigitalOut as well. Maybe there is a conflict between the serial communication functionality of those 2 Pins?

posted by Manos Kav 12 Oct 2014

1 Answer

9 years, 6 months ago.

PA_2 and PA_3 are the USBTX and USBRX pins which are also used for communication with your PC. So it is better if possible not to use those. (Imo it is stupid they don't use seperate pins for that, but neither do most others: They copy what Arduino did, ignoring that Arduino only did that because they have far fewer pins).

Accepted Answer

Thank you. As far as i understand (from the datasheets too) PA_2 and PA_3 are used as Tx and Rx for STLink Debugger or something like that, so their function cannot change.

Eric yes, as i found out from the Nucleo manual, there are solder bridges between PA_2 and PA_3 and their connectors. So PA_2 and PA_3 CONNECTORS ARE OPEN CIRCUITS. And indeed if you want to use them there is need for soldering.

posted by Manos Kav 12 Oct 2014

Well there function can change, but it depends on the order in which they are initialized (and of course if you use PWM there you cannot use them for Serial communications).

If you instantiate the PWM in your main function it should overwrite the Serial settings and take control of the pin (some boards need some soldering in order to actually use those pins, I am not sure if that is th case here).

posted by Erik - 12 Oct 2014