S32K146 IIC+freeRTos return BUSY

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K146 IIC+freeRTos return BUSY

880 Views
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 Kudos
3 Replies

784 Views
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 Kudos

784 Views
gravity_one
Contributor III

hello,Daniel

please review source code, no use  PE component.

Regards,

grayli

0 Kudos

784 Views
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 Kudos