Closed Olgidos closed 4 months ago
I would not call a "fix" but rather a hack what you need here, and for sure it would break Modbus. This protocol is time sensitive and uses states to handle the telegrams according to a master-slave architecture not compatible with your modifications. Eventually it could work, but you need to first stop the serial port an reconfigure it for Modbus after every debug message.
Instead, I recommend you to explore overloading the Modbus protocol itself, you can for example have a specific memory area were you dump debug messages and then you retrieve that using the multi-register read function, but always maintaining the master-slave architecture.
Ok I see. This sounds quite error prone and I already expected that it would be unlikely to get it to work. Then I will try it this way.
Is there an easy fix, so that I can send debug messages via the same UART interface from differen RTOS tasks like this:
it currently works until I get the first Modbus request, then both the debug log and modbus stops working, even so no task is hanging.
i also tried to use semaphores:
int _write(int fd, char *ptr, int len) {