2021-12-28 01:10 PM
Hello all, I am new to the STM32 environment. I have a Rasberry pi's I2C lines connected to a NUCLEO-L552ZE-Q on the I2C2 peripheral on pin PF0 and PF1. I have set up the address to 0x50. I have attached a text file showing different instantiations and declarations on my STM32 I2C initialization. But whenever I try to detect the I2C the pi does not detect it. Any advise would be appreciated. Thank you
2021-12-28 01:56 PM
Do you have an external pullup on SDA and SCL? Do you have a logic analyzer or scope to see what is on those lines?
The code you show doesn't actually call any HAL_I2C_Slave_* functions. I don't believe the STM32 will ACK simply after calling HAL_I2C_Init.
2021-12-28 11:21 PM
in the code attached you just have only initiate the i2c peripheral, no transmit functions. need to add functions such as HAL_I2C_Master_Transmit/HAL_I2C_Master_Receive.
2021-12-29 09:43 AM
Hello, Thank you for your time and reply. Here is a screen capture from a logic analyzer.
Sorry I am still confused. I am trying to get an address acknowledge. Shouldn't my initiated interrupt, handle that for me? These 2 lines are my interrupt instantiation.
HAL_NVIC_SetPriority(I2C2_EV_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C2_EV_IRQn);
I am not writing or reading any data. Just doing an address run through.
Once again thank you for your time. Help is much appreciated
2021-12-29 09:47 AM
I also think my SDA line is always low after the data has been sent by the pi. But the SCL comes up. The SDA comes back up only when the reset on the MCU is pressed. Which makes me not confident about the instantiation of I2C in that text file. Please correct me if I am wrong
Thank you
2021-12-30 02:55 PM
Got it resolved. Thanks
2021-12-30 05:33 PM
How did you solve it
2022-01-01 04:05 PM
I solved it based on TDK and Shirley's answers. I just added a line for slave receive. Thank you