I2C communication with slave device not working

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

I2C communication with slave device not working

跳至解决方案
1,256 次查看
sathishkumar_sunmugavel
Contributor IV

I am currently working on establishing I2C communication between the S32K358 (configured as Master) and an external PLL device (configured as Slave).

I have attached the project, which includes the I2C driver and related configurations. I am using pins PTC6 (SDA) and PTC7 (SCL) for the I2C lines. Although I can measure +5V on both these lines, I do not observe any data activity. This leads me to suspect that the I2C communication is not being initiated correctly.

I referred to an example project while developing the I2C driver, but I may have missed something. Could you please help verify:

  1. The electrical configurations and basic connections required for proper I2C operation?

  2. The clock configuration needed for I2C on the S32K38?

  3. Any potential issues or missing configurations in the current setup?

Your guidance would be greatly appreciated.

Hardware details:
S32K3X8EVB-Q289 Evaluation Board
Slave Device: Cirrus Logic - CS2600 (Fractional-N Clock Synthesizer and Multiplier)

Software details:
SW32K3_S32DS_3.5.8_D2311.zip
SW32K3_S32M27x_RTD_R21-11_4.0.0_D2311_DS_updatesite.zip

Thanks,
Sathish.

标记 (2)
0 项奖励
回复
1 解答
1,061 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @sathishkumar_sunmugavel,

Currently, I am reworking the board to test the I2C communication with 3.3V, but could you test by changing J23 to the 2-3 position, this so the primary voltage supply is at 3.3V?  

The only necessary jumper settings should be J321 to 2-3 position and removing R2060 & R2061. However, I also noticed that PTC6 & PTC7 are connected to the NTS0104PW transceiver (which uses 5V).

I was able to run the I2C_Ip_Example_S32K358 at 3.3v by changing J23

Best regards,
Julián

在原帖中查看解决方案

0 项奖励
回复
6 回复数
1,250 次查看
sathishkumar_sunmugavel
Contributor IV

Additional Observation:

The external PLL slave device operates at 3.3V. Initially, we observed 5V on the I2C lines (PTC6 and PTC7).
Following the hardware modification instructions from the board schematic, we removed resistors R2060, R2061, and R2067 from the NXP evaluation board.

sathishkumar_sunmugavel_0-1749123626786.png

 

After this modification, the voltage on the I2C lines dropped slightly but is still at 4.4V, which is not within the safe operating range for the 3.3V slave device.

Could you please clarify:

  • Why the voltage is still 4.4V even after removing the recommended resistors?

  • What further changes are needed to ensure the I2C lines operate at 3.3V?

0 项奖励
回复
1,193 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @sathishkumar_sunmugavel

I do not see anything necessarily wrong configured in the project. In the S32K3X8-EVB, PTC6 & PTC7 both have pull-up resistors to VDD_IO:

Julin_AragnM_0-1749250857141.png

 

VDD_IO is, by default, connected to VDD_HV_A. Could you confirm if J321 is in position 2-3?

Julin_AragnM_1-1749250913696.png

I do not have with me an oscilloscope to test the project you've shared but give me some time and I will test the I2C communication in the S32K3X8-EVB.

Best regards,
Julián

 

0 项奖励
回复
1,115 次查看
sathishkumar_sunmugavel
Contributor IV

Hi @Julián_AragónM 

Thank you for your response.

Currently, jumper J321 is set to 2-3, but I have also tried setting it to 1-2. In both cases, the SDA and SCL lines are measuring 4.4V, which is higher than expected. Since our I2C slave device operates at 3.3V, we need the SDA and SCL lines to be at 3.3V as well.

Could you please clarify the proper jumper settings or hardware modifications required to ensure the I2C lines operate at 3.3V?

Additional Information:

  • Clock Configuration:
    FXOSC (16 MHz) -> PLL (960 MHz) -> POSTDIV (480 MHz) -> PHI0 (160 MHz) -> PLL PHI0 (160) -> AIPS_SLOW_CLK (40 MHz) -> LPI2C1_CLK (40 MHz)

  • The SDA and SCL lines are connected to a Beagle I2C/SPI Protocol Analyzer, but no communication activity is observed.

  • I am using the LPI2C1 instance, not LPI2C0.

Your help in resolving both the voltage level issue and the communication problem would be greatly appreciated.

Best regards,
Sathish

0 项奖励
回复
1,062 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @sathishkumar_sunmugavel,

Currently, I am reworking the board to test the I2C communication with 3.3V, but could you test by changing J23 to the 2-3 position, this so the primary voltage supply is at 3.3V?  

The only necessary jumper settings should be J321 to 2-3 position and removing R2060 & R2061. However, I also noticed that PTC6 & PTC7 are connected to the NTS0104PW transceiver (which uses 5V).

I was able to run the I2C_Ip_Example_S32K358 at 3.3v by changing J23

Best regards,
Julián

0 项奖励
回复
1,041 次查看
sathishkumar_sunmugavel
Contributor IV

Hi @Julián_AragónM 

After changing the J23 jumper position to 2-3, I now see 3.3V on the SDA and SCL lines, and I’m able to transmit data successfully.

I’m planning to add a timeout mechanism to avoid using indefinite while(1) loops. It seems that the SysTick counter could be useful for this purpose. I noticed that some SysTick-related registers (address: 0xE000_E010) are already initialized, but I couldn’t find detailed information about them in the reference manual.

 

sathishkumar_sunmugavel_0-1749641458811.png

 

Could you please confirm if it’s recommended to use the SysTick timer for this purpose? If so, how can I utilize it correctly? Also, is it appropriate to use SysTick instead of dedicated hardware timers in this scenario?

Best regards,
Sathish

0 项奖励
回复
1,013 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @sathishkumar_sunmugavel

Could you please confirm if it’s recommended to use the SysTick timer for this purpose? If so, how can I utilize it correctly?

Yes, using SysTick for timeouts if perfectly fine. If you want to use OsIf, you need to configure it in the BaseNXP component. Please refer to this community post: Solved: Delay function using OSIF - NXP Community.

You can set the timeout method inside the I2C driver component to the OSIF counter system: 

Julin_AragnM_0-1749672982779.png

This timeout is implemented in the Lpi2c_Ip_MasterSendDataBlocking function from the RTD package.

 Also, is it appropriate to use SysTick instead of dedicated hardware timers in this scenario?

This depends on your application. By using a dedicated timer (like PIT), you can save some CPU overhead, however, if this does not have great effect on your project, using the OsIf module can be simpler.

Best regards,
Julián

0 项奖励
回复