I have a sensor connected onto a Arduino Uno.
When I use the Arduino sketch the sensor works and returns data.
Smart as I am (??), I watched the SMB data from the Arduino with a logic analyser and try to copy the commands into Flowcode.
I use the I2C component with the option "Enable SMB" but the sensor doesn't give me an ACK...
Here is what I get returned after a START, ADDRESS/Write
Here is what the Arduino sketch returns...
Except from the small timing differences I see no difference.
How is it that the Flowcode generated code doesn't get an acknowledge?
I2C vs SMB : whats wrong?
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 vs SMB : whats wrong?
Hmm, Looks ok to me too.
Not sure what to suggest on this one?
The signal that acks has the data changing on the falling clock edge whereas the other seems to occasionally change in between the falling and rising edge.
Not sure what to suggest on this one?
The signal that acks has the data changing on the falling clock edge whereas the other seems to occasionally change in between the falling and rising edge.
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
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: I2C vs SMB : whats wrong?
And the NACK version is the Flowcode version..Benj wrote:Hmm, Looks ok to me too.
Not sure what to suggest on this one?
The signal that acks has the data changing on the falling clock edge whereas the other seems to occasionally change in between the falling and rising edge.
Could it be that there is something wrong with the Flowcode I2C component?
The only difference between I2C and SMB is the timing of the ACK's?
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: I2C vs SMB : whats wrong?
I'm confused..
When I use the "SendByte Transaction" and I give the address : 0x5A it returns an ACK.
So the macro shifts the 0x5A and adds a 0 to complete the write request.
The sensor returns an ACK!
When I look at the data on my logic analyser I see that Flowcode sends 0x6D.. just prior to the ack.
0x5A shifted left and with a 0 behind for the "write" isn't 0x6D in my humble opinion?
Any suggestions?
When I use the "SendByte Transaction" and I give the address : 0x5A it returns an ACK.
So the macro shifts the 0x5A and adds a 0 to complete the write request.
The sensor returns an ACK!
When I look at the data on my logic analyser I see that Flowcode sends 0x6D.. just prior to the ack.
0x5A shifted left and with a 0 behind for the "write" isn't 0x6D in my humble opinion?
Any suggestions?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C vs SMB : whats wrong?
We could do with a little more information in order to help.
What sensor are you using? Could you post your Flowcode project?
Your previous comment ..
What sensor are you using? Could you post your Flowcode project?
Your previous comment ..
Does that mean that your project is now working?When I use the "SendByte Transaction" and I give the address : 0x5A it returns an ACK.
So the macro shifts the 0x5A and adds a 0 to complete the write request.
The sensor returns an ACK!
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: I2C vs SMB : whats wrong?
Thank you Leigh,LeighM wrote:We could do with a little more information in order to help.
What sensor are you using? Could you post your Flowcode project?
Your previous comment ..
I use the MLX90614 IR temp sensor: http://www.melexis.com/Infrared-Thermom ... 4-615.aspx
I've tried the Adafruit MLX90614 library and the MLXTEST sketch with it. This works fine.
When I try to make something with FC V6, and I send the address (0x5A) with FC I don't get an ACK, whereas when the Arduino sketch sends the 0x5A, the sensor always ACK's.
(see screenshots from the logic analyser).
This is when I use the "Transmit Byte" in the Flowcode macro.
When I use the "SendByte Transaction" in Flowcode and I send the address, it does ACK..
Both look the same on my logic analyser.
So the 0x5A (followed with a 0 for read) does not ACK with the Transmit Byte macro in FC6
0x05 with the SendByte macro does return an Ack.
When I use the "SendByte Transaction" and I give the address : 0x5A it returns an ACK.
So the macro shifts the 0x5A and adds a 0 to complete the write request.
The sensor returns an ACK!
No when I use the "SendByte Transaction" I must send a 16bit address (address H and L), and it doesn't recognise the 16bit address..LeighM wrote:Does that mean that your project is now working?
I've made a Flowcode chart that sends all adresses from 0-255 but it never ACK's on any of them.
BenJ told this about the logic analyser screenshots..
Benj wrote:at acks has the data changing on the falling clock edge whereas the other seems to occasionally change in between the falling and rising edge.
- Attachments
-
- Test1.fcfx
- (8.79 KiB) Downloaded 259 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 vs SMB : whats wrong?
Hi
Your test probably does not work because you do not have a Stop after each Transmit byte.
Looking at the datasheet, the protocol is quite complex, so the generic Flowcode I2C “Transaction” macros are not suitable.
You will need to build up a transaction yourself from the Start, TransmitByte, ReceiveByte and Stop macros.
From your previous notes, it looks like the device is responding OK to device address 0x5A,
so if you look at page 17 there is a read RAM word example, so for this you would need to call the following macros:
Start, TransmitByte(0xB4), TransmitByte(0x07), Restart, TransmitByte(0xB5), ReceiveByte(LSByte), ReceiveByte(MSByte), ReceiveByte(PEC), Stop
Hope that helps,
Leigh
Your test probably does not work because you do not have a Stop after each Transmit byte.
Looking at the datasheet, the protocol is quite complex, so the generic Flowcode I2C “Transaction” macros are not suitable.
You will need to build up a transaction yourself from the Start, TransmitByte, ReceiveByte and Stop macros.
From your previous notes, it looks like the device is responding OK to device address 0x5A,
so if you look at page 17 there is a read RAM word example, so for this you would need to call the following macros:
Start, TransmitByte(0xB4), TransmitByte(0x07), Restart, TransmitByte(0xB5), ReceiveByte(LSByte), ReceiveByte(MSByte), ReceiveByte(PEC), Stop
Hope that helps,
Leigh
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: I2C vs SMB : whats wrong?
Leigh, my hero of the day (or better, my hero of the month).LeighM wrote:Hi
Your test probably does not work because you do not have a Stop after each Transmit byte.
Looking at the datasheet, the protocol is quite complex, so the generic Flowcode I2C “Transaction” macros are not suitable.
You will need to build up a transaction yourself from the Start, TransmitByte, ReceiveByte and Stop macros.
From your previous notes, it looks like the device is responding OK to device address 0x5A,
so if you look at page 17 there is a read RAM word example, so for this you would need to call the following macros:
Start, TransmitByte(0xB4), TransmitByte(0x07), Restart, TransmitByte(0xB5), ReceiveByte(LSByte), ReceiveByte(MSByte), ReceiveByte(PEC), Stop
Hope that helps,
Leigh
I tried to copy the Arduino commands to get the sensor working. That wasn't the best tactic I now know.
This works fine thank you!