InteralI2C Bean Test on EVB9S12XEP100

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

InteralI2C Bean Test on EVB9S12XEP100

653 Views
andydna
Contributor I

Hello everybody!

 

I'm testing the InternalI2C bean (for HC12X) using an evaluation board EVB9S12XEP100.

 

Since it is the first experience with I2C protocol, and before to use it to

program a Sharp Tuner, I decided to do some training connecting together

the SDA and SCL lines of the two I2C0 and I2C1 ports (using two 2.2 KOhm

resistors for pull-up to Vdd=+5V the two lines SDA and SCL).

 

At this point, I've created a simple project (see attachement)  integrating

the Processor Expert beans adding two components "I2C0.InternaI2C" and

"I2C1.InternalI2C".

The scope of this SW is simply to send 3 Bytes from I2C0 to I2C1.

 

I set the I2C ports as following:

 

-  I2C0 as MASTER (with Interrupts enabled)

-  I2C1 as SLAVE (with Interrupts enabled)

-  frequency (SCL=400KHz).

 

Therefore:

- The SW is compiled without errors and warning.

- The Events.C callbacks were properly set with the needed flags using the

Tutorial InternalI2C.

- The binary is loaded on the target without errors.

 

######  PROBLEM  #######

 

The "I2C0_SendBlock()" returns ERR_OK and sentBytes = 3,

but the Event "OnTrasmitData" is not called and therefore the SW go in deadlok waiting endless

for the flag "Completed=1U".

It seems the byte transmission not finish correctly for some problem.

 

If I comment all the synchro loops (while{...}) till to arrive to the  "I2C1_ReceiveBlock()"

I get the error id = 10 (no data to receive).

 

I've checked the SCL line by an oscilloscope and the clk is 400KHz.

Unfortunately I don't have a Logic Analyzer at the moment.

 

Could you help me to understand where could be the error?

Thanks a lot in advance.

AndydnA

Original Attachment has been moved to: Project_Andy_IIC.rar

0 Kudos
2 Replies

322 Views
cristianzamfire
NXP Employee
NXP Employee

Hello,

I looked in the project settings and noticed that the Slave address of the I2C1 component is 0, while the master uses target slave address 8 for sending data. This would explain why the communication fails, the slave does not recognize the address. Try setting Slave address property of the I2C1 component to 8.

Best regards,

Cristian

0 Kudos

322 Views
andydna
Contributor I

Dear Cristian,

really thank you for reply and support. Yes you are right about the SLAVE_ID, but there was another problem.

The main problem was the wrong Evaluation Board HW setting to access the available communication ports.

I've checked the MC9S12 pins sharing on my EVB9 and I've seen that the pins PJ6 and PJ7 are shared among IIC0/CAN0/CAN4.

The default board jumper setting use the CAN0 instead of the IIC0. At this point I've disconnetded the board jumpers J420 and J421 and now IIC0 works correctly.

Thank you very much for your interesting,

BR

AndydnA

0 Kudos