How difficult would this be to get working on an RP2040/Pico W? #95
Replies: 4 comments 1 reply
-
Sure there is no reason that the firmware could not be be made to work with a pico board and as you noted, the pin selections #if def statements would need to be updated to include support for the pico. The arduino code handles most of the low level stuff so it should be fairly painless. I'm sure it would probably run even better on it. I don't have any boards so really can't test at this point but I'll pick up a couple for playing around though as I do like the ARM platform. The board seems to be very capable. |
Beta Was this translation helpful? Give feedback.
-
This function in ecpsoftwareserial will need to be adapted of course. Just add your own #ifdef statment.
And of course ESP.getCpuFreqMHz() and ESP.getCycleCount() will need to be replaced with the pico equivalent |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response! I'll try messing around with it once I grab some optocouplers and have a bit of time on hand and report back if I get it working. |
Beta Was this translation helpful? Give feedback.
-
Update: I did end up getting this to work on a Pico W with some modification. I used pins 21 for RX/SCL, 20 for TX/SDA, and GP18 for Monitor/SCK. In addition to the pin number changes and the getCpuFreqMHz() and getCycleCount() changes pointed out above, I also had to remove all of the instances of "IRAM_ATTR". Finally, I had to remove the call to optimistic_yield() in SofwareSerial::available() of ECPSoftwareSerial.cpp. I made most of the changes using #ifdef and #if defined() calls so that code should still work for ESP8266/ESP32. I'm happy to share once I test a bit more to make sure everything is functional. |
Beta Was this translation helpful? Give feedback.
-
I'm not very familiar with ESPHome, and I'm relatively new to working with microcontrollers (mostly been messing around with small personal projects on Pico/Pico W). I see that ESPHome does support RP2040 boards, but taking a look through the code for the Vista ECP ESPHome component and the libraries, I do see various "if" type statements with ESP8266 and ESP32 boards referenced that look like they'd need to be modified to get it to work with an RP2040.
As far as I can tell, some of these are about setting and/or checking for correct pin configurations for the data connections (VistaAlarm.yaml, ECPSoftwareSerial.cpp, vistaAlarm.h), although there a few other places where the two ESP boards seem to be coded differently that I'm less clear about (ECPSoftwareSerial.h, vista.cpp, and vista.h have specific options written for the ESP32). Would getting this work on an RP2040/Pico W be as simple as coding in the correct pins for the Pico W in the YAML and library files?
I realize ESP boards can be had fairly cheaply, but I have spare Pico W's laying around and would need to wait for a cheap ESP to be shipped, so I'm wondering if this is a simple modification to get working or something where I'd need to better understand how ESPs and ESPHome work.
To be clear, I'm not asking for someone to do this for me - I'm happy to mess around with it a bit if it's not too deep a dive and is fairly straightforward.
Beta Was this translation helpful? Give feedback.
All reactions