2024-10-22 06:43 AM - edited 2024-10-22 07:05 AM
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.
Solved! Go to Solution.
2024-10-24 11:45 PM
did you try configuring GPIO in OD ?
did you see the ACK on the bus ?
did you use 0x33 as address (before shift) ?
Regards.
2024-10-22 07:02 AM
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.
2024-10-24 09:56 AM
Hello @sandeepBJadhav
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Roger
2024-10-24 11:45 PM
did you try configuring GPIO in OD ?
did you see the ACK on the bus ?
did you use 0x33 as address (before shift) ?
Regards.
2024-10-25 02:12 AM
Thanks for response.
Actually I am not setting pins as open-drain that was the problem.
After setting OD I am getting ACK properly