ModbusRTU client that pushes firmware to server node.
How to use:
- Connect to target node
- Prapare binary image (Sketch - Export compiled binary)
- Open http:/// in browser
- Choose firmware file
- Press Update firmware
- Debug information on update pregress is available in debug console
ModbusRTU server that receives and flashes new firmware.
uint16_t readFileRec(uint8_t slaveId, uint16_t fileNum, uint16_t startRec, uint16_t len, uint8_t* data, cbTransaction cb);
uint16_t writeFileRec(uint8_t slaveId, uint16_t fileNum, uint16_t startRec, uint16_t len, uint8_t* data, cbTransaction cb);
uint16_t readFileRec(IPAddress slaveId, uint16_t fileNum, uint16_t startRec, uint16_t len, uint8_t* data, cbTransaction cb, uint8_t unit);
uint16_t writeFileRec(IPAddress slaveId, uint16_t fileNum, uint16_t startRec, uint16_t len, uint8_t* data, cbTransaction cb, uint8_t unit);
slaveId
server id or IP AddressfileNum
File number to accessstartRec
Start offset in file (words)len
Length of data (words)*data
Pointer to data. In case ofreadFileRec
must be at leastlen
* 2 bytes.cb
Transactional callback functionunit
ModbusTCP unit id
typedef std::function<Modbus::ResultCode(Modbus::FunctionCode, uint16_t, uint16_t, uint16_t, uint8_t*)> cbModbusFileOp; // ST:
typedef Modbus::ResultCode (*cbModbusFileOp)(Modbus::FunctionCode func, uint16_t fileNum, uint16_t recNumber, uint16_t recLength, uint8_t* frame); // no-STL
bool onFile(std::function<Modbus::ResultCode(FunctionCode, uint16_t, uint16_t, uint16_t, uint8_t*)>); // STL
bool onFile(Modbus::ResultCode (*cb)(Modbus::FunctionCode, uint16_t, uint16_t, uint16_t, uint8_t*)); // no-STL
func
function code to process (FC_READ_FILE_REC or FC_WRITE_FILE_REC)fileNum
file # to read/writerecNumber
record number in file (record size is word = 2 bytes)recLength
number of records to read/write*frame
pointer to data buffer
onFile
sets file operations handler function.
(c)2021 Alexander Emelianov
The code in this repo is licensed under the BSD New License. See LICENSE.txt for more info.