yoneken / rosserial_stm32

This is a part of [rosserial](https://github.com/ros-drivers/rosserial) repository to communicate with ROS system through a USART for STM32 embedded system.
BSD 2-Clause "Simplified" License
227 stars 72 forks source link

DMA/USART initialization order #39

Open rikba opened 2 years ago

rikba commented 2 years ago

When auto-generating code from .ioc configurations using STM32CubeIDE (1.9.0) the order in which peripherals are created is not fixed. We observed that rosserial_stm32 only works if the DMA is initialized BEFORE the UART connection

MX_DMA_Init();
MX_USART2_UART_Init();

If you have this the other way round, you get connection errors using rosrun rosserial_server serial_node _port:=/dev/ttyACM0 _baud:=115200.

[ INFO] [1655841703.653152322]: Opened /dev/ttyACM0
[ INFO] [1655841705.653483835]: Opened /dev/ttyACM0
[ INFO] [1655841707.653914306]: Opened /dev/ttyACM0
[ INFO] [1655841709.654372123]: Opened /dev/ttyACM0

We don't know how to force the initialization order or how to handle this in rosserial_stm32. But this problem may be related to https://github.com/yoneken/rosserial_stm32/issues/33, https://github.com/yoneken/rosserial_stm32/issues/22 and other connection problems.