S32K146 IIC+freeRTos return BUSY

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

S32K146 IIC+freeRTos return BUSY

1,249件の閲覧回数
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,153件の閲覧回数
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,153件の閲覧回数
gravity_one
Contributor III

hello,Daniel

please review source code, no use  PE component.

Regards,

grayli

0 件の賞賛
返信

1,153件の閲覧回数
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 件の賞賛
返信