I have used the I2C for serial EEPROMS but seem unable to get my code to work for the DS1307 RTC. I must have some sort of blind spot.
Does anyone have assembly code for the DS1307 they can share?
Thanks for the effort, Mac, but I really wanted to get the I2C module working. I finally did after quite of bit of debuggin.
Anyone else want assembly code for the DS1307 clock chip I have it posted on my website:
Two considerations come to mind where the DS1307 may differ from an EEPROM device -
Yes, I have the correct slave address and I have set the IIC to 25KHz during debugging.
My assembly code is based on that you posted on the forum some time ago.
No problem with EEPROM.
What is frustrating is that I KNOW how to interface a DS1307. I did it years ago for a MC68HC11 using bit-banging.
There is something about the IIC module that I am not understanding.
I had a closer look at AN1759, pertaining to the DS1307 in conjunction with the ancient HC705 family. While this is "bit-banging" code, its implementation does not appear to be particularly complex, and speed is not an issue since IIC is a relatively slow process anyway. I adapted the code for HCS08 devices, making extensive use of macros to make the sequence clearer. This code is attached, but is untested as I don't have the requred hardware setup.
If this code works for the RTC device, perhaps it may lead to sorting out what is missing when you attempt to use the IIC module.
Basing on your sample bit bang code, i tried it on a MS9S08QE32 with a Freescale MPR121, from my scope i can see the tx is working but when rx i couldn't seem to get the value from the MPR121 touch sensor IC.
I tested it with your code. Could you advise?
The linked communications protocol document for the MPR121 suggests that the 7-bit slave address value may be configured from the range $4C, $4D, $4E and $4F. However, your code seems to select from the range $5A, $5B, 5C and $5D. This may be the reason for the IIC slave not responding.
I found on this forum post https://community.freescale.com/message/62881#62881 that there are some errors in the datasheet. A friend of mine have tried that out and it works according to the address provided from that post. I also find that there are really lack of info provided for that part. haha.. Thanks.
Retrieving data ...