I’m working on a project on the Gapuino development board, my goal is to implement rosserial_mbed module on the Gap8 to be able to communicate with a ROS (melodic) node running on Ubuntu 18.04.
Rosserial relies on BufferedSerial library, which is an implementation of Mbed RawSerial, by exploiting its ability to attach callback functions on the UART rx pin to store data inside a buffer. This is done in order to have non-blocking read/write functionalities.
I narrowed the problem down to an interrupt handling issue on the Gap8, which seems unable to call callbacks on the triggering of the UART rx pin. To demonstrate what I just explained, I wrote down a simple example program to show such issue:
RawSerial pc(USBTX, USBRX, 9600);
printf("This function never gets called\n");
// Attach callback on UART rx
// Do stuff
I want to also add a finding (which could be unrelated to the issue) that emerged when reading at the source code for the porting of the mbed library for the Gap8. I came across this line of code inside serial_api.c which states that uart_irq_rx “/* Do no support in GAP8 */”.
My current setup is the following:
OS: Ubuntu 18.04
IDE: Visual Studio Code running PlatformIO extension
Thank you very much for taking the time for investigating this issue. That’s what I feared too, and the debugger in vscode confirmed it as the breakpoint at the uart0_irq_rx function is never encountered during runtime.
I’m implementing a quick and ugly fix by bypassing the function entirely and rely on a separate thread to check and read the buffer. I’m not sure the gap_sdk dev team will fix it though, as the support for Mbed has ended and they will only support FreeRTOS and PULP-OS from now on.