[Solved] OpenCR Serial communication
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.
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.