geoffr
Posts: 89
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

RUN header - circuitry

Sun Mar 06, 2016 11:34 pm

I am trying to find out more information about how the RUN pin of the BCM is connected, and what circuitry is in place outside the BCM to connect up to the RUN jumper (i.e. for reset functionality).

What I am trying to do is to connect the RUN pin to the INT pin of a DS3231 RTC. The intention of this is to be able to set an alarm on the RTC prior to shutting down the Pi, which will allow the Pi to be rebooted at some time in the future.

The DS3231 requires that the INT pin (which is active low - i.e. it is pulled low for an alarm) have a pull-up. My understanding is that the RUN pin does already have a pull-up, so I am wondering if that pull-up is sufficient when connecting it to the DS3231. My experience however is that if I just connect the two pins, when the alarm activates while the Pi is booted, the Pi stops running, but does not boot - which seems to indicate that the RUN pin is not returning to a high state. I have not managed to do any investigation yet, and I was hoping I might be able to get some more insights into how the RUN pin is presented on the PUN jumper before I start trying to work out what is going on. I have also seen some mention somewhere of a capacitor being used as part of the reset circuit as well.

Any advice or pointers to documentation would be appreciated.

Regards,
Geoff.

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: RUN header - circuitry

Sun Mar 06, 2016 11:58 pm

I don't know whether or not it's the same on all models, but...

https://www.raspberrypi.org/documentati ... matics.pdf
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

klricks
Posts: 7209
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: RUN header - circuitry

Mon Mar 07, 2016 12:40 am

GTR2Fan wrote:I don't know whether or not it's the same on all models, but...

https://www.raspberrypi.org/documentati ... matics.pdf
The RUN circuit is located on page 1 grid 9-C
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

geoffr
Posts: 89
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: RUN header - circuitry

Mon Mar 07, 2016 10:58 am

It always helps to read the manual - carefully.

After sitting with a multimeter and watching what is going on on the INT pin of the DS3231 and then rereading the datasheet of the DS3231 *carefully* I have discovered that when the DS3231 generates an alarm it pulls INT low until the alarm is reset. Now, given that my Pi is not booted before the alarm is generated, I need to sort this out in hardware. - That means turning the edge which is generated when the alarm is activated into a pulse....

fanoush
Posts: 575
Joined: Mon Feb 27, 2012 2:37 pm

Re: RUN header - circuitry

Mon Mar 07, 2016 11:58 am

geoffr wrote: I need to sort this out in hardware. - That means turning the edge which is generated when the alarm is activated into a pulse....
Would adding additional controller like cheap atmega/attiny/pic or arduino pro mini clone be easier solution? I am trying to do similar stuff but also monitor li-pol battery and power the Pi completely off to save power or when battery goes low. I just verified the pro mini board can draw less than 1mA while sleeping (with power led scratched off and enabling atmega low power states) and it can monitor its own voltage so I can attach it directly to battery and control the Pi. In such solution I would attach the RTC to the pro mini.But of course this is more complicated.

Anyway, if you keep the Pi powered why to shutdown it at all? It does not save any significant power when being in 'sudo powerroff' state so you may just keep it running (?). To do something so it feels turned off you can implement diferent unix runlevel and switch to it and stop services/turn off screen/disable usb, remount card read only/... but still keep linux running waiting for RTC. Then rtc can just trigger GPIO and switch runlevel back to the one that starts services, remounts root rw etc.

User avatar
Burngate
Posts: 6330
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RUN header - circuitry

Mon Mar 07, 2016 4:35 pm

Perhaps putting a capacitor in series between the INT and RUN pins would work ...

Since there's a 100n cap from RUN to GND, something like 3 times that size might be suitable - will pull RUN low enough, then a few microseconds later let it rise?

geoffr
Posts: 89
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: RUN header - circuitry

Thu Mar 10, 2016 1:53 am

Burngate wrote:Perhaps putting a capacitor in series between the INT and RUN pins would work ...

Since there's a 100n cap from RUN to GND, something like 3 times that size might be suitable - will pull RUN low enough, then a few microseconds later let it rise?
A capacitor did the trick: By putting a in a resistor between the output of one inverter and the next and then adding a capacitor to ground on the input I was able to retard the signal a lot more and get my edge detector to generate a low pulse that is long enough to work around the debounce circuitry on the reset header. I probably now need to replace the NOR gates that I am using as inverters (with one input pulled down) with Schmitt Trigger inverters and then put in a smaller capacitor than I am currently using.

This is what I have ended up with for now - the only reason for the 47uF cap is that is what I had lying around. :D
edge-detect.jpg
edge-detect.jpg (15.73 KiB) Viewed 1395 times

Return to “Interfacing (DSI, CSI, I2C, etc.)”