I2C master not working

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

I2C master not working

896 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
7 Replies

821 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

818 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

796 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

760 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

722 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

632 Views
francescovico
Contributor III

Hi Daniel,

It still not working well .

Regards, Francesco.

0 Kudos
Reply

626 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

 

0 Kudos
Reply