Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for M5Stack ATOM RS485 #4

Open
wlcrs opened this issue Aug 18, 2022 · 1 comment · May be fixed by #5
Open

Support for M5Stack ATOM RS485 #4

wlcrs opened this issue Aug 18, 2022 · 1 comment · May be fixed by #5

Comments

@wlcrs
Copy link

wlcrs commented Aug 18, 2022

The M5Stack ATOM RS485 has the RX/TX pins connected to GPIO 22/19 (more info in docs)

image

To get this project to work, I had to make the following modifications:

diff --git a/platformio.ini b/platformio.ini
index b8717e9..4c62481 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -10,7 +10,7 @@

 [env:esp32dev]
 platform = espressif32
-board = esp32dev
+board = m5stack-atom
 framework = arduino
 lib_deps =
     https://github.com/tzapu/WiFiManager.git
diff --git a/src/main.cpp b/src/main.cpp
index 86c15dc..edafbcc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,7 +30,7 @@ void setup() {
   wm.autoConnect();
   dbgln("[wifi] finished");
   dbgln("[modbus] start");
-  modbusSerial.begin(config.getModbusBaudRate(), config.getModbusConfig());
+  modbusSerial.begin(config.getModbusBaudRate(), config.getModbusConfig(), GPIO_NUM_22, GPIO_NUM_19);
   MBclient = new ModbusClientRTU(modbusSerial, config.getModbusRtsPin());
   MBclient->setTimeout(1000);
   MBclient->begin();

Without these modifications, the firmware crashed during initialization:

[wifi] finished
[modbus] start
ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

Any chance that you can prevent this crashing from occurring and make the RX/TX pins configurable?

@zivillian zivillian linked a pull request Aug 21, 2022 that will close this issue
@zivillian
Copy link
Owner

Thanks for reporting. Can you test the firmware from #5 (available here)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants