No MY_DEBUGDEVICE.begin ?
-
I've been testing a Genuino Zero as a serial gateway. Everything works fine except for the redirection of debug output to the Programming port.
I saw a thread and a pull request which added MY_DEBUGDEVICE to the architecture files, but if I #define MY_DEBUGDEVICE SERIAL my gateway crashes, silently.
I believe this is because there is no 'begin' for MY_DEBUGDEVICE.
When I add one to to relevant architecture file it works fine, with debug output sent as expected to the Programming port.
I'm a bit puzzled how anybody has got this to work without that mod, have I missed something?
Note that adding MY_DEBUGDEVICE.begin into Setup in the sketch is too late - the node crashes before it gets to that point.
-
I think that it's probably because you are the first that use a separate port for debugging..
in hwInit for SAMD architecture, we only initialize the standard serial port (MY_SERIALDEVICE)
-
@fac13 as a workaround, could you try placing MY_DEBUGDEVICE.begin in a function called before() or preHwInit() in your sketch? MySensors will execute them before setup().
-
@mfalkvidd I tried both and neither worked - the node still failed to start.
My workaround is to add MY_DEBUGDEVICE initialization in hwInit() in MyHwSAMD.cpp , immediately after the initialization of MY_SERIALDEVICE,
i.e. insert these lines after line #76: -
MY_DEBUGDEVICE.begin(MY_BAUD_RATE);
#if defined(MY_GATEWAY_SERIAL)
while (!MY_DEBUGDEVICE) {}
#endifOf course if the two devices are the same then MY_SERIALDEVICE gets initialized twice, but doesn't seem to cause a problem.
-
fac13 about 2 hours ago
I realized I should have added a wait after the initialization, like this: -
void preHwInit()
{
MY_DEBUGDEVICE.begin(115200);
while(!MY_DEBUGDEVICE){};
}With that included, my sketch works without needing the architecture code mod.
Putting the same code in before() doesn't work.
Thanks for your help.
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 11 days ago • bocalexandru 9 days ago -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter 2 days ago -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
Forum Search not working?
Troubleshooting • 4 Oct 2023, 23:33 • Gibber 2 Sept 2024, 20:28 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22