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

[Solved] OpenCR Serial communication

asked 2017-09-28 13:52:25 -0500

updated 2017-09-29 08:08:01 -0500

Hello!

I would like to use a Cortex-M board to communicate with the OpenCR. However my board does not have any USB connector. So I would like to use some pins and configure them as an UART. As far as I understood the communication is serial so it should be possible to achieve that. But I could not make it work yet. My first question is: is it achievable? Here is what I tried:

In the turtlebot3_core code for the OpenCR board:

ros::NodeHandle nh;

is initialized as (in OpenCR/1.0.13/libraries/turtlebot3_ros_lib/ros.h)

typedef NodeHandle_<ArduinoHardware, 25, 25, 1024, 1024> NodeHandle;

And ArduinoHardware is defined (in OpenCR/1.0.13/libraries/turtlebot3_ros_lib/ArduinoHardware.h)

#include <HardwareSerial.h>
#define SERIAL_CLASS USBSerial // USBSerial / UARTClass


ArduinoHardware()
{
      iostream = &Serial;
      //iostream = &Serial1;
      baud_ = 57600;
}

I tried to change the SERIAL_CLASS define to UARTClass in order to use one of the UARTClass defined in OpenCR/1.0.13/libraries/variants/variants.h:

UARTClass Serial1(DRV_UART_NUM_1, DRV_UART_IRQ_MODE);
UARTClass Serial4(DRV_UART_NUM_4, DRV_UART_IRQ_MODE);

I was also wondering where Serial1 is located on the OpenCR. Thanks :D

EDIT: It was a problem with my UART cables. Everything is working by following those steps.

edit retag flag offensive close merge delete

Comments

1

Could I ask you to post your edit as an answer? If you do, you can accept your own answer. That will get you some karma, and will more clearly show that your question as solved.

gvdhoorn gravatar image gvdhoorn  ( 2017-09-30 05:40:08 -0500 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2017-10-02 04:42:07 -0500

This has been solved. My UART cables were defect. The above procedure works to switch from the USB OTG to UART (connector J25) by using Serial4.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-09-28 13:52:25 -0500

Seen: 1,092 times

Last updated: Oct 02 '17