Can I change the Modbus TCP slave listening port at runtime in ESP-IDF?
Posted: Wed May 07, 2025 12:40 pm
I have a question about Modbus. I’m using the Modbus component in ESP-IDF. I initialize my device as a Modbus TCP slave and load an initial configuration. It runs a FreeRTOS task where it operates as a slave.
In my application, I can receive a new configuration for the slave via MQTT at runtime. I know that some parameters of the Modbus stack can be updated dynamically while the slave is running, but I’m not sure about the TCP port where the slave listens.
My question is: Is it possible to change the TCP port the Modbus TCP slave listens on at runtime, or do I need to destroy the slave instance and create it again with the new port?
Thank you very much in advance!
In my application, I can receive a new configuration for the slave via MQTT at runtime. I know that some parameters of the Modbus stack can be updated dynamically while the slave is running, but I’m not sure about the TCP port where the slave listens.
My question is: Is it possible to change the TCP port the Modbus TCP slave listens on at runtime, or do I need to destroy the slave instance and create it again with the new port?
Thank you very much in advance!