Hi,
I work on a coldfire MCF51CN128 to communicate with IIC on a module TCA9535 wich is an IIC module.
I'm trying to write on his ports, but, the module has no reaction, the writing does not work. But, he did had a reaction because he send me an acknowledge. There is my frame :
Do you have any idea of what could be the problem?
Thanks for your help !
Adrien Segura
27 clocks, a gap, then 19 clocks? I guess that's three bytes-plus-ack, then either the MCF51CN128 delayed sending the next byte or the device clock-stretched it. Then another three bytes.
It would help a lot if you listed the actual data bytes you are sending (or think you are sending). You don't expect us to decode the oscilloscope trace, do you?
The TCA9535 is sending ACK bits, so that is working. That also means you have the addressing correct. That's a common cause of of problems, because to sent a byte to device "N", the first byte has to be "N * 2". You seem to have that right unless there's another device on the I2C bus that's responding.
Otherwise you're having problems with a TI chip, so you should be asking for help in a TI support forum.
Tom
Hi,
thanks a lot for your answer, there is the frames i send :
- 0x 4 4 the adress of the micro
- 0x 8 4 command frame to indicate i want to write to the first ports
-0x data data of my program
-0x data data of my program
-0x data data of my program
i start the communication by puting the master mode on : IIC2C1_MST = 1 and writing data : IIC2D = data
and i wait for the end of transmission with : while (IIC2S_TCF !=1) {} waiting end of transmission
while (IIC2S_RXAK !=0) {} waiting acknowledge from slave
and then , i loop.
On this module, there is only one IIC module, so no one can respond except him.
I'll ask the same question on a TI forum.
Thanks for your help a lot !
Any other ideas ?
Adrien Segura
The solution to your problem is to read the TI Data Sheet.
So what are you doing IN DETAIL?
> - 0x 4 4 the address of the micro (0x44), with the R/W bit set to "Write",
> - 0x 8 4 command frame to indicate i want to write to the first ports (illegal)
> -0x data data of my program
> -0x data data of my program
> -0x data data of my program
The only valid values for that second byte are 0 to 7. "0x84" isn't a valid value for the command register.
If the chip happens to ignore the top bit, you're saying you want to "write to the first ports".
The problem there is the first port is Register 2 and not register 4, which is the value you're using.
You're writing to the two Priority Inversion registers and then the first Configuration register. What are you expecting to happen?
The most important thing (that you might have missed) is that the FIRST thing you have to do is to write to registers "6" and "7" to configure the pins that you want to be outputs to be OUTPUTS. If you don't do that they're configured to INPUTS, and writing to the output port registers won't do anything. Then you can perform two writes starting at "2" to set output pins and perform two reads starting at "0" to read the pin values of the ones configured as inputs.
Tom