S32K144 EVB LPI2C Example Baud rate not correct

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K144 EVB LPI2C Example Baud rate not correct

ソリューションへジャンプ
3,604件の閲覧回数
18362881285
Contributor II

Hi,I used S32K144 EVB to debug LPI2C(PTA2,PTA3),configured baudrate 100kHz,system clock is ok,but I found on the oscilloscope that its baud rate is only about 90kHz(include my project and the S32DS S32K144 example( S32K1XX RTM SDK V3.0.0 example:lpi2c_master_s32k144))。I changed the LPI2C baud rate 400kHz,or set its operatingMode in LPI2C_FAST_MODE,all of them can not solve problem and baut rate can't same with configured。The S32DS example of LPI2C of s32k144 is wrong?How can I solve it?Whether it effects normal communication?

Hope to help answer me。Thank you!

My board and configured as follow pictures:

捕获.PNG

20200317_161350.jpg

捕获1.PNG

捕获3.PNG

捕获4.PNG

捕获5.PNG

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 解決策
3,483件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi 18362881285@163.com,

Please refer to the RM rev12, Section 50.3.2.4 Timing Parameters.
As you can see, it depends on the latency as well which is given by the bus loading and pull-up resistor sizing.
What pull-up resistors are you using?
Can you try using resistors with lower resistance?

Thanks,
BR, Daniel

元の投稿で解決策を見る

6 返答(返信)
2,064件の閲覧回数
Azezur_Rehman
Contributor III

can any one please provide lpi2c master example code which works for s32k144 evb bord because the example code which is in s32k design ide for arm is not working even in logic analyger not able to see the data which is transforming to slave 

0 件の賞賛
返信
3,484件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi 18362881285@163.com,

Please refer to the RM rev12, Section 50.3.2.4 Timing Parameters.
As you can see, it depends on the latency as well which is given by the bus loading and pull-up resistor sizing.
What pull-up resistors are you using?
Can you try using resistors with lower resistance?

Thanks,
BR, Daniel

3,483件の閲覧回数
18362881285
Contributor II

you are right,Later I use another board to try it,it‘s ok,the external pull-up resistors are 10k,and the EVB no  external pull-up resistors and only configure the internal pull-up。its a important information。 Thank you!

there is a another quesiton,LPI2C read one byte data from a slave chip,my code as follow“”

LPI2C_DRV_MasterSendData(INST_CFG_LPI2C_I2C_MASTER, TxBuffer, 1, 0);
LPI2C_DRV_MasterReceiveData(INST_CFG_LPI2C_I2C_MASTER, RxBuffer, 1, 0)

but when excuted finish the first sentence,the SCL will be always set low,and  bus is busy,so the second sentence can't excuted,and i can‘t received data.I use this function is wrong?the ack and device address is correct

0 件の賞賛
返信
3,483件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi 18362881285@163.com,

Is the write acknowledged by the slave?

Please use the blocking versions of the functions first.

If you want to complete the transfer after reading this one byte, the sendStop parameter of the receive function should be set.

BR, Daniel  

0 件の賞賛
返信
3,483件の閲覧回数
18362881285
Contributor II

yeah,acknowledge comes from slave.I ever used the blocking versions of the functions,but it effected the system clock,my 2.5ms task will be speeded-up,changed to about 1ms,so I have to use senddata(),receivedata() functions.My 2.5ms task  time comes from SysTick MCU_Sys_SysTick_Handler.Do you know why use senddatablocking and receivedatablocking can interrupt the normal task time?Although LPI2C master intettupt effects systick interrupt,it at least slowed down rather than speeded up?

0 件の賞賛
返信
3,483件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi 18362881285@163.com,

With the non-blocking functions, please use the GetTrasferStatus() function, as described in the SDK documentation:

"Blocking operations will return only when the transfer is completed, either successfully or with error. Non-blocking operations will initiate the transfer and return STATUS_SUCCESS, but the module is still busy with the transfer and another transfer can't be initiated until the current transfer is complete. The application can check the status of the current transfer by calling LPI2C_DRV_MasterGetTransferStatus(). If the transfer is completed, the functions will return either STATUS_SUCCESS or an error code, depending on the outcome of the last transfer."

Regards,

Daniel

0 件の賞賛
返信