2161461_en-US

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

2161461_en-US

2161461_en-US

I2C master not working

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.

Re: I2C master not working

Hi @francescovico,

It does work on my side - I have tested your code.

If it does not work on you side, explain in details what does not work. 

Make sure the DBGEN bit is set at the time the transfer is called.

Have you tested it with CM7_1 running?

Do you use external pull-up resistors?


Regards,

Daniel


Re: I2C master not working

Hi Daniel,

It still not working well .

Regards, Francesco.

Re: I2C master not working

HI @francescovico,

danielmartynek_0-1756971786422.pngdanielmartynek_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.
Re: I2C master not working

Hello Daniel,

sorry but putting:

IP_LPI2C_0->MCR |= LPI2C_MCR_DBGEN_MASK;

The I2C still not working.

Attached my project.

Regards, Francesco.

Re: I2C master not working

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

Re: I2C master not working

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.


Re: I2C master not working

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


Tags (1)
No ratings
Version history
Last update:
‎11-20-2025 01:52 PM
Updated by: