Hi
I tried implementing the application note r01an6961ej0110-rl78g16-modbus. I am able to run the code but facing some issues while returning of Modbus frame. Using the MCU as Modbus RTU slave and Modbus poll software as master to check data.
The issue is the slave returns frame when master sends data twice! that is the Modbus Poll software sends Modbus read request two times and the slave responds to only one. The Modbus poll logs are attached.
Is this some timer error or framing error I even tried sending the Modbus frame manually using the computer terminal there also when I send the Frame twice the slave returns only once!
Tx:20-12:55:13.676-01 01 00 00 00 07 7D C8 Tx:21-12:55:16.724-01 01 00 00 00 07 7D C8 Rx:22-12:55:16.770-01 01 01 7F 10 68 Tx:23-12:55:17.784-01 01 00 00 00 07 7D C8 Tx:24-12:55:20.814-01 01 00 00 00 07 7D C8 Rx:25-12:55:20.861-01 01 01 7F 10 68 Tx:26-12:55:21.875-01 01 00 00 00 07 7D C8 Tx:27-12:55:24.916-01 01 00 00 00 07 7D C8 Rx:28-12:55:24.962-01 01 01 7F 10 68 Tx:29-12:55:25.969-01 01 00 00 00 07 7D C8 Tx:30-12:55:28.993-01 01 00 00 00 07 7D C8 Rx:31-12:55:29.039-01 01 01 7F 10 68 Tx:32-12:55:30.047-01 01 00 00 00 07 7D C8
Tx:35-12:50:50.278-01 03 00 00 00 07 04 08 Tx:36-12:50:51.319-01 03 00 00 00 07 04 08 Rx:37-12:50:51.365-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:38-12:50:51.867-01 03 00 00 00 07 04 08 Tx:39-12:50:52.978-01 03 00 00 00 07 04 08 Rx:40-12:50:53.024-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:41-12:50:53.525-01 03 00 00 00 07 04 08 Tx:42-12:50:54.635-01 03 00 00 00 07 04 08 Rx:43-12:50:54.680-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:44-12:50:55.185-01 03 00 00 00 07 04 08 Tx:45-12:50:56.297-01 03 00 00 00 07 04 08 Rx:46-12:50:56.343-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:47-12:50:56.845-01 03 00 00 00 07 04 08 Tx:48-12:50:57.958-01 03 00 00 00 07 04 08 Rx:49-12:50:58.003-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:50-12:50:58.506-01 03 00 00 00 07 04 08 Tx:51-12:50:59.615-01 03 00 00 00 07 04 08 Rx:52-12:50:59.661-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:53-12:51:00.162-01 03 00 00 00 07 04 08 Tx:54-12:51:01.274-01 03 00 00 00 07 04 08 Rx:55-12:51:01.326-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:56-12:51:01.822-01 03 00 00 00 07 04 08 Tx:57-12:51:02.935-01 03 00 00 00 07 04 08 Rx:58-12:51:02.981-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:59-12:51:03.485-01 03 00 00 00 07 04 08 Tx:60-12:51:04.598-01 03 00 00 00 07 04 08 Rx:61-12:51:04.658-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:62-12:51:05.159-01 03 00 00 00 07 04 08 Tx:63-12:51:06.274-01 03 00 00 00 07 04 08 Rx:64-12:51:06.319-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:65-12:51:06.824-01 03 00 00 00 07 04 08 Tx:66-12:51:07.937-01 03 00 00 00 07 04 08 Rx:67-12:51:07.982-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:68-12:51:08.484-01 03 00 00 00 07 04 08 Tx:69-12:51:09.595-01 03 00 00 00 07 04 08 Rx:70-12:51:09.641-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:71-12:51:10.146-01 03 00 00 00 07 04 08 Tx:72-12:51:11.258-01 03 00 00 00 07 04 08 Rx:73-12:51:11.303-01 03 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EF 15 Tx:74-12:51:11.805-01 03 00 00 00 07 04 08
Hello,
The sample code has some logging functionality via UART. Are you able to get any error logs in a similar way ?
I am working on only one board as a slave so was not checking the UART. But on debugging the program the program enters the following error block alternatively, not able to understand the cause of this as the master is sending the sequence correctly also the error clears on the alternative Modbus frames.
case MODBUS_ERROR_ILLEGAL_FUNCTION: { // R_PRINT_STR("MODBUS_ERROR_ILLEGAL_FUNCTION", NULL, 0); //__BKPT(); check_error=3; R_MODBUS_Send_Error(modbus_receive_frame->slave_address, modbus_receive_frame->function_code, ERROR_CODE_ILLEGAL_FUNCTION); break; }
Looking at the return value:
These are the supported function codes:
Hello
That is my concern the same frame works alternatively one frame is being executed and the other one returning the error code,
I have tried changing the Modbus polling times to many different combinations and also sending random frames manually, no matter the time between Modbus master requests the error persists.
Is this some stack corruption issue? or maybe the received data that is parsed correctly is not being cleared for the next frame and some data is already present in the frame buffer?
HI
this is the alternate frame that is causing the error the image below shows the frame buffer which is causing the error somehow 0,10 value are added in front of the Modbus frame which is causing the error. I do not know where this data is coming from?