Board doesn't ping with modbus lib
Opened this issue · 0 comments
MatTab3335 commented
Hello! I'm trying to run modbus tcp on lwip stack (NUCLEO-H755ZI-Q), so the problem:
- without adding your function ModbusTask() everything works fine - the board responds to ping request
- adding ModbusTask() ruine something, I can't figure what exactly. Further investigations revealed that the problem is maybe connected with lwip rx pool allocation, in debug I've counted how many times LWIP_MEMPOOL_ALLOC and LWIP_MEMPOOL_FREE were called, so the sequence of allocations and frees is: (A - allocation, F - free)
A-A-A-A-A-A-A-A-A (9 pools) - F (8 pools) - A (9) - F (8) - A-A-A-A (12) - F (11) - A (12) - F (11) - A (12) - A (Fail)
This behavior pattern repeats, always maximum 12 pools are allocated, an attempt to allocate 13th fails.
Without modbus the sequence looks like:
A-A-A-A-A (5) - F (4) - A (5) - F (4) - A (5) - F(4)
and continue to maintain 4 allocate pools.
Somehow inserting modbus creates conditions for races of memory allocation and free functions.