alejoseb / Modbus-STM32-HAL-FreeRTOS

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
GNU Lesser General Public License v2.1
519 stars 182 forks source link

ERR_BAD_SIZE when doing a query #73

Closed dolence closed 1 year ago

dolence commented 1 year ago

It's been a while since I've been doing tests using an USB module connected to the PC acting as master and an STM32F105 as slave and with some success. Now I'm trying to use embedded hardware on both master and slave and can't get what is wrong.
Following the examples provided I've been trying to query using an STM32H743 as master and the aforementioned STM32F105 as slave and u32NotificationValue is always returning -6 ERR_BAD_SIZE. I've made another test wiring the master to the USB adapter and connecting it to the PC. When I start a debug session I can see data being read as expected and on simulator slave coil value is being incremented. Still I got that ERR_BAD_SIZE. Baudrate is 9600 bps on both sides and on master side I've tried using an output pin as DE and using the hardware control avaliable on STM32H7 (setting port value to NULL) and both give the same result. Any toughts on what could be the cause?

image

alejoseb commented 1 year ago

This library is not meant to work with DE, that could be the reason for failing. Check your wiring as well, the configuration that you tested has been verified as working.