View previous topic :: View next topic |
Author |
Message |
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
MCP7952X/MCP7951X SPI Real-Time Clock Calendar |
Posted: Tue Aug 20, 2013 6:33 am |
|
|
Hi all
have someone already use this RTCC ?
is there any driver or source that exist for this ?
thanks in advance |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue Aug 27, 2013 8:36 am |
|
|
hi all
So I begin to write the drivers for this RTTC.
I can write, read everything work good, but the data aren't stored and the clock seems not to run.
When I read my change, they are always the same no sec, min,.. change, just the value I store.
What I am doing wrong? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Aug 27, 2013 8:55 am |
|
|
Posting a very short program (10 lines) would make it a lot easier to help you. Now we have to guess.
Do you make the CS line high again after the databyte has been written? So, the sequence to write to a register should be:
- make CS low
- send WRITE instruction (0x02)
- send address byte
- send data byte
- make CS high again
See figure 10-2 in the data sheet.
When you can read/write the registers but the clock is not running, then most likely you didn't set the ST bit in address 0x01. This bit is used to Start the Oscillator. See for further info the description of register 5-2 in the data sheet. |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue Aug 27, 2013 10:26 am |
|
|
I find out my problem I erase the ST bit when I write the second.
So it's corrected. |
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue Aug 27, 2013 11:14 am |
|
|
another question
How to only set one bit on Spi Write command? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Aug 27, 2013 1:44 pm |
|
|
Using the 'logical or' command '|' you can add bits to an existing value.
Code: | #define ENABLE_ST 0b10000000
spi_write(value | ENABLE_ST); |
|
|
|
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
|
Posted: Tue Aug 27, 2013 2:05 pm |
|
|
Yes, I found it before your reply.
Everything work nice.
Thanks for your help. |
|
|
PrinceNai
Joined: 31 Oct 2016 Posts: 480 Location: Montenegro
|
|
Posted: Mon Oct 17, 2022 3:15 am |
|
|
Quote: |
With this code I hoped to make the seconds from the RTC visible on the display! But I only keep seeing the zero from the variable 'Data'
|
Well, we keep seeing zero of your code :-). Post it and someone will sure try to help you. |
|
|
|