nRF52832 locking up maybe serial port

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lisleman
 
Posts: 117
Joined: Wed Aug 06, 2014 5:53 pm

nRF52832 locking up maybe serial port

Post by lisleman »

I just recently started using the nRF52832 Feather board. I had used the nRF52 Sense Feather in the past but I guess supply issues has made that one mostly unavailable.
I was a bit surprised that the nRF52832 acted differently than the Sense board when I first plugged it into the Arduino IDE (I'm using 1.8.16). I saw in the tutorial that updating the boot loader was suggested. I did that and saw the message that it went ok. I have run a few sketches with no problem until today.
It now seems to lock up.
I have it on the Quad expander board. A Feather Joywing and 4x8 neopixel matrix Feather Wing are connected to it.
I'm experimenting with polling the buttons on the Joywing and have based my code from your examples.
Is it possible to poll the joywing too frequently? After seeing the lockup I did add a few ms of delay between polls.

However I wonder if there is something about the serial USB connection to my MacBook that is causing a problem.
I have "un-locked" it by powering it down and reconnecting.
I'm using the /dev/cu.usbserial-0246D03C
I notice in the tutorial that one sketch had #include <Adafruit_TinyUSB.h> // for Serial
so I add that too.
Sorry if I have too many questions but I guess the "Get Board Info" option under "Tools" just does work on this board because of the "native serial port"? That's not a big deal but it started wonder about the serial port.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: nRF52832 locking up maybe serial port

Post by dastels »

Well, the sense uses an nRF52840, not an nRF52832.'

Can you post your code, and explain a bit more about how/when it locks up.

Dave

User avatar
lisleman
 
Posts: 117
Joined: Wed Aug 06, 2014 5:53 pm

Re: nRF52832 locking up maybe serial port

Post by lisleman »

Hmm, I just finished a long reply and thought for sure I hit submit. Not showing???
Here's the subroutine I use to poll the Joy Wing.

Code: Select all

// check the buttons for 20 milliseconds
// the displaying of the light pattern use the delay function
// the polling of the buttons often misses the button delay 
boolean pollbs4_20 () {
  uint32_t lastTime = millis();
  // light up display to show we are polling
  pixel.clear();
  uint32_t redc = pixel.Color(255, 0, 0);  // red
  pixel.setPixelColor(0, redc);         //  Set pixel's color (in RAM)
  pixel.setPixelColor(7, redc);         //  Set pixel's color (in RAM)
  pixel.setPixelColor(24, redc);         //  Set pixel's color (in RAM)
  pixel.setPixelColor(31, redc);         //  Set pixel's color (in RAM)
  pixel.show();
  // keep polling buttons for POLLTIME 
  while((millis() - lastTime ) <= POLLTIME) {
    // time to poll buttons
    uint32_t bs = ss.digitalReadBulk(button_mask);
    if (last_butts != bs) {
      // update the change what changed
      Serial.println(" Received button change ");
      Serial.println(bs, BIN);
      last_butts = bs;
      return (true);
    } else {
      delay (4);      // it seems polling the Joy wing too quickly is a problem
    }
  }
  return (false);
}
NOTE - if my other LONG reply doesn't show up I'll add another one explaining why I think the seesaw device is the issue here.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: nRF52832 locking up maybe serial port

Post by dastels »

TinyUSB is usually needed if you want to present a USB flash drive to the connected computer. If you aren't using it, you shouldn't include it.

Anyway, does the delay help with the lockout. You seem to imply it did. You don't really need to check buttons very often since they operate in people-time, not MCU-time. Every 10 mS is plenty often.

Dave

User avatar
lisleman
 
Posts: 117
Joined: Wed Aug 06, 2014 5:53 pm

Re: nRF52832 locking up maybe serial port

Post by lisleman »

Thanks for the TinyUSB information. I'll take it out.
I wish I (or the forum system?) didn't lose my earlier reply.

While I as troubleshooting this morning I noticed some odd behavior that made this more interesting. A bit more background on the setup. Three boards on a Quad Feather extender. The nRF52832 Feather, 4x8 NeoPixel wing (sitting on top of the nRF52832) , and the Joy Wing. I know about the advantages of the interrupt feature on the Joy Wing but I actually didn't notice I had to solder some pads to connect the interrupt to a pin. No big deal, but the solder stuff was cleaned up so I went with polling.

I started with just Up/Down buttons coded to generate a display pattern. The Left/Right buttons report that they had been pushed (not much delay with that).

What I call "lockup" is when the button pushing no longer changes the display. The Left/Right buttons being held down can generate a lockup sometimes.
I was always to clear up the lockup with a power down.
I thought the reset button on the Joy Wing should do the trick but it didn't. What it does do was odd. It makes the display act like Up/Down are being repeatedly pushed. When I looked on the serial monitor, all the buttons are reported as being pushed.
One more thing to note. I discovered that I can clear a lockup by pushing the Joy Wing reset and then the 4x8 wing reset.
I believe reading the seesaw (Joy Wing) too fast causes it to crash.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: nRF52832 locking up maybe serial port

Post by dastels »

That *is* interesting. All the resets should be connected.

Have you tried the joywing library? https://github.com/leonidlezner/FeatherJoyWing

Dave

User avatar
lisleman
 
Posts: 117
Joined: Wed Aug 06, 2014 5:53 pm

Re: nRF52832 locking up maybe serial port

Post by lisleman »

dastels wrote: Mon Sep 12, 2022 10:39 pm That *is* interesting. All the resets should be connected.
I just checked with my multimeter the 4 pins on the end of the 16 pin row on FeatherWing Quad Side-by-Side. Only the power and ground of those 4 pins are connected through. So reset is NOT connected through on the expander board.
Obviously that explains why pushing the reset button on the Joy Wing acted the way it did. It appears that only the seesaw chip was reset. I also swapped the 4x8 Neopixel wing with Joy Wing. With Joy Wing plugged directly on top of the processor board the reset button operated as it should.

I still wonder if the seesaw chip has a recommended polling frequency/wait time.
Oh thanks for the reference link. I had used (copied part of it) the example that AdaFruit provides for the Joy Wing.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: nRF52832 locking up maybe serial port

Post by dastels »

You are either mistaken, have damaged the board, or need to retouch/fix the soldering.

All pins are connected to each of the 4 feather locations.. They have to be. The purpose of the board is to replicate plugging wings onto the back of a feather. That requires all connections.

Dave

User avatar
lisleman
 
Posts: 117
Joined: Wed Aug 06, 2014 5:53 pm

Re: nRF52832 locking up maybe serial port

Post by lisleman »

dastels wrote: Tue Sep 13, 2022 5:00 pm You are either mistaken, have damaged the board, or need to retouch/fix the soldering.
Well I've checked out the pin headers with a multimeter diode test setting, I have swapped boards around, same result. Now after reading you reply, I've swapped in another feather processor board I've been using for years and got the same results.
So maybe it's the second or third option in your reply. ??
I will say the original project for this Quad expander was to connect a TFT 480x320 featherwing display to it. As you might know, the TFT wing has a female header which is great to just plug the processor board in. I wanted to use other wings with the display.
My idea of using the quad didn't work. See the post viewtopic.php?p=939426#p939426 for that story. Because of that project I ended up putting the headers on the opposite side of the quad board. The I2C works as other GPIO, so I don't see why the opposite side would be the problem.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: nRF52832 locking up maybe serial port

Post by dastels »

Does your meter have a continuity setting? Use that if it does.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”