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
218 stars 72 forks source link

Slower execution speed leading to Lost Sync With Device in STM32F103 #6

Closed nikv96 closed 5 years ago

nikv96 commented 5 years ago

Using the rosserial_stm32 library, I am trying to publishing a message(std_msgs/UInt32) on the /chatter topic at a rate of 5Hz. The message gets published at a rate 20% lower as seen from the screenshot below. When estimating the time of execution, I found the time taken for each loop to be around 236ms which is roughly 4.2Hz.

image

image

I am also getting a Lost Sync with Device error very frequently (once every 2 minutes) as the code hangs. Any pointers to solutions?

Thanks!

nikv96 commented 5 years ago

Solved the issue by changing Line 117 in STM32Hardware.h to unsigned long time(){ return HAL_GetTick(); }

There seems to be an issue using the function internal timer peripheral instead.