modbus unexpected behaviour
Posted: Sat May 25, 2019 12:38 pm
Hello,
I`m experimenting with modbus right now. I have 2 ESP32 setup connected as shown https://github.com/espressif/esp-idf/tr ... bus_master here. I`ve flashed example slave for one, example master for second (modified so it only sends requests to slave 1).
Now I get READ events very rarely. So I thought i`d dump the data read from UART like that
Now i noticed something weird. Requests seems to be the very similar, yet modbus doesn`t recognize them.
Is it a bug, or this can be hardware related?
I`m experimenting with modbus right now. I have 2 ESP32 setup connected as shown https://github.com/espressif/esp-idf/tr ... bus_master here. I`ve flashed example slave for one, example master for second (modified so it only sends requests to slave 1).
Now I get READ events very rarely. So I thought i`d dump the data read from UART like that
Code: Select all
...
if(p_uart_obj[uart_num]->rx_cur_remain > length) {
len_tmp = length;
} else {
len_tmp = p_uart_obj[uart_num]->rx_cur_remain;
}
memcpy(buf + copy_len, p_uart_obj[uart_num]->rx_ptr, len_tmp);
for(int i = 0; i < len_tmp; i++){
printf("%02x", buf[i]);
}
printf("\n");
UART_ENTER_CRITICAL(&uart_spinlock[uart_num]);
p_uart_obj[uart_num]->rx_buffered_len -= len_tmp;
uart_pattern_queue_update(uart_num, len_tmp);
...
Is it a bug, or this can be hardware related?
Thanks in advance!0001040000000271cb
00010300000002c40b
01030002000265cb
HOLDING READ: time_stamp(us):954205088, mb_addr:3, type:2, st_address:0x3ffb2c80, size:2
01040000000271cb
INPUT READ: time_stamp(us):957362832, mb_addr:1, type:8, st_address:0x3ffb2c6c, size:2
010300000002c40b
HOLDING READ: time_stamp(us):957524114, mb_addr:1, type:2, st_address:0x3ffb2c7c, size:2
01030002000265cb
HOLDING READ: time_stamp(us):957685073, mb_addr:3, type:2, st_address:0x3ffb2c80, size:2
01040000000271cb
INPUT READ: time_stamp(us):960842758, mb_addr:1, type:8, st_address:0x3ffb2c6c, size:2
00010300000002c40b
00010300020002
0001
0001040000000271cb
00010300000002c40b
0001030002000265cb
0001040000000271cb