Current version of the OpenAuto Pro is 11
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GPIO-POWEROFF Overlay apparently being overridden.
#1
Hi there, thanks in advance for your time.

I recently switched my system over to OAP from Crankshaft-NG.

I built a latching circuit that allows the Pi to determine when to switch it's own power off. This is set up in the config.txt file with a dtoverlay gpio-poweroff setting on GPIO26. The pin is active low. I have a script that monitors an input from the ignition key in the car. When the key is switched off, a shutdown command is initiated to run after a set amount of time. This way if I just pop into a shop quickly to grab something and come out, the Pi will still be running and I won't have to wait for it to reboot. This used to work perfectly with CS-NG.

What is happening with OAP is it seems that OAP overrides the power-off overlay on GPIO26 and my Pi on occasion (not every time) will turn off the instant the key is turned off. It appears that the GPIO has been taken low by something else while OAP is running. It only appears to happen when OAP is running.

I thought perhaps I needed to enable the internal pull up on GPIO26 and that maybe I had a floating output (I can't find the drawing of the latching circuit schematic I made!) But this has not resolved the issue.

Does OAP reconfigure GPIOs when it starts?

Any other ideas as to what might be going on? Thanks
Reply
#2
OpenAuto Pro does not use any GPIO unless you explicitly select it in Settings (for day/night or rear camera switching).

It just looks like you need a debouncing in your Power Off solution.
Reply
#3
(09-01-2020, 06:38 AM)BlueWave Wrote: OpenAuto Pro does not use any GPIO unless you explicitly select it in Settings (for day/night or rear camera switching).

It just looks like you need a debouncing in your Power Off solution.

I had selected GPIO18 for headlights. Would this likely interfere with the gpio-poweroff overlay in any way?
Reply
#4
(09-01-2020, 10:06 AM)wittsend Wrote:
(09-01-2020, 06:38 AM)BlueWave Wrote: OpenAuto Pro does not use any GPIO unless you explicitly select it in Settings (for day/night or rear camera switching).

It just looks like you need a debouncing in your Power Off solution.

I had selected GPIO18 for headlights. Would this likely interfere with the gpio-poweroff overlay in any way?

Raspberry PI ground circuits are poorly designed. Actually everything can interfere with reading of GPIO status. Even connecting phone via USB may trigger change of the GPIO state. You definitely need deboucing logic if you do not have it yet. There is no way to avoid that.
Reply
#5
I found the schematic for the power circuit. Could you kindly provide a suggestion as to where you believe de-bouncing may be necessary? Thank you.

   

(09-01-2020, 10:20 AM)BlueWave Wrote:
(09-01-2020, 10:06 AM)wittsend Wrote:
(09-01-2020, 06:38 AM)BlueWave Wrote: OpenAuto Pro does not use any GPIO unless you explicitly select it in Settings (for day/night or rear camera switching).

It just looks like you need a debouncing in your Power Off solution.

I had selected GPIO18 for headlights. Would this likely interfere with the gpio-poweroff overlay in any way?

Raspberry PI ground circuits are poorly designed. Actually everything can interfere with reading of GPIO status. Even connecting phone via USB may trigger change of the GPIO state. You definitely need deboucing logic if you do not have it yet. There is no way to avoid that.

Thanks for the heads up. Would this create a similar problem leading to outputs being swayed as well?

I should also point out that this was not an issue when the Pi was running CS-NG, however there is a chance that something was upset when I removed the system from the car to upgrade the software... Undecided
Reply
#6
Hi there, just following up on this. It appears there may be something to the theory that the GPIO pins are being disturbed. I had recently written another script to switch the touch screen's backlight off when the ignition key is turned off. I noticed that my latching relay circuit was clicking off simultaneously with the backlight turning off.

I inserted a delay on the backlight turning off of 5 seconds after the key is turned off and this seems to have solved the issue. I guess there is a fluctuation in power when the key is turned off, and that combined with the LED backlight switching off is enough to scramble the IOs on the Pi occasionally. One day I'll pull it out and check it with a scope but I'm content with that explanation for now.

Thanks again for your help.
Reply
#7
Yes, you need SW debouncer for reading such signals. Mentioned 5 seconds is quite a lot. Normally it should be less than 1 sec.
Good practice is to apply SW debouncing for all inputs signals.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)