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)
-
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.
-
@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.
-
@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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login