- Ethernet support
- Web UI for configuration based on React 16 with Bootstrap
- TCP to RTU transparent mode
- OTA Update
- MQTT client (control GPIO pins)
This firmware can be run on any ESP32 board with LAN8720 Ethernet PHY. Tested on my EtherESP board. This board fully compatible with wESP32 board
These functions tested:
- Modbus gateway - read input register, read holding registers
- OTA update
components/freemodbus/common/include/esp_modbus_common.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/components/freemodbus/common/include/esp_modbus_common.h b/components/freemodbus/common/include/esp_modbus_common.h
index cd171c755..ea2da148c 100644
--- a/components/freemodbus/common/include/esp_modbus_common.h
+++ b/components/freemodbus/common/include/esp_modbus_common.h
@@ -30,29 +30,29 @@
// The Macros below handle the endianness while transfer N byte data into buffer
#define _XFER_4_RD(dst, src) { \
- *(uint8_t *)(dst)++ = *(uint8_t*)(src + 1); \
*(uint8_t *)(dst)++ = *(uint8_t*)(src + 0); \
- *(uint8_t *)(dst)++ = *(uint8_t*)(src + 3); \
+ *(uint8_t *)(dst)++ = *(uint8_t*)(src + 1); \
*(uint8_t *)(dst)++ = *(uint8_t*)(src + 2); \
+ *(uint8_t *)(dst)++ = *(uint8_t*)(src + 3); \
(src) += 4; \
}
#define _XFER_2_RD(dst, src) { \
- *(uint8_t *)(dst)++ = *(uint8_t *)(src + 1); \
*(uint8_t *)(dst)++ = *(uint8_t *)(src + 0); \
+ *(uint8_t *)(dst)++ = *(uint8_t *)(src + 1); \
(src) += 2; \
}
#define _XFER_4_WR(dst, src) { \
- *(uint8_t *)(dst + 1) = *(uint8_t *)(src)++; \
*(uint8_t *)(dst + 0) = *(uint8_t *)(src)++; \
- *(uint8_t *)(dst + 3) = *(uint8_t *)(src)++; \
- *(uint8_t *)(dst + 2) = *(uint8_t *)(src)++ ; \
+ *(uint8_t *)(dst + 1) = *(uint8_t *)(src)++; \
+ *(uint8_t *)(dst + 2) = *(uint8_t *)(src)++; \
+ *(uint8_t *)(dst + 3) = *(uint8_t *)(src)++ ; \
}
#define _XFER_2_WR(dst, src) { \
- *(uint8_t *)(dst + 1) = *(uint8_t *)(src)++; \
*(uint8_t *)(dst + 0) = *(uint8_t *)(src)++; \
+ *(uint8_t *)(dst + 1) = *(uint8_t *)(src)++; \
}
/**
- Prepare environment - https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html
- Firmware build
idf.py build
idf.py -p COMX flash
- UI build
cd front
npm start build
TOPIC: /HOST/gpio/command { "pin": 23, "state": 5 }
/api/gpio/state?pin=23
curl -k -vvv -F upload=@/mnt/d/Projects/wesp32/esp32-modbus-tcp2rtu/front/dist/main.test.gz https://192.168.0.42/ota/upload/file
Setup webapp Bootstrap IEEE754 converter OTA ESP32 pins reference
Copyright (C) 2019 Maksym Krasovskyi