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:
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.
PSC
configures that TIME_QUANTUM? Maybe my low-end oscilloscope makes things worse, since the pulse width measured increases nonlinearly asPSC
changes. \$\endgroup\$ – Light Aug 21 '20 at 9:07