Hi
This is in relation to an earlier question I posted sometime ago.
I had not had time to test this as was moving premises. But I have just done so today.
I followed all the instructions from here:
https://www.uugear.com/portfolio/compile-flash-firmware-for-witty-pi-4/
...and as I did not have an USBasp (on order) I followed everything under 'Flash the firmware with Raspberry Pi Emulated Programmer'.
After compiling without error and everything saying all was OK, I tried to boot up my Rpi. I connected my lipo and usb power bank. There were no lights on the witty board.
Any suggstions on that one? I will try again when I get the USBasp connector though.
In my original question you said this:
'The symptom you described indicates the board was in an unexpected state (probably the MCU was crashed), so it did not react to button action. A power cycle will reset its state and hance it works again.
As for why the MCU would crash, most probably it was due to insurficient input voltage. Yes, you set the low-voltage threshold to 4V,
which is rather high. However it really depends on the battery, if the battery could not deliver the required current, its voltage drops
very quick and it may cause the MCU to crash before the shutdown process is done.'
I figured I could test this by adjusting my configuration.
I changed it to this:
- Set low volateg threshold [3V]
- Default state when powered [default on]
Also, in my code service I check the voltage of the lipo battery every 5 seconds. If it reaches 4.0v or below I trigger the GPIO4 pin to high to shutdown the Pi.
This is my test scenario now:
Lipo and usb powr bank connected
My service is running.
I know my lipo battery is supplying volatge above 4v.
I then disconnect my usb power bank.
I can now monitor the lipo voltage coming in.
As soon as it goes below 4v I set GPIO4 to a high position (within my code).
Witty board flashes white. The Rpi flashes green
The Rpi will shutdown and everything is in standby.
The witty board just has the red light permanently on and no other lights are on (including the blue for the lipo battery)
I now reconnect my usb power bank.
Nothing happens.
I toggle the witty on/off switch.
The white light briefly comes on.
I now disconnect the lipo battery as well.
I then reconnect it.
I reconnect the usb power button.
Red and blue lights are illuminated on the witty board.
The Rpi starts up OK.
As I have the 'Auto-On when USB 5V is connected [Yes]' I expected the Rpi to start without me having to manually press the on/off witty power button.
The only explanantion I can see so far is that the MCU crashed. But as I had set the minimum voltage to 3.0v and I issue shutdown at 4v I cannot see why that can happen.
Can you suggest anything else for me to try?
I have tested this on 3 brand new Rpis, 3 brand new Witty boards and several different usb power banks and lipo batteries.
Thanks
This is in my witty log:
[2024-08-27 19:37:27] Shutting down system because button is clicked or GPIO-4 is pulled down.
[2024-08-27 19:37:27] Halting all processes and then shutdown Raspberry Pi...
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.13) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi Zero 2 W Rev 1.0
[xxxx-xx-xx xx:xx:xx] RTC has bad time, write system time into RTC
[xxxx-xx-xx xx:xx:xx] Writing system time to RTC...
<2024-08-27 19:37:43> Done 🙂
<2024-08-27 19:37:43> Firmware ID: 0x37
<2024-08-27
Should also of added I apply a Voltmeter Power Voltage and Current Tester Meter to the usb power bank and the voltage supplied from the usb power bank is definitely above 5Vs
After compiling without error and everything saying all was OK, I tried to boot up my Rpi. I connected my lipo and usb power bank. There were no lights on the witty board.
If you are compiling the firmware by yourself, instead of using the pre-compiled .hex file, you need to check the Arduino configurations very carefully, some options can totally change how the firmware works. For example, if the "pin mapping" is wrong, the firmware compiles well but will not work at all.
You should see the white light blinking, when a correct firmware has been flashed into your Witty Pi board.
The Rpi will shutdown and everything is in standby.
The witty board just has the red light permanently on and no other lights are on
Here is the problem, the red light should also go off, otherwise the shutdown procedure is not finished. The red light stays on means the 5V from Witty Pi to Raspberry Pi is not cut after the shutdown. In such case the firmware is waiting for Raspberry Pi to shutdown, and it does that by monitoring the voltage on Raspberry Pi's TXD pin. In normal situation, Raspberry Pi's TXD pin should go to 0V after shutdown.
Hi
Thanks for the feedback.
re: Hex
understood. Do you have a pre-compiled hex file for this model that has 'With brown-out detection'?
re:Red Light
That makes sense (thanks :). I will look further into that. So just to confirm, 'Raspberry Pi to shutdown, and it does that by monitoring the voltage on Raspberry Pi's TXD pin. In normal situation, Raspberry Pi's TXD pin should go to 0V after shutdown' this is the 5V from the lipo battery becayse the Rpi has not shutdown and that could be because of my code?
Hi, you were correct. The issue was with a timer in a script that was not terminated prior to shutdown. Obvious now and well embarrased. Thank you...