Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : RTC Problem
Page 1 of 2 | |||||
Author | Message | ||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Hi I have an odd problem with the PCF8563 RTC on the MicroMite, when I run the test code below which is a simple loop the CPU will only SLEEP on every other cycle ie: SLEEP miss SLEEP miss SLEEP miss etc The full code is far more complex but has exactly the same problem, I have tried various pauses FOR NEXT loops DO loops without success Any ideas ? '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''' Interval = 5 ' sets sleep time (integer value between 1 and 59 inclusive) Pause 500: ?:? "Entering Loop":?:Pause 500 DO StartInt ? "SLEEPING" ' CPU SLEEP ' ? "AWAKE:" LOOP ' ------------------------ SUBROUTINE ----------------------------------------------- SUB StartInt I2C OPEN 100,100 ' open an i2c connection with bus speed 100KHz and 100mS timeout I2C WRITE &H51, 0, 2, &H0F, Interval+1 ' pass Interval time to RTC timer register I2C WRITE &H51, 0, 2, &H0E, &B10000010 ' Set Minutes OR Seconds: MINUTES=&B10000011 SECONDS=&B10000010 I2C WRITE &H51, 0, 2, &H01, &B00000001 ' reset any triggered flags and start the timer countdown I2C CLOSE ' close 12c connection END SUB '----------------------------------------------------------- ------------------------- |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
what stops the sleeping mode? |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Interval is set to 20 secs when time expires INT pin changes state - active LOW (connected to MicroMite WAKEUP pin) Sorry 5 secs in the test code |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
I think what you need to do is add a bit of a delay between the RTC waking the MicroMite and before you put it back to sleep. You may find the Int pin still 'active'. After the line 'Print "AWAKE:" add Pause 500 See how that goes - you may need to 'experiment with the value of the Pause (increase and/or decrease until it works. Let us know how you get on . . . edit: The more I think about it, the more I am convinced this is the issue - simple test will prove me wrong (or right ) For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
I have tried delays everywhere upto 5 secs I get the same thing, I have also tried using I2C Write to stop and start the clock (control/status 1 register) |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
What wakes him up? He cannot wakeup himself without external help! |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Wakes which one up ? |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Ok here s another observation it always ignores the first cycle, I tried to programme a single sleep mode but it cycles twice before it sleeps |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
RTC or CPU ? |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
The micromite.. Will the rtc trigger pin 16? If so, you have external help;-) |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Will the rtc trigger pin 16? If so, you have external help;-) The RTC triggers PIN 43 (44 pin micromite) it all works, its a cycling issue, it does not sleep on every cycle |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
Your hardware setup is ok? Pullups/downs... Power supply ok? Test another.. |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
The Wakeup input on the uMite is edge triggered in either direction. What is the RTC INT pulse like? Is it remaining low when triggered or is it a 16 millisecond pulse? Have you actually measured that pin? |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
I have recommended that edu001 monitors the RTC Int pin (active low) and waits for it to be at a high level before the SLEEP command is issued. He is testing this now and carrying out other measurements. With his findings we can then make our next batch of 'suggestions' For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Pullups/downs... Power supply ok? Test another.. Yes pullups are all ok the power supply is a very clean 3.31v |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
Here is the output from the logic analyser http://imgur.com/iCixP7L |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Can you do the test where you pulse a pin immediately before SLEEP and pulse the same pin immediately after SLEEP. This then allows us to see where the program is at (in relation to the rising edge of the INT pin. If you can post a zoomed in image so we can see timings and I2C detail then it could help resolve For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
More info 3 images http://imgur.com/fEaCaPm,zE9DGvA,xns6D4R |
||||
edu001 Regular Member Joined: 14/07/2014 Location: United KingdomPosts: 82 |
http://imgur.com/fEaCaPm,zE9DGvA,xns6D4R Missed one http://i.imgur.com/JPZuGMM.png |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Brilliant. Now can you sample 4 cycles (reduce the sleep time to something like 2 seconds) i.e. grab about 10seconds of sample and send the screen shot. I don't need to see the I2C detail, but as long as I can see the INT pin level and the 'test' pin levels and their relative timings then that would be helpful (Leave I2C connected - will just be 'blips' in the screen grab). Thanks Jed . . . . For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
Page 1 of 2 |
Print this page |