debevv / nanoMODBUS

A compact MODBUS RTU/TCP C library for embedded/microcontrollers
MIT License
268 stars 53 forks source link

Recover from link drop #56

Open mikestrauser opened 1 month ago

mikestrauser commented 1 month ago

Hello,

We have successfully merged nanoMODBUS into our STM32F4 project (using FreeRTOS and lwIP). However, sometime when the link drops momentarily nanoMODBUS does not recover. I have code that checks the PHY to see if the link is active, if not, it sets the netif down then the link and when it goes back active it sets them back up. Is there something that should be done when this happens to restore nanoMODBUS operation?

Mike.

debevv commented 1 month ago

Hi, can you check the read/write platform functions are still called, or if the code is stuck inside of one of them?
Alternately, try to setup again nanomodbus. Like, after the connection is reestablished make a new instance and redo the setup (addresses, callbacks, etc.)
In general, there shouldn't be any internal state preventing the library from working. At worst, you could get an error and then the next operation should go on successfully.

mikestrauser commented 1 month ago

Thanks. In the meantime, I determined that there was a bug in lwIP and it seems to work now.

Mike.

From: Valerio De Benedetto @.> Sent: Wednesday, July 24, 2024 6:45 AM To: debevv/nanoMODBUS @.> Cc: Mike Strauser @.>; Author @.> Subject: Re: [debevv/nanoMODBUS] Recover from link drop (Issue #56)

Hi, can you check the read/write platform functions are still called, or if the code is stuck inside of one of them? Alternately, try to setup again nanomodbus. Like, after the connection is reestablished make a new instance and redo the setup (addresses, callbacks, etc.) In general, there shouldn't be any internal state preventing the library from working. At worst, you could get an error and then the next operation should go on successfully.

— Reply to this email directly, view it on GitHubhttps://github.com/debevv/nanoMODBUS/issues/56#issuecomment-2247980720, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALCOBSYBDZDTLJV73I4G7PLZN6VVXAVCNFSM6AAAAABK7B7K7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBXHE4DANZSGA. You are receiving this because you authored the thread.Message ID: @.**@.>>