ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

About rosserial_stm32 on STM32 L4 series

asked 2019-03-27 10:42:22 -0500

Nyarn gravatar image

updated 2019-03-28 03:56:09 -0500

Excuse me, I am not fluent in English.So I use machine translation.

I tried to operate STM32 L4 series using this library ( https://github.com/yoneken/rosserial_... ).

I referred to here(https://www.slideshare.net/k_yone/rosserial-stm32).

However, I got such an error.

$rosrun rosserial_python serial_node.py _port:=/dev/ttyACM0 _baud:=57600

[INFO] [1553585723.997853]: ROS Serial Python Node

[INFO] [1553585724.007428]: Connecting to /dev/ttyACM0 at 57600 baud

[INFO] [1553585726.113745]: Requesting topics...

[ERROR] [1553585741.116108]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

How can I solve this error?

##environment##

  • Ubuntu 16.04 + kinetic

  • STM32L476

  • rosserial_stm32

  • SW4STM32 + CubeMX + ST-Link

##used commands##

$ code STM32Hardware.h

In STM32Hardware.h

-#include "stm32f3xx_hal.h"

-#include "stm32f3xx_hal_uart.h"

-#include "stm32f3xx_hal_tim.h"

+#include "stm32l4xx_hal.h"

+#include "stm32l4xx_hal_uart.h"

+#include "stm32l4xx_hal_tim.h"

then...

$ cd ~/catkin_ws

$ catkin_make

$ cd ./src/rosserial_stm32/src/ros_lib/examples

$ cp -r chatter ~/workspace

$ cd ~/workspace/chatter

$ rosrun rosserial_stm32 make_libraries.py .

Start CubeMX and load chatter.ioc.

Configure peripheral settings.

Configuration chatter STM32CubeMX 5.0.1 Date 03/27/2019 MCU STM32L476RGTx

PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2

Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO PERIPHERALS MODES FUNCTIONS PINS RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN (PC14) RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT (PC15) SYS Serial Wire SYS_JTCK-SWCLK PA14 (JTCK-SWCLK) SYS Serial Wire SYS_JTMS-SWDIO PA13 (JTMS-SWDIO) SYS SysTick SYS_VS_Systick VP_SYS_VS_Systick TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT USART2 Asynchronous USART2_RX PA3 USART2 Asynchronous USART2_TX PA2

Pin Nb PINs FUNCTIONs LABELs 2 PC13 GPIO_EXTI13 B1 [Blue PushButton] 3 PC14-OSC32_IN (PC14) RCC_OSC32_IN 4 PC15-OSC32_OUT (PC15) RCC_OSC32_OUT 5 PH0-OSC_IN (PH0)* RCC_OSC_IN 6 PH1-OSC_OUT (PH1)* RCC_OSC_OUT 16 PA2 USART2_TX USART_TX 17 PA3 USART2_RX USART_RX 21 PA5 GPIO_Output LD2 [green Led] 46 PA13 (JTMS-SWDIO) SYS_JTMS-SWDIO TMS 49 PA14 (JTCK-SWCLK) SYS_JTCK-SWCLK TCK 55 PB3 (JTDO-TRACESWO)* SYS_JTDO-SWO SWO

SOFTWARE PROJECT `` Project Settings : Project Name : chatter Project Folder : /home/hoge1/workspace/chatter Toolchain / IDE : SW4STM32 Firmware Package Name and Version : STM32Cube FW_L4 V1.13.0 Code Generation Settings : STM32Cube Firmware Library Package : Copy only the necessary library files Generate peripheral initialization as a pair of '.c/.h' files per peripheral : No Backup previously generated files when re-generating : No Delete previously generated files when not re-generated : Yes Set all free pins as analog (to optimize the power consumption) : No

Toolchains Settings : Compiler Optimizations :

then,generate code for SW4STM32.

At SW4STM32 ,convert C to C++.

edit retag flag offensive close merge delete

Comments

What's the duplicate question?

jayess gravatar image jayess  ( 2019-03-27 12:56:04 -0500 )edit

I'm sorry.I closed the question because I made a mistake with almost the same content. However, the other is waiting for moderation and can not see it.

Nyarn gravatar image Nyarn  ( 2019-03-27 13:10:40 -0500 )edit

I tried to edit this question and reopen it because the other question had disappeared but I could not get enough points.

Nyarn gravatar image Nyarn  ( 2019-03-28 04:13:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-01-18 23:52:45 -0500

Roman41 gravatar image

SYN and Version mismatch problem are due to following:

  • Your connection might be loose so double check your connection.
  • Inside ros_lib/ros/node_handle.h look for protocol_ver,

    • "The second sync byte is a protocol version. It's value is 0xff for the first version of the rosserial protocol (used up to hydro), 0xfe for the second version (introduced in hydro), 0xfd for the next, and so on. Its purpose is to enable detection of mismatched protocol versions (e.g. hydro rosserial_python with groovy rosserial_arduino. It must be changed in both this file and in rosserial_python/src/rosserial_python/SerialClient.py"
    • change the value of the protocol_ver according to your ubuntu ROS version, you are using ROS kinetic so your version will be "0xfb", also make similar changes to your ROS master side.
edit flag offensive delete link more

Question Tools

Stats

Asked: 2019-03-27 10:42:22 -0500

Seen: 993 times

Last updated: Jan 18 '21