I2C on KEA128 SCL clock

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

I2C on KEA128 SCL clock

1,586 Views
hanisamara
Contributor III

Hello all, 

i am trying to use the I"C module on the KEA128. I set the baud rate to be ca. 357 kbps but if i measure the SCL line i get something like 312 kbps!! 

my setting: 

Bus frequency: 20 MHz

I2C0_F = 0x11 -> SCL divider=56 and MULT = 1

from datasheet:

I2C baud rate = I2C module clock speed (Hz)/(mul × SCL divider)

so the baud rate = 20Mhz/(1*56) = 357 kbps

 

but the measured SCL gives 312 kbps!!

did i miss anything to set? or is there anything that iam doing wrong? 

thank you in advance

Hani

8 Replies

1,265 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Hani,

PTH2 can be used to output the bus clock, please set the SIM_SOPT0[CLKOE] and check the frequency of bus clock.

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,265 Views
hanisamara
Contributor III

Hi Robin, 

thank you for your reply. 

i checked the Bus frequency and it is 20MHz. I am suing the Bus freq. in other modules like timers and seems to work correctly, so i do not think that the Bus frequency is the problem. 

it is really important to have the correct baud rate, we plan to use the bus on ca. 1 Mio. Controller. 

Best regards, 

Hani

0 Kudos

1,265 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Would you please attached your project here?

So that I can direct test it on my FRDM-KEAZ128 or TRK-KEA128 board.

1,265 Views
hanisamara
Contributor III

Hi Robin, 

did you find anything?

regards, Hani

0 Kudos

1,265 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

During debug, the bus clock on PTH2 is 20MHz and the frequency of I2C is 357 kbps.

But after re-power on, the bus clock will decrease which decrease the frequency of I2C.

Didn't you find the same phenomenon on PTH2?

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,265 Views
hanisamara
Contributor III

Hi Robin, 

we got for our project first electronic samples. And i have the same problem, it is even worst. With a SCL divider of 0x11 (56) i got 294kbs on the SCL line!

i mesured the BUS frequency and its is 20MHz. attached you can find two pictures (I2C0 modul and SIM.SCGC register) that might be help. Do you have any idea? what could be the problem?

Best regards, 

Hani

0 Kudos

1,265 Views
hanisamara
Contributor III

hi Robin, 

i am getting 20MHz Bus frequency and 312kbps I2C in the debug and in normal mode!

regards, Hani

0 Kudos

1,265 Views
hanisamara
Contributor III

may be i can attach the i2c files. The whole project is very difficult, cause i am using Lin bus and others and it could be hard to get it working on your board. May be you can check the init method and the configuration file.

0 Kudos