cancel
Showing results for 
Search instead for 
Did you mean: 

I2C in STM32MP13xx giving continuously NACK after start condition with STPMIC1 in bare-metal environment

sandeepBJadhav
Associate II

Hi,

I am working on STM32MP133FAFx (I2C Master) for I2C communication with STPMIC1 IC (I2C slave) fast mode(400KHz) and HSI clock(64MHz). I2C->TIMINGR = 0x00C0216C

I am trying polling method in bare-metal environment for communication in I2C.

Below is my algorithm for polling

1. Configure HSI clock and Initialize clock for I2C.

2. Configuring GPIO I2C pins (No pull up, no pull down, I2C AF, Medium speed)

3. Disable I2C before configuration with I2C_CR1_PE

4.  Setting I2C->TIMINGR = 0x00C0216C for 400KHz baud

5. Setting 7-bit addressing, enable clock Stretching, clear general call & enable filters

6. Enable I2C and shift slave address by 1 as its 7 bit (SlaveAddress << 1)

7. Setting I2C in I2C_AUTOEND_MODE mode

8. After calling I2C_TransferConfig() function I am getting NACK bit is getting set as in attached picture

 

Please help me how to resolve this issue and provide me the solution.

 

 

 

  

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @sandeepBJadhav 

did you try configuring GPIO in OD ?

did you see the ACK on the bus ?

did you use 0x33 as address (before shift) ?

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
sandeepBJadhav
Associate II

Hi,

I am working on STM32MP133FAFx (I2C Master) for I2C communication with STPMIC1 IC (I2C slave) fast mode(400KHz) and HSI clock(64MHz). I2C->TIMINGR = 0x00C0216C

I am trying polling method for communication in I2C.

Below is my algorithm for polling

1. Configure HSI clock and Initialize clock for I2C.

2. Configuring GPIO I2C pins (No pull up, no pull down, I2C AF, Medium speed)

3. Disable I2C before configuration with I2C_CR1_PE

4. Setting I2C->TIMINGR = 0x00C0216C for 400KHz baud

5. Setting 7-bit addressing, enable clock Stretching, clear general call & enable filters

6. Enable I2C and shift slave address by 1 as its 7 bit (SlaveAddress << 1)

7. Setting I2C in I2C_AUTOEND_MODE mode

8. After calling I2C_TransferConfig() function I am getting NACK bit is getting set as in attached picture

 

Please help me how to resolve this issue and provide me the solution.

Roger SHIVELY
ST Employee

Hello @sandeepBJadhav 

This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

Regards,

Roger

Hi @sandeepBJadhav 

did you try configuring GPIO in OD ?

did you see the ACK on the bus ?

did you use 0x33 as address (before shift) ?

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for response.

Actually I am not setting pins as open-drain that was the problem.

After setting OD I am getting ACK properly