I2C master not working

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

I2C master not working

311 次查看
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.

标记 (1)
0 项奖励
回复
7 回复数

236 次查看
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 项奖励
回复

233 次查看
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 项奖励
回复

211 次查看
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 项奖励
回复

175 次查看
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 项奖励
回复

137 次查看
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 项奖励
回复

47 次查看
francescovico
Contributor III

Hi Daniel,

It still not working well .

Regards, Francesco.

0 项奖励
回复

41 次查看
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 项奖励
回复