S32K312 - How can I set I2C baud rate?

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

S32K312 - How can I set I2C baud rate?

跳至解决方案
4,028 次查看
ssean
Contributor III

Hello.

How can I set I2C baud rate for S32K312 MCU ?

Source clock from AIPS_SLOW, 30 MHz.

I want to set baud rate to 400 Kbps.

How can I set this config page ?

ssean_0-1703664951411.png

 

Best Regards,

SEAN SUNG

 

 

 

0 项奖励
回复
1 解答
4,003 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Please refer to the Table 424. Timing Parameters of S32K3XXRM. Modify the value of I2c Clock High Period(CLKHI) and I2c Clock Low Period(CLKLO). The I2c Baud Rate will be automatically calculated based on your input value and will be displayed there. But the value you configured now is too small, causing it to exceed the Baud Rate upper limit of LPI2C_FAST_MODE (so it is displayed in red). Please also note: Table 426. LPI2C Timing Parameter Restrictions

Table 424. Timing Parameters Table 426. LPI2C Timing Parameter Restrictions.png


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

5 回复数
4,004 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Please refer to the Table 424. Timing Parameters of S32K3XXRM. Modify the value of I2c Clock High Period(CLKHI) and I2c Clock Low Period(CLKLO). The I2c Baud Rate will be automatically calculated based on your input value and will be displayed there. But the value you configured now is too small, causing it to exceed the Baud Rate upper limit of LPI2C_FAST_MODE (so it is displayed in red). Please also note: Table 426. LPI2C Timing Parameter Restrictions

Table 424. Timing Parameters Table 426. LPI2C Timing Parameter Restrictions.png


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

3,979 次查看
ssean
Contributor III

Dear Robin.

 

Thank you for reply.

I set CLKHI=31, CLKLO=42, FILTSCL=1, PRESCALE=2 (DIV4)

My calculated baud rate is 100000 (100K).

ssean_2-1703832686054.png

But S32DS auto calculated baud rate is 200000(200K).

ssean_3-1703832880536.png

ssean_4-1703832980716.png

 

What is my miss?

Could you check my project(attached), please?

And.. HAPPY NEW YEAR!

 

Best Regards,

SEAN SUNG

0 项奖励
回复
1,085 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi SEAN SUNG,

Sorry, my previous reply was wrong.
I2c Baud Rate is calculated according to the Lpi2c Module Clock Frequency, not according to the Source in Clock Tools.

Lpi2c Module Clock Frequency.png

Since you selected AIPS_PLAT_CLK for McuClockReferencePoint_0, but the MODULE_CLK of LPI2C should be AIPS_SLOW_CLK. This caused S32 Configuration Tool to incorrectly calculate the baud rate of LPI2C using AIPS_SLOW_CLK.

McuClockReferencePoint.png

24.6.1.1.2 LPI2Cn clocking Figure 74. LPI2Cn clocking.png

Sorry, S32 Configuration Tool does not check whether the customer selection complies with Table 117.Communication module clocking in S32K3XXRM.

Table 117. Communication module clocking MODULE_CLK.png

Best Regards,
Robin

0 项奖励
回复
1,072 次查看
ssean
Contributor III

@Robin_Shen 

Thank you for support.

I'll check again according your guide.

 

BRs,

Sean Sung

0 项奖励
回复
3,972 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi SEAN SUNG,

I think it should be 100K. Maybe the S32 Configuration Tool calculated it wrong. It is recommended to test the actual frequency of SCL. And observe the value of PRESCALE during debug.

HAPPY NEW YEAR!


Best Regards,
Robin

 

0 项奖励
回复