Can't Shutdown - always reboots?

My matrix creator/Pi will not stay shutdown. I issue this command:

sudo shutdown -h now

It performs the shutdown immediately, but then boots right back up versus staying down so I can shut it off safely.

Is this normal with the Matrix creator attached?
Could it have something to do with me pulling up some of the Matrix Creator Expansion Port Pins to 3.3V with a 10M resistor?

Thanks,
Sean

Anyone have any thoughts on this one?

I tried myself and got the same result. Will share here if I find why is happening.

Thanks,

Thanks for verifying.

I read in some old forums that if you pull certain pins high, it takes it out of its halt state. Maybe its the state I’m leaving my Matrix Creator GPIO in before I sudo shutdown -h now.

-Sean

Any discoveries yet on how to keep the Matrix from rebooting after shutdown?

This really does seem to be a problem. I actually needed to shut down my pi yesterday, but the matrix was seemingly making it just reboot as stated here. It ended up irrevocably corrupting my SD card (to the point that dd/parted/fdisk etc couldn’t even do anything with it to recover or even reformat).

Kind of wondering now if I can just pull it off the pi entirely while it’s running, but that is also something I would prefer to avoid…

What you experienced is definitely the fear for all.

I imagine this has something to do with the matrix taking a pin high that results in taking a GPIO on the Pi high that turns it back on.

If that is the case, there may be hope in that one could have a program to shutdown that first drives those pins low.

However, I hope the guys who made the thing can dig through their drawings to know for sure.

See ya’,
Sean

I googled it and found this https://raspberrypi.stackexchange.com/questions/57994/prevent-wake-from-halt. Then, tested it and it looks like that is the same problem we are having with the MATRIX Creator. The I2C SCL pin at GPIO03 is rebooting the Pi.

I am making some test to see how we can make that the MCU does not use the I2C bus after sudo shutdown -h now and try to integrate that so is transparent for the user but that is not finished.

For now an idea of how to fix this would be:

  • Halt the MCU using JTAG before shutdown
  • use the sudo shutdown -h now

For halting the MCU you can create a copy of the openocd file located at :

1. Go and make a copy of the openocd cfg file for the mcu:

cd /usr/share/matrixlabs/matrixio-devices
sudo cp ./cfg/sam3s_rpi_sysfs.cfg  ./cfg/sam3s_halt.cfg

2. Edit the new config file ./cfg/sam3s_halt.cfg

sudo nano ./cfg/sam3s_halt.cfg

In the file, after target just leave init and reset halt like this:

...
target create sam3n.cpu cortex_m -endian little  -chain-position 3
init
reset halt
shutdown

3. Go to matrixio-devices folder and call openocd using the new file

cd /usr/share/matrixlabs/matrixio-devices
sudo openocd -f cfg/sam3s_halt.cfg

4. Now you can call the shutdown

sudo shutdown -h now

Note:
Next time you just make sure to do Step 3 before shutting down.

This is working for me now. Let me know if works for you guys too.

Will update here when this is solved.

-Yoel

1 Like

Awesome! I can work with this by calling a script that issues the commands from my code.

One thing, step 3:

sudo openocd -f cfg/sam3s_rpi_halt.cfg

should be

sudo openocd -f cfg/sam3s_halt.cfg

There is the text “rpi” that wasn’t there in the prior steps.

The only other aspect is that any everloop LEDs on at the time of shutdown stay on. So, this will need to be handled by code prior to shutting down.

For example, if you have Alexa as a service, you’ll want to kill the service:

sudo systemctl stop YOURSERVICENAME

I then follow with a script to turn all the LEDs off.

The one blinking blue LED stays on as well if its caught on when it shutsdown. I haven’t figured out how to turn that one off.

Thanks for tackling this!
Sean

Great!

Just updated. Thanks :slight_smile:

I guess you are referring to the D48 LED in the MATRIX Creator, close to the Atmel SAM3S microcontroller. This LED is controlled entirely by the microcontroller. This blink is normally used to know if the program in the microcontroller is running. To remove the blinking, you could modify the firmware and use it to flash the MCU. If you are interested please create a new topic and I will be glad to help.

Will this be fixed? Just purchased the creator and ran into this problem, luckily found this topic and with the manual steps I was able to turn the Pi off but seems that this could/should be fixed permanently?

Although, seeing as this topic is from 2018 and the file mentioned hasn’t been updated since 2016 (according to Github) my hopes are not very high.