Unable to communicate using external I2C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to communicate using external I2C

520 Views
jmu
Contributor I

Hi,

 

I have a question regarding the external I2C block in Processor expert. I am using CodeWarrior version 10.6.4 and the micro controller is part of the MC9S12ZVC family and I am using a USB multilink universal debugger to communicate. I am trying to receive messages from my processor to a tilt sensor (MMA8653FCR1). When I step into the code of the receive block (EI2C1_RecvBlock) it looks like the data is never received.  

164719_164719.pngpastedImage_1.png

As per the code above, the value of acknowledge is always set to '1' which I assume means that the tilt sensor has received the data request. Below is a screenshot of the configuration -

164783_164783.pngpastedImage_2.png

 

Is there some sort of basic mistake that I am committing ? Also am I supposed to see pulses in the IICSCL or IICSDA lines when I transmit data (using EI2C1_SendBlock) ?

 

Once again I would deeply appreciate it if someone could provide some insight.

 

Sincerely,

Mahendra

Labels (1)
Tags (3)
0 Kudos
3 Replies

432 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mahendra,

First i recommend you use one Scope to check the send signal and

receive signal on IICSCL and IICSDA lines .

If the signal is right , then you can   refer to the Typical usage : right click

the component , then select "help on component" :

pastedImage_1.png

Hope it helps

Alice

0 Kudos

432 Views
jmu
Contributor I

Hi Alice,

Thank you for your quick response. I connected the IICSDA and IICSCL lines to a scope. The IICSDA line is being pulled upto 4.5 volts and IICSCL line stays at 0 volts. I am not seeing a pulse in either of the lines. Do you think there is a register I need to set in order to see the clock pulses ? 

I assigned the register IIC0IBCR register to 0xB0 which enables IIC bus module, sets Master mode and sets the transmit bit. Although when I do this the register IIC0IBSR gets set to 0xA4.

pastedImage_1.png

Do you think this could be one of the problems ? 

Below is a snippet of the part of the code which transmits and receives data - 

pastedImage_2.png

It looks like the main problem is the lack of clock pulses on the IIC0SCL line. Do let me know your thoughts.

Once again deeply appreciate your insight.

Sincerely,

Mahendra

0 Kudos

432 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mahendra,

- Please pay attention that , if you use the processor expert , you needn't configure

the registers for initialize I2C . After configure the I2C component , then the initialize

code can generate :

pastedImage_1.png

-From your detail of the IICSDA and IICSCL signal, i think the I2C have not been start ..

So recommend you first refer the demo i mentioned last time to test .

BR

Alice

0 Kudos