S32K146 IIC+freeRTos return BUSY

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

S32K146 IIC+freeRTos return BUSY

1,247 次查看
gravity_one
Contributor III


Firstly, the hardware is guaranteed to be normal, because IIC can be used to read the device when there is no RTos to get the device ID.

but,add freeRTos ,read IIC return BUSY.

Please analyse the following project

0 项奖励
回复
3 回复数

1,151 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello grayli.wang@cdskysoft.com,

Can you please monitor the I2C bus with a logic analyzer/oscilloscope?

Have you tested the attached project.

I see that the LPI2C pins are not routed in the project.

pastedImage_2.png

Regards,

Daniel

0 项奖励
回复

1,151 次查看
gravity_one
Contributor III

hello,Daniel

please review source code, no use  PE component.

Regards,

grayli

0 项奖励
回复

1,151 次查看
raresvasile
NXP Employee
NXP Employee

Hi,

I see that the lpi2c state structure is declared in main and is allocated on the stack. When the scheduler is started, the FreeRTOS kernel will reuse the stack allocated to main because it assumes that the application will not return to main.

Hence, the previously allocated state structure will be overwritten.

Declare the state structure static and it will work.

PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
static lpi2c_master_state_t lpi2c1MasterState;
sta=LPI2C_DRV_MasterInit(INST_LPI2C1, &lpi2c1_MasterConfig0, &lpi2c1MasterState);‍‍‍

 

Best regards,

Rares

0 项奖励
回复