Pages: [1]   Go Down
Author Topic: rtc spi help 1305 and 1302 3wire also epoch  (Read 1015 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

greetings. i have available 1302 and 1305(of which i would like to use 1305). i looked through the posts here and found this http://arduino.cc/forum/index.php?PHPSESSID=edc377455dd4ccb8fe7325bda4d0ce0a&topic=54467.0     but i dont understand exactly whats going on in some parts. the code im trying to use works on other spi devices and im not getting anything on the 1305 ive setup. ive tied SERMODE to +5 to indicate spi mode, vice 3wire, and grounded all unused power pins as per the datasheet. i know these are old parts but im not able to get a 1307 or any other rtc for that matter. i need to use what i have. plus im having trouble with i2c which is another topic.

Code:
#include <SPI.h>
#define ss 10//ss


void setup() {
 SPI.begin();
digitalWrite(ss,LOW);
 pinMode(ss,OUTPUT);
 SPI.setClockDivider(SPI_CLOCK_DIV16);
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE1);
  Serial.begin(9600);
  digitalWrite(ss,HIGH);
  SPI.transfer(0x0F>>8);
  SPI.transfer(0x0F);
  byte r=SPI.transfer(0);
  digitalWrite(ss,LOW);
  Serial.println(r, BIN);
}
  void loop() {
  }

i get a 128 returned from this. ive tried the code from the other post with the suggested fixes and get nada also. any insight? or better yet anyone have a simple to understand sketch, either transfering one byte at a time or burst mode read with lots of comments. thank you. also with the 1302 which i would use, im not understanding the read, of which im sure is the simplest thing im missing. i would like to move on to other sensors, but an rtc is paramount i think in any project. my robot will never take over the world if he cant at least tell time.
http://datasheets.maximintegrated.com/en/ds/DS1305.pdf

also interested in using epoch to store timestamp, i see alot of posts using this method, some suggestions from ppl, but no real instructions on setting it up and executing it. thank you.
« Last Edit: January 16, 2013, 06:04:23 pm by grendle » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know the DS1305, but I made this for the DS1302 : http://playground.arduino.cc/Main/DS1302
The communication with the DS1302 is something special, it is not the normal SPI.
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you for that, im running with the 1302, im going to try this later with the 1305 since it does spi and the same "3wire" the 1302 uses. i probably should have been a little more clear in my post, not only in getting these rtc's running, but timestamping them with some kind of real world sample to an eeprom. your work is getting me in the right direction thank you.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1018
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have to note the Arduino pinMode() did change.
The way the internal pull-up is used did change. I have to look some day into the source code of that function to see how it is implemented, and doesn't cause a glitch on the output.
« Last Edit: January 19, 2013, 02:56:41 am by Krodal » Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well your efforts will not go unnoticed, as i have several 1302's so im going to use them. im sure other ppl use them also. thank you for your time and effort. i used these several years ago on the Basic Stamp, but the Uno is just so much more, better, im not going backwards ^^ thx again!
Logged

Pages: [1]   Go Up
Jump to: