Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Strange results from RTC!!!!!

Status
Not open for further replies.

tkvenki

New Member
Hi All,

I have written a code to write and read from the RTC chip DS1305. I'm using VS2000 as my SPI master. After Writing some data to the RTC. When I try to read it I'm getting the following output. I observed the waveforms are also in accordance with the output.
--------------------------------------------------------------------------
Output:
Starting SPI application................
The device SPI is opened
Configuration is successfully set!!
After Read --> 255 0 0 0 0 128 128
------------------------------------------
After Read --> 255 0 0 0 0 128 128
------------------------------------------
After Read --> 255 0 0 0 0 128 128
------------------------------------------
--------------------------------------------------------------------------
Please find the code attached to this post. Please let me know if there is some obvious mistakes. Also suggest me some hardware issues that i can look into.
 

Attachments

  • spi.c
    2.8 KB · Views: 171
Problem Solved......

Hi All,

I got the solution for my problem.
The issue was basically with the setting of Clock Phase and Clock Polarity.

For DS1305 the settings are:
Config_t.bClockPolarity = DCT_CONST_SPI_CLOCK_POL_LOW;
Config_t.bClockPhase = DCT_CONST_SPI_CLOCK_PHA_HIGH;

Anybody who wants to test the DS1305, can use the code attached in my previous post, with the changes in the settings mentioned above.

Best Regards
Venki
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top