I2C master not working

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

I2C master not working

206 Views
francescovico
Contributor III

Hello ,

I'm trying to test I2C master on S32K324 but i'ts not working.

Actually I have no I2C slave connected to I2C master but I don't see any transition on PTD13 (LPI2C_SDA) or PTD14 (LPI2C_SCL), the two pins are ever HIGH.

I expect to see start condition like attached file.

Attached there is the project.

Regards, Francesco.

Tags (1)
0 Kudos
Reply
5 Replies

131 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Francesco,

I haven't tested the code, but I see that you did not enable the LPI2C interrupt.

Add IntCtrl_Ip driver with LPI2C0_Master_Slave_IRQHandler.

And initialize the driver in the code.

 

Regards,

Daniel

 

0 Kudos
Reply

128 Views
francescovico
Contributor III

Hello Daniel,

Thank you, it's true I forgot to initialize interrupt.

Also with interrupt enabled the I2C it's not working.

Attached there is the project with interrupt enabled.

Do you have other suggestions?

Regards.

 

0 Kudos
Reply

106 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @francescovico,

When CM7_1 is halted, the MCU enters debug mode.
To ensure LPI2C continues functioning, either set the DBGEN bit in LPI2C_MCR to allow operation during debugging, or Keep CM7_1 running.

 

BR, Daniel

0 Kudos
Reply

70 Views
francescovico
Contributor III

Hello Daniel,

sorry but putting:

IP_LPI2C_0->MCR |= LPI2C_MCR_DBGEN_MASK;

The I2C still not working.

Attached my project.

Regards, Francesco.

0 Kudos
Reply

32 Views
danielmartynek
NXP TechSupport
NXP TechSupport

HI @francescovico,

danielmartynek_0-1756971786422.png

Enable it after the Init function.

Otherwise, the Init function will clear the bit.

 

Regards,

Daniel

Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable law. NXP accepts no liability for any assistance with applications or product design. Materials may only be used in connection with NXP products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.
0 Kudos
Reply