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?
Grand Central M4 Express random resetting
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Grand Central M4 Express random resetting
"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
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
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
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.
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.
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Grand Central M4 Express random resetting
So it's powered from the PC via USB, and nothing else?
Dave
Dave
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
Yes, only via USB from my PC.
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Grand Central M4 Express random resetting
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
Dave
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
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?
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?
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Grand Central M4 Express random resetting
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
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
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
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];
}
}
- dastels
- Posts: 15820
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Grand Central M4 Express random resetting
Hmm. I'll ask for more eyes on it.
Dave
Dave
- danhalbert
- Posts: 4687
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Grand Central M4 Express random resetting
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.
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.
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
Hi!
Her's the content of the INFO_UF2.txt:
And this is the serial print from the UF2 file:
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
- danhalbert
- Posts: 4687
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Grand Central M4 Express random resetting
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".
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".
- WinterAir
- Posts: 10
- Joined: Fri Mar 30, 2018 12:51 pm
Re: Grand Central M4 Express random resetting
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
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
Please be positive and constructive with your questions and comments.