Pin forced low - error codes?

Posted on
  • Hi All,
    Sometimes I get a message on Puck v1 (firmware v2.08) after performing reset(): "Pin D2 forced low. Pin D2 shorted low. Error code 12". Pin D2 controls a neopixel led strip (WS2813, works fine), not grounded. Could not find any reference, neither error codes list. What does that message mean, please?

  • Sat 2021.04.24

    Is the pinMode() being set before an attempt to write to that pin?­bal_pinMode

    While I continue to search for the error code, this line concerns me:

    'Pin D2 controls a neopixel led strip (WS2813, works fine), not grounded'

    By 'not grounded' does this mean there is no ground between the Puck and the WS2813?

    A floating ground will cause havoc as there is no common reference between the devices.

    Caution: As there doesn't appear to be a common ground, and while I'm unaware of the wiring skill level applied here, Puck is a 3.3V battery operated device being connected to a 5V WS2813 strip, which requires significanly more power to drive the individual LED's than the Puck could ever possibly supply. Is there a 3V-5V level-shifter in place and a separate supply for the WS2813 strip? How many individual Neopixels are there? Which leads to what calculations were used for the supply power requirements?

  • Sat 2021.04.24

    Hi @AndreyVS

    'Could not find any reference, neither error codes list'

    It took a bit of time before familiarity on locating content became easy.

    Take a look at the function definition at:­bal_pinMode

    and seek the Right Facing Arrow just to the right of the heading 'function pinMode' and click on it. That will take you to the source repository.­b/master/src/jswrap_io.c

    But, as you will find, the error list for Pins is not in that file, so I had to perform a Google search using the 'site' qualifier:

    Google:    "shorted low" site:­b

    which will take you to that exact error:­b/master/libs/puckjs/jswrap_puck.c#L1128­

  • Many thanks, Robin! Appreciated your explanation of way to search! Your GitHub link shows that at initial selftest it sets pins to 1 & pullup and checks whether state persists afterwards. In my case the pin returns 0, what causes the error.

    Thanks for other questions, ground is common for all elements, Puck is connected through a level shifter (just for a case, a M74VHC1GT125DT1G with grounded control input) and I power a strip with 40 leds via a booster module on MHCD42. All are powered from a Li-Ion, through a 3v regulator (XC6206P302MR) to Puck.

    BTW, at initial state the MHCD42 is turned off, so the level shifter is not powered. But I get the error even when I reset on working MHCD42, when the selftest is performed on working level shifter.. And the story is that I see the error only once per 5-10 resets..

    Anyway, thanks to @Robin the error logic is clear now, if I find its reason, will revert.

  • Hi! The self test error isn't anything to worry about.

    Basically, if you hold down BTN1 for ~5 sec while powering the Puck on, a self test is performed. This is so we can check them all before sending out, but also as an easy way for others to check them. Once you've attached anything to the Puck's pins you could expect that kind of error to occur (it just shows the self test is working ok!).

    However, the question then is why is the self test being performed? Were you explicitly calling Puck.selfTest or do you think you could have been holding BTN1 while applying power? I can't think of any other way it could be triggered...

  • Hi! Cool, Gordon, thanks for the comment. In my case the selftest is run when I set watch with reset() to BTN:

    setWatch(function() {
      LED1.write(1); reset();
    }, BTN, {edge:"rising", debounce:50, repeat:true}); 

    When I press BTN for the first time after powering Puck on, the selftest is run (I see all leds lit up and then this message from the topic, then red led blinking). If I further upload and press without powering off, the selftest is not run.

  • Hi - thanks!

    I've just filed an issue for this here:­ues/2001

    It looks like Puck.js looks at BTN's state after any reset, not just when it boots. I'll have a look at fixing that for the next release.

    However, to work around it an easy fix is just to trigger your command when the button is released, not when it's pressed (eg rising -> falling):

    setWatch(function() {
      LED1.write(1); reset();
    }, BTN, {edge:"falling", debounce:50, repeat:true}); 
  • Ha! Cool, thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Pin forced low - error codes?

Posted by Avatar for AndreyVS @AndreyVS