Hi
I have this issue when communicating with DS1307 RTC
When receiving ACK after D1 flowcode is outputing this as a NACK (1) insted of 0 .
All other Conditions are Correct only the Ack after D1 is incorrect any ideas what can this be ?
Thanks
I2C ACK
Moderator: Benj
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: I2C ACK
Hi
I am continuing to experiment with the intent to help find the problem
below is a waveform of the I2c Protocol sending the same data only this time the data is not
a Read from device command (or condition ) this time flowcode gets the ACK Correct .
The only difference i can see is that the SDA go High exactly after the ACK is Revived .
I am continuing to experiment with the intent to help find the problem
below is a waveform of the I2c Protocol sending the same data only this time the data is not
a Read from device command (or condition ) this time flowcode gets the ACK Correct .
The only difference i can see is that the SDA go High exactly after the ACK is Revived .
- Attachments
-
- logic 2.png
- (99.36 KiB) Downloaded 1350 times
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: I2C ACK
Hi
Here is another update the problem seems to be only when receiving ACK after the Read Command
below is the waveform of the i2c when Reading from MCP4725 DAC .
Flowcode Gets the ACK Wrong this time outputing it as logic 1 (NACK) .
Hope this will help to find a solution to this problem as soon as possible .
Thanks
Here is another update the problem seems to be only when receiving ACK after the Read Command
below is the waveform of the i2c when Reading from MCP4725 DAC .
Flowcode Gets the ACK Wrong this time outputing it as logic 1 (NACK) .
Hope this will help to find a solution to this problem as soon as possible .
Thanks
- Attachments
-
- Logic 3.png
- (113.54 KiB) Downloaded 1350 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C ACK
Could you attach your program?
Are you using I2C Master component?
When using the ReceiveByte macro you need to set the "Last" parameter, either 0, or 1 if no more data is to be requested, this will cause a NAK.
Are you using I2C Master component?
When using the ReceiveByte macro you need to set the "Last" parameter, either 0, or 1 if no more data is to be requested, this will cause a NAK.
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: I2C ACK
Hi LeighM
Thanks for your quick reply.
So yes I am using I2C Master the ACK in question is being produced by the Renter of the TRANSMIT BYTE ,
it happens only when transmitting the Read command . from the logic Analyzer I am able to see that an ACK
is being sent back from the device to the MCU , but flowcode returns this as a NACK .
The Project is a RS232 to I2c interface if you need a copy I will PM it to you .
But I think this is not necessary because it happens on all devices when Sending the Read Command .
Thanks in Advance
Alan
Thanks for your quick reply.
So yes I am using I2C Master the ACK in question is being produced by the Renter of the TRANSMIT BYTE ,
it happens only when transmitting the Read command . from the logic Analyzer I am able to see that an ACK
is being sent back from the device to the MCU , but flowcode returns this as a NACK .
The Project is a RS232 to I2c interface if you need a copy I will PM it to you .
But I think this is not necessary because it happens on all devices when Sending the Read Command .
Thanks in Advance
Alan
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C ACK
So when you say "outputing it as logic 1" do you mean that the Flowcode TransmitByte macro is returning a 1 (to indicate Nack received from the device)?Here is another update the problem seems to be only when receiving ACK after the Read Command
below is the waveform of the i2c when Reading from MCP4725 DAC .
Flowcode Gets the ACK Wrong this time outputing it as logic 1 (NACK) .
What is your target processor?
And I presume you are using a hardware channel?
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: I2C ACK
Hi
Yes exactly that is what i meant the TransmitByte macro is returning a 1 when it should return a 0 .
The Target MCU is an ATMEGA2560 ( ARDUINO MEGA2560 R3 ) , also yes I am using hardware channel
I tried to experiment whit the I2C component settings with the intent of fixing the problem but to no avail.
it means that the problem is also present with the default I2c Component Settings.
Yes exactly that is what i meant the TransmitByte macro is returning a 1 when it should return a 0 .
The Target MCU is an ATMEGA2560 ( ARDUINO MEGA2560 R3 ) , also yes I am using hardware channel
I tried to experiment whit the I2C component settings with the intent of fixing the problem but to no avail.
it means that the problem is also present with the default I2c Component Settings.
- Attachments
-
- Image 1.png
- (12.65 KiB) Downloaded 3920 times
Last edited by Alan_37 on Tue Aug 30, 2016 10:44 am, edited 1 time in total.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C ACK
Just as a test, could you try disabling Slew and SMB, if you have not tried that already?
Might be worth PMing your code if you could please.
Meanwhile I'll take a look at the CAL code.
Might be worth PMing your code if you could please.
Meanwhile I'll take a look at the CAL code.
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
- Alan_37
- Posts: 179
- Joined: Sun May 01, 2016 8:36 pm
- Has thanked: 51 times
- Been thanked: 54 times
- Contact:
Re: I2C ACK
Hi LeighM
Here is a very simple Program i made now , when sending TEST to RS232 it
will Read the time registers from DS1307 RTC , but it first Sends the ACKS and NACK Received
on every Byte Transmitted .
The DS1307 Register byes dose not match the logic Analyzer cause it was taken at a different time .
But this should clearly show the BUG when sending D1 ( Read Command ) .
Here is a very simple Program i made now , when sending TEST to RS232 it
will Read the time registers from DS1307 RTC , but it first Sends the ACKS and NACK Received
on every Byte Transmitted .
The DS1307 Register byes dose not match the logic Analyzer cause it was taken at a different time .
But this should clearly show the BUG when sending D1 ( Read Command ) .
- Attachments
-
- 232test.jpg (133.54 KiB) Viewed 7236 times
-
- DStest.jpg
- (382.48 KiB) Downloaded 1314 times
-
- Dev.rar
- (57.11 KiB) Downloaded 281 times