Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
System Reboot
We've found that occasionally rebooting the Bpod and AOM helps things run smoothly (occasionally the system can get in a non-functional state and this is the only way to get it out, though we're still trying to figure out exactly what's causing the non-functional state).  Since the power comes from the USB hub on the computer, rebooting or even powering the computer down does not cut power to the teensy.  So to force a reboot in the bpod we added the following code to the firmware in the section that starts

if ((PC.available() > 0) && (smaPending == false)) {
CommandByte = PC.readByte();

switch (CommandByte) {

case 'Q':  // SYSTEM RESET
          digitalWrite(GreenLEDPin, LOW);
          analogWrite(BlueLEDPin, 250);
          analogWrite(RedLEDPin, 128);
          SCB_AIRCR = 0x05fa0004;

Sending a Q causes the LED to turn magenta for 1s before it reboots and the LED goes back to blue flashing.

For the AOM we added the following in the section that starts

if (newOpCode) {
newOpCode = false;
switch(opCode) {

case 'Q': // SYSTEM RESET
        SCB_AIRCR = 0x05fa0004;

Sending a Q will stop sounds and reboot the teensy causing the orange light to blink. 

We've added these commands to the function EndBpod.m after the write Z command

 BpodSystem.SerialPort.write('Z', 'uint8');
 BpodSystem.SerialPort.write('Q', 'uint8');

Just a thought to maybe include in other module firmware if people are having any issues.

Hi Chuck,

Wow! Awesome find:

SCB_AIRCR = 0x05fa0004;

I'll definitely add this to our next firmware update, so users have the option to soft-reboot.


Forum Jump: