Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. No MY_DEBUGDEVICE.begin ?

No MY_DEBUGDEVICE.begin ?

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 1.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fac13
    wrote on last edited by
    #1

    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.

    mfalkviddM 1 Reply Last reply
    0
    • T Offline
      T Offline
      tbowmo
      Admin
      wrote on last edited by
      #2

      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)

      https://github.com/mysensors/MySensors/blob/59b15f5824bf060fa153b30065d089b04fff77c7/hal/architecture/SAMD/MyHwSAMD.cpp#L70

      1 Reply Last reply
      0
      • F fac13

        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.

        mfalkviddM Online
        mfalkviddM Online
        mfalkvidd
        Mod
        wrote on last edited by
        #3

        @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().

        F 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @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().

          F Offline
          F Offline
          fac13
          wrote on last edited by fac13
          #4

          @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) {}
          #endif

          Of course if the two devices are the same then MY_SERIALDEVICE gets initialized twice, but doesn't seem to cause a problem.

          F 1 Reply Last reply
          1
          • F fac13

            @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) {}
            #endif

            Of course if the two devices are the same then MY_SERIALDEVICE gets initialized twice, but doesn't seem to cause a problem.

            F Offline
            F Offline
            fac13
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            1

            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
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            19

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular