0
$\begingroup$

Rosanswers logo

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.


Originally posted by pokitoz on ROS Answers with karma: 527 on 2017-09-28

Post score: 3


Original comments

Comment by gvdhoorn on 2017-09-30:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by pokitoz with karma: 527 on 2017-10-02

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.