2024-06-11 10:57 AM
Hi I'm trying to establish a communication using I2C with a MCP45HVX1 digital potentiometer device with the stm32g474-re discovery board, I'm using I2C2 module that has been configured with MX with interrupt enabled. I'm using PF0 as SDA and PC4 as SCL. The problem is that the function HAL_I2C_Master_Transmit_DMA(); returns HAL_ERROR firstly because the TXIS flag in the I2C->ISR register is never raised. In the internal registers, I see the BUSY flag being set and peripheral enable bit in the CR1 register raised. What am I doing wrong, it seems like the TXIS flag will never be set no matter what.
Thanks for your time
2024-06-11 05:41 PM
Do you have external pull-ups on the I2C lines?
2024-06-12 06:49 AM
Turns out that was my problem... the external pull-ups on the I2C lines were removed for some reason, putting them back and using a logic analyzer, now the I2C is working almost properly, the thing is I can measure the sending value in the digital potentiometers in debug mode even if I see a data of 0 with the logic analyzer and then the value revert back to 0 no matter the input data I send after quitting the debug mode, my guess is that since I use one I2C master for 4 devices de pull-ups resistors might not be high enough
2024-06-12 07:58 AM
my guess is that since I use one I2C master for 4 devices de pull-ups resistors might not be high enough
You mean low enough? A good rule of thumb is to start with 4.7k Ohms. Use an oscilloscope to view the slew rate to be sure the signal is not slowly rising. Decrease the resistor value if it is a slow slew rate.