phoenix-rtos / phoenix-rtos-devices

Phoenix-RTOS device drivers repository
BSD 3-Clause "New" or "Revised" License
19 stars 13 forks source link

stm32l4 tty reconfigures uart periphery without disabling DMA channel #496

Open xvuko opened 1 month ago

xvuko commented 1 month 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 1 month ago

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