Hello All
Hope you can help me with this problem.
I have a PIC18F46K22 connected to a DS3231 RTC using I2C communicating over hardware channel 2.
I am not able to read from the RTC without causing my processor to hang. This is caused by the SDA line being held low - there is no NAK generation.
The Flowcode sequence used in Test A is normal however changing it and unusually including a I2CMaster1::TransmitByte(0) in the sequence just before the Stop results in a NAK as in Test B (red dot on the logic analyser record). In this case the SDA line is released and all is fine.
Writing to the RTC in the standard way is fine and my addressing for this device is 0xD0 for master write and 0xD1 for master read.
Strangely this segment worked in FC6 and possibly in early FC7 but I cant remember with certainty.
Thanks a lot
Howard
FC7.2.1.4 patched yesterday
I2C causes processor to hang {Solved}
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: I2C causes processor to hang
Hi Howard,
For your last receive byte before the stop you should set the "Last" parameter to 1 to generate the NAK.
Let us know how you get on.
For your last receive byte before the stop you should set the "Last" parameter to 1 to generate the NAK.
Let us know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel