2023-05-23 04:53 AM
Hello!
I am a beginner and I am trying to implement a simple I2C communication with the DAC AD5675R using the STM32h723zg Nucleo board, I would like to start by having the first channel of the DAC output a voltage (say 2V). I have connected the +VOUT of the DC-DC converter TMR 3-1221E to the VDD and VLOGIC of the AD5675R, and I have connected GAIN to the VLOGIC to achieve a maximum 5V output.
After setting up I2C using CUBEMX, I connected the board's SDA and SCL and GND to the corresponding pins of the AD5675R.
Which function should I use? There are HAL_I2C_Master_Transmit(I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint8_t* pData, uint16_t Size, uint32_t Timeout) and HAL_I2C_Mem_Write(I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t * pData, uint16_t Size, uint32_t Timeout)
According to the A0,A1 pin setting, the slave address of this dac should be 0001100, i.e. 0xC, right? But I can't detect any reaction from dac using the HAL_I2C_Master_Transmit function.And when I use logic analyzer to observe i2c, only a 0x18+NAK appears at the very beginning and there is no waveform after that.
If I use the HAL_I2C_Mem_Write function, I'm confused about setting function parameters, I don't know what order slave addr, register addr, command, data should be in when setting parameters.
Can anyone tell me exactly which function I should use if I want to implement this simple function, and give a simple and complete example?
If you can answer me, I would be very grateful!