phoenix-rtos / phoenix-rtos-project

Sample project using Phoenix-RTOS
https://phoenix-rtos.com
BSD 3-Clause "New" or "Revised" License
45 stars 32 forks source link

stm32l4 tty reconfigures uart periphery without disabling DMA channel #1142

Open xvuko opened 6 months ago

xvuko commented 6 months ago

RM0351 Reference manual Rev 10 40.8.1 USART control register 1 (USART_CR1)

The DMA requests are also reset when UE = 0 so the DMA channel must be disabled before resetting the UE bit

Currently set_baudrate callback called from libtty ioctl hander temporarily disables UE without any synchronization. This needs to be investigated as it can lead to race conditions even when DMA is not used.

xvuko commented 6 months ago

For libuart this was addressed in https://github.com/phoenix-rtos/phoenix-rtos-devices/commit/d1fd02855b272756b8502efaa1f7ebe8dd652e2b