need help with pins for the DS1302 chip
lockadoc
Posts: 115
This will be the first time I'll be using this chip.
I want to use the object DS1302_full.spin from the object exchange. I need to know if my pin setup is correct.
·
This code is from the object
········· PUB init( inClk, inIo, inCe )
········ clkcycles_us := ( clkfreq / _1us· ) #> 381· ' will work better with Propeller II
·
··········· clk := inClk
··········· io· := inIo
··········· ce· := inCe
··········· dira[noparse][[/noparse]ce]~~·········· 'set to output
··········· outa[noparse][[/noparse]ce]~···········
··········· delay_us(2)··········
··········· dira[noparse][[/noparse]clk]~~
··········· outa[noparse][[/noparse]clk]~··········
·
Is this the correct way to set it for my pin useage of·== Pin 9 Clock, Pin 10 Data Enable, Pin 11 Chip enable ==··
PUB init( inClk, inIo, inCe )
· clkcycles_us := ( clkfreq / _1us· ) #> 381· ' will work better with Propeller II
··9·· ·:= inClk
··10· := inIo
··11· := inCe
· dira[noparse][[/noparse]ce]~~·········· 'set to output
· outa[noparse][[/noparse]ce]~···········
· delay_us(2)··········
· dira[noparse][[/noparse]clk]~~
· outa[noparse][[/noparse]clk]~··········
·
When I run it with this setup All I get in the PST is all Zeros·· 00:00:00 00 00 00 00· it refreshes about ever second but does no change.
·
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Post Edited (lockadoc) : 3/11/2010 5:41:30 AM GMT
I want to use the object DS1302_full.spin from the object exchange. I need to know if my pin setup is correct.
·
This code is from the object
········· PUB init( inClk, inIo, inCe )
········ clkcycles_us := ( clkfreq / _1us· ) #> 381· ' will work better with Propeller II
·
··········· clk := inClk
··········· io· := inIo
··········· ce· := inCe
··········· dira[noparse][[/noparse]ce]~~·········· 'set to output
··········· outa[noparse][[/noparse]ce]~···········
··········· delay_us(2)··········
··········· dira[noparse][[/noparse]clk]~~
··········· outa[noparse][[/noparse]clk]~··········
·
Is this the correct way to set it for my pin useage of·== Pin 9 Clock, Pin 10 Data Enable, Pin 11 Chip enable ==··
PUB init( inClk, inIo, inCe )
· clkcycles_us := ( clkfreq / _1us· ) #> 381· ' will work better with Propeller II
··9·· ·:= inClk
··10· := inIo
··11· := inCe
· dira[noparse][[/noparse]ce]~~·········· 'set to output
· outa[noparse][[/noparse]ce]~···········
· delay_us(2)··········
· dira[noparse][[/noparse]clk]~~
· outa[noparse][[/noparse]clk]~··········
·
When I run it with this setup All I get in the PST is all Zeros·· 00:00:00 00 00 00 00· it refreshes about ever second but does no change.
·
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Post Edited (lockadoc) : 3/11/2010 5:41:30 AM GMT
Comments
Using the chip diagram at the top of DS1302_full.spin I did the following
clk -> pin 0
io -> pin 1
ce 1k resistor to pin 2
my init string is as follows
rtc.init(0,1,2)
Are you running it from a cog??· I had something similar happen when I tried to run it from a cog.· I had to initialize and config it inside the cog too.· Here is my adjustment to the included sample code to try it with a cog.
Hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
You have to either use the "code" tags ([noparse][[/noparse] code ] and [noparse][[/noparse] /code ] without the extra spaces) or attach your actual source code to a message using the Attachment Manager (use the Post Reply button to get it).
What you posted can't possibly work as you've shown it and we need to see what you're actually using to advise you.
using the included object, this is what I get on the PST
MSG Initiallizing
Trickle charge resister contents = 00000000
Writing Ram Address 0 CMD Byte 11000000
··· All the way to
Writing Ram Address 30 CMD Byte 11111100
··· Than
Reading Ram Adress 0 =0
··· To
Reading Ram Adress 30 = 30
Writing Ram Data in Burst Mode
Reading Ram Data in Burst Mode
Data 0 =0
·· To
Data 11 = 0
THAN ALL GET IS
00:00:00, 00 00 00 00
REPEATED UNTIL I STOP THE PST
This makes me think the chip is working, but not sending the time infromation
Thanks for· the help setting me back on course.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Writing RAM address 30 cmd byte = 11111100
Reading RAM address 0 = 0
Reading RAM address 1 = 1
Reading RAM address 2 = 2
Reading RAM address 3 = 3
Reading RAM address 4 = 4
Reading RAM address 5 = 5
Reading RAM address 6 = 6
Reading RAM address 7 = 7
Reading RAM address 8 = 8
Reading RAM address 9 = 9
Reading RAM address 10 = 10
Reading RAM address 11 = 11
Reading RAM address 12 = 12
Reading RAM address 13 = 13
Reading RAM address 14 = 14
Reading RAM address 15 = 15
Reading RAM address 16 = 16
Reading RAM address 17 = 17
Reading RAM address 18 = 18
Reading RAM address 19 = 19
Reading RAM address 20 = 20
Reading RAM address 21 = 21
Reading RAM address 22 = 22
Reading RAM address 23 = 23
Reading RAM address 24 = 24
Reading RAM address 25 = 25
Reading RAM address 26 = 26
Reading RAM address 27 = 27
Reading RAM address 28 = 28
Reading RAM address 29 = 29
Reading RAM address 30 = 30
Writing RAM data in burst mode
Reading RAM data in burst mode
Data 0 = 30
Data 1 = 29
Data 2 = 28
Data 3 = 27
Data 4 = 26
Data 5 = 25
Data 6 = 24
Data 7 = 23
Data 8 = 22
Data 9 = 21
Data 10 = 20
Data 11 = 19
20:20:00, 03 09 22 09
20:20:01, 03 09 22 09
20:20:02, 03 09 22 09
20:20:03, 03 09 22 09
20:20:04, 03 09 22 09
20:20:05, 03 09 22 09
20:20:06, 03 09 22 09
20:20:07, 03 09 22 09
20:20:08, 03 09 22 09
20:20:09, 03 09 22 09
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Post Edited (lockadoc) : 3/13/2010 7:38:40 AM GMT
I even changed the pins out from
·rtc.init( 11, 9,10 )
··· to
·rtc.init( 10, 9,11 )
and I still get the same result.·
I used a proto board and used a 8 pin dip socket and placed the crystal into the holes next to the dip and bent them over to the dip pins and soldered them together on the bottom of the board.Am I using the right size resistor?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Make sure you init with the correct pins
rtc.init(SCLK,I/O,/RST) ' where the pin names here correspond to the datasheet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
(SCLK- PIN 9) ,(I/O -PIN 10) ,(RST-PIN 11) and connected the pins as follows
rtc.init(SCLK,I/O,RST) = = rtc.nit (9,10,11)
Is it possible I over heated the cystal while soldering it?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
BTW, I noticed after a quick google that there are examples out there with pullup resistors on all three SPI pins, that's funny because the chip itself has 40K pull-downs on all three pins. Just shows people hook up things willy-nilly at times and while you can trust Google to dig it all up you can't trust what you find.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
I've add some other parts for the board which are not part of the clock chip for other objects and they work
·AND THANKS FOR THE INTEREST I just can not·think of why I can't get it to work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
Post Edited (lockadoc) : 3/14/2010 5:07:45 AM GMT
I know it's dumb but since I can't see Pin 1 connected I would ask if it is. Always do a continuity and shorting check as well as the volts on all pins (even gnd) too when it's powered up. Sometimes we are surprised by what is revealed. That also means we cross check our test equipment by checking against other things we do know are right (gee, I thought I was connected to the ground!)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
The reason I'm trying to use the DS1302 chip is I'm thinking of using it instead of the realtime clock object JM_SOFTRTC from the object exchange. for the project I posted in completed projects.
Thanks for trying to help see where I'm going wrong.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.
I just hope you have a genuine chip as it is not not uncommon to be sold a fake one although it's a long shot (shoot it, now there's a solution).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
Stay Tuned for the results later on Monday
Thanks BillyS
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life is fun with a Prop.
BillS
··· Louisville KY.