How to change the clock frequency of I2C

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to change the clock frequency of I2C

1,531 次查看
Riyasma07
Contributor III

Hi,

I'm using S32 DS for Platform and RTD version 3.0.0 and I'm working on S32K324 controller.

In the reference manual I saw this example timing configurations table

Riyasma07_0-1703668858677.png

Here three different frequencies such as 8MHz, 48MHz and 60MHz are used.

But how to change the frequency for I2C in the Configurator tool?

Riyasma07_1-1703668994249.png

As it has already 40MHz set I can't be able to change it.

Or else tell me how to set the baud rate 400kbit/s, 100kbit/s and 1Mbit/s with the 40MHz frequency,Riyasma07_0-1703672265592.png

 

Tagging my colleague also in this post for reference, @LavanyaR 

 

标签 (1)
0 项奖励
回复
4 回复数

1,444 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @Riyasma07 and @LavanyaR 

To change the I2C clock frequency the changes to the clock configuration need to be done to the AIPS_PLAT_CLK following the restrictions shown in the attached image.

VaneB_0-1704228894076.png

If you want to set the desired baud rate with the 40MHz frequency, this is calculated as Frequency/(((CLKLO+CLKHI+2)*2^PRESCALER)+ROUNDDOWN((2+FILTSCL)/2^PRESCALER)). This considering that the function Flexio_I2c_Ip_MasterSetBaudRate_Activity sets the baud rate (SCL frequency) for the I2C master. Note that due to module limitations, not any baud rate can be achieved. The driver will set a baud rate as close as possible to the requested baud rate, but there may still be substantial differences.

 

B.R.

VaneB

0 项奖励
回复

1,425 次查看
Riyasma07
Contributor III

Hi @VaneB,

Riyasma07_0-1704274668934.png

I've done that too. I've set clock as 48000000 and Baud rate as 400000 and I've checked the baud rate using the GetBaudRate function and the baud rate was 400000. But the problem is, when using I2c interrupt method we were getting busy status and when using I2c blocking method we were getting timeout error. What would be the problem? 

0 项奖励
回复

1,417 次查看
VaneB
NXP TechSupport
NXP TechSupport

Hi @Riyasma07 

Please help me by clarifying the following. By default, the configurations made in ConfigTools for the I2C driver as a master are made in the struct called "I2c_Lpi2cMasterChannel0_VS_0", but I saw in your code that you use one called "I2c_Lpi2c_CustomConfig". Just to confirm, did you change the functional group name in ConfigTools? 

Also, I saw in the ConfigTools image that you configured the I2C Operating Mode as "LPI2C_STANDARD_MODE", but in the function Lpi2c_Ip_MasterSetBaudRate, the I2C operating mode is LPI2C_FAST_MODE.

0 项奖励
回复

1,465 次查看
Riyasma07
Contributor III

Hi @VaneB,

Any updates??

0 项奖励
回复