Apologies @giuliomoro, I referred to the wrong code. I am using this bit (which is appropriated from the Serial library example) to get serial data from UART4 pins:
gSerial.setup("/dev/ttyS4", 9600);
AuxiliaryTask serialCommsTask = Bela_createAuxiliaryTask(serialReadTask, 0, "serial-thread", NULL);
Bela_scheduleAuxiliaryTask(serialCommsTask);
and I am parsing the incoming values, then sending via libpd_symbol to PD, as such:
static uint64_t serialLastSent = 0;
if(context->audioFramesElapsed - serialLastSent > gSerialSendIntervalMs * 0.001f * context->audioSampleRate)
{
char serialBufferLat[maxLen];
char serialBufferLng[maxLen];
char serialBufferSts[maxLen];
size_t lenLat = gSerialPipeLat.readRt(serialBufferLat, maxLen);
size_t lenLng = gSerialPipeLng.readRt(serialBufferLng, maxLen);
size_t lenSts = gSerialPipeSts.readRt(serialBufferSts, maxLen);
if(lenLat > 0) {
serialBufferLat[lenLat] = 0; // ensure the string is appropriately null-terminated, or the line below may crash
libpd_symbol(gSerialReceiverNameLat, serialBufferLat);
serialLastSent = context->audioFramesElapsed;
}
if(lenLng > 0) {
serialBufferLng[lenLng] = 0; // ensure the string is appropriately null-terminated, or the line below may crash
libpd_symbol(gSerialReceiverNameLng, serialBufferLng);
serialLastSent = context->audioFramesElapsed;
}
if(lenSts > 0) {
serialBufferSts[lenSts] = 0; // ensure the string is appropriately null-terminated, or the line below may crash
libpd_symbol(gSerialReceiverNameSts, serialBufferSts);
serialLastSent = context->audioFramesElapsed;
}
}
The issue is that my GPS module (connected to UART4) loses coordinates as soon as I run the software. As part of my troubleshooting, I tried the GPS module on an Arduino and on Bela-mini (with the software being stopped) in both cases the data flow without any issues and coordinates are readable, when I run the software on Bela the module malfunctions (data is still incoming but I lose the coordinates). I wonder if you could advise on where I should look to tackle this problem?