cwalter-at / freemodbus

BSD licensed MODBUS RTU/ASCII and TCP slave
720 stars 379 forks source link

MODBUS broadcast request (slave ID: 0) leaves system in illegal state with the error "receive buffer initialization fail." #45

Open BestBot7 opened 3 months ago

BestBot7 commented 3 months ago

I tried to send the modbus broadcast request i.e; slave id = 00, using the sample code of esp-idf modbus. the master sends the request and enters into an illegal state as shown in the figure and does not allow any further requests until reboot. As per the MODBUS protocol standard, the slave only receives request and processes it but doesn't respond since it is the broadcast request. But the freemodbus is making the master enter into illegal state. What is the exact problem for this error of modbus master entering into an unknown state? I suspect that the master is checking the port for any packet received from slave end. Since there is no packet on the port, it gives this error "receive buffer initialization fail." But the master goes into unknown state even without connecting to any slave. The log images of both modbus master and slave are attached for reference. Let me know the issue and ways to fix it.

MODBUS Master logs with broadcast request:

image

MODBUS Slave logs:

image

Thanks in advance!