Grand Central M4 Express random resetting

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
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Grand Central M4 Express random resetting

Post by WinterAir »

Hi!

I'm having some issue with my Grand Central M4 Express. I'm running Arduino code on it and I'm having random resets of the bord. I don't know if its due to being unplugged for a day or two or if it's truly random but it keeps reverting back to the "default state" with the neopixel on the board shining green. When that happens I have to re-flash my Arduino code to get my project up and running again...

Right now it's sitting plugged in to my PC during development but I plan to deploy it where I won't have access to my PC all the time and this kind of behavior will kind of ruin the project...

Is it just a case of "don't use Arduino on what is a primarily CircutPython board" or might there be something else wrong?

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

Re: Grand Central M4 Express random resetting

Post by dastels »

"don't use Arduino on what is a primarily CircutPython board"

yeah... that's not a thing. CircuitPython is like anything you't write in C++.

What is the Grand Central doing? What do you have connected to it? How is it being powered? Are the resets coincident with any particular action/behavior?

Dave

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Hi!

I'm making a MIDI controller inspired by Johns work in this guide https://learn.adafruit.com/grand-centra ... cuitpython and using Arduino instead of CircuitPython.

It's currently powered by USB (connected to PC). I got 16 potentiometers connected to A0-A15, 16 push buttons on D0-D7 + D14-D21 as well as one of those tiny TFT displays on the SPI pins and a rotary encoder on some random pins on the right side of the board.

The only consistent thing I've noticed is that the board resets when I've been away from it for a day or two, never while actually working with it. During those times away it's still been connected to the PC but the PC have been powered of. However, just unplugging the board for a while, or having the PC powered of during night, does not trigger a reset...

//Winter

P.s. @admins I noticed that there is a specifik sub-forum for Metros and the Grand Central, feel free to move the thread if this thread is in the wrong section.

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

Re: Grand Central M4 Express random resetting

Post by dastels »

So it's powered from the PC via USB, and nothing else?

Dave

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Yes, only via USB from my PC.

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

Re: Grand Central M4 Express random resetting

Post by dastels »

OK. Well, when the PC is off, so is the Grand Central because there's no power from the PC. When the PC is powered up, it powers the Grand Central which has the same effect as resetting it. I'm failing to see the problem here.

Dave

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Well yeah, if I power cycle the board it will naturally reset as if the "resets" button is pressed so maybe the reset is not the correct word to describe the problem...

The problem however, as described in my first post, is that the board keeps reverting back to what feels like a facktory preset. I.e. my code is gone (or at least not being executed on the board) and in order to get the board up and running once more I need to start up the Arduino IDE and re-flash/upload my Arduino code.

Is that intentional/as designed, do the Grand Central loose memory of the uploaded code after some time powered off?

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

Re: Grand Central M4 Express random resetting

Post by dastels »

OK, I understand better.

No, that shouldn't happen. Your code is put into flash memory where it will stay until overwritten. What is in your setup() function?

Dave

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Her's the setup()

Code: Select all

// SETUP
void setup() {
  Serial.begin(9600);

  // Buttons
  // Initialize buttons with pull up resistors
  for (int i = 0; i < NButtons; i++) {
    pinMode(buttonPin[i], INPUT_PULLUP);
  }
  
  // Set encoder pins as inputs
	pinMode(CLK,INPUT_PULLUP);
	pinMode(DT,INPUT_PULLUP);
  pinMode(buttonSelect, INPUT_PULLUP);
	// Read the initial state of CLK
	lastStateCLK = digitalRead(CLK);
  
  //initializ  1.14" 240x135 TFT:
  tft.init(135, 240);
  tft.setRotation(1);
  displayMenu();

 //Potentiometers 
  for (int i = 0; i < NPots; i++) { // Loops through all the potentiometers and initiate them to current value to remove flicker
    potCState[i] = analogRead(potPin[i]);
    potPState[i] = potCState[i];
  }
}

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

Re: Grand Central M4 Express random resetting

Post by dastels »

Hmm. I'll ask for more eyes on it.

Dave

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Grand Central M4 Express random resetting

Post by danhalbert »

Could you try two things:
1. What does INFO_UF2.TXT say when you double-click reset and get the ...BOOT drive? We're interested in the bootloader version.
2. Could you load this UF2, and then see what it prints to the terminal (or Arduino serial monitor)? It will print the same thing every few seconds. Note that it will erase what is on the board now.
print_samd51_fuses.uf2
(1 MiB) Downloaded 3 times

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Hi!

Her's the content of the INFO_UF2.txt:
UF2 Bootloader v1.23.1-adafruit.1-88-g797305f SFHWRO
Model: Grand Central M4 Express
Board-ID: SAMD51P20A-GrandCentral-v0

And this is the serial print from the UF2 file:
0x804000: 0xF69A9239
0x804004: 0xAEECFF80
0x804008: 0xFFFFFFFF
BOOTPROT: 0xD

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Grand Central M4 Express random resetting

Post by danhalbert »

That is an old version of the bootloader, which does not have protection against a SAMD51 hardware bug that can erase internal flash when there is a power glitch. Recent bootloaders set brownout protection in the bootloader to ameliorate this problem. If you update the bootloader, I think you will have no further problems, or many fewer.

To update the bootloader, see the lower right of this page: https://circuitpython.org/board/grandce ... 4_express/

When you load the updater UF2, GCM4BOOT should reappear almost immediately. It no longer takes "tens of seconds".

User avatar
WinterAir
 
Posts: 10
Joined: Fri Mar 30, 2018 12:51 pm

Re: Grand Central M4 Express random resetting

Post by WinterAir »

Ah!
Will try that, I did read a post about faulty bootloaders while looking into buying the Grand Central but it sounded as if it only affected old boards. Mine was purchased only a couple of weeks ago so I kind of never internalized it as something to check.

Thanks for the help and your hosting this excellent source of electronics and programming knowledge!I will get back if the problem precists but hopefully not :)

//Winter

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

Return to “Itsy Bitsy Boards”