Finally, I received my stm32f407 board, and a sample USART C project. The project comes with a Stm32f4xx_usart.c file (not HAL driver).

I want to figure out what the usage of PSC register is in IrDA Low-power mode by reading the driver, but only found a function called USART_SetPrescaler, which is just a simple wrapper of a "write data to GTPR register" command. So I can't infer anything from it (at first I was thinking there might be such a driver function that we pass in info such as baud rate, etc., and the function does everything for us including writing to PSC).

The reference manual describes PSC as: enter image description here

I thought PSC is used to set baud rate in IrDA Low-power mode at first glance. Then I wrote a small program with a fixed BRR (BRR=0x40) and all other settings, except that I changed PSC each time, from initial value 0x1, and incremented by 0x1. With the oscilloscope, I found that:

when PSC is 0x1~0xa: baud rate not changed, the waveform shows a equal bit time, only the width of pulse increases ~40ns each time linearly.

then I keep increasing PSC: the bit time varies greatly. It's like the output of a digital odd divider -- some cycles (bit time on the TXD line) are wider, while some are much narrower. And the width of pulse changed nonlinearly.

The PSC has a bit width of 8, and I havn't tested much right now. I'm really confused, and have no idea what the function of PSC is. Any help would be appreciated.

  • \$\begingroup\$ Have you read the section "30.3.12 IrDA SIR ENDEC block" especially the second part about the IrDA low power mode? \$\endgroup\$ – Arsenal Aug 21 '20 at 8:44
  • \$\begingroup\$ @Arsenal Actually, I can't figure out the meaning of "Instead, the width of the pulse is 3 times the low-power baud rate ..." from the very beginning. So does it mean the pulse width is 3 * TIME_QUANTUM which the manual authors still call it "baud rate"? And PSC configures that TIME_QUANTUM? Maybe my low-end oscilloscope makes things worse, since the pulse width measured increases nonlinearly as PSC changes. \$\endgroup\$ – Light Aug 21 '20 at 9:07
  • \$\begingroup\$ That's the way I understand it. Note that there is a range in which the output of the PSC must be: 1.42 to 2.12 MHz, if you increase the divider, you're probably dropping out of the 1.42 MHz and what happens then is undefined behavior (which you might see on your scope). I haven't worked with IrDA yet, so I can't tell you for sure. \$\endgroup\$ – Arsenal Aug 21 '20 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.