Post Go back to editing

Controlling DAC AD5675r using the STM32's HAL library

Category: Hardware
Product Number: DAC AD5675r
Translation: 
Hello!
I'm a beginner and I'm trying to implement a simple I2C communication with a DAC AD5675R using a STM32h723zg Nucleo board, I want to first
make the first channel of the DAC output a voltage (say 2V). I have connected +VOUT of DC-DC converter TMR 3-1221E to VDD and VLOGIC of AD5675R,
and connected GAIN to VLOGIC for maximum 5V output. After setting up the I2C with the 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, uint 16_t MemAddress, uint16_t Mem AddSize, uint8_t * pData, uint16_t size, uint32_t timeout) According to the A0, A1 pin settings, the slave address of this dac should be 0001100, which is 0xC, right?
But I can't detect any reaction from the dac using the HAL_I2C_Master_Transmit function. When I use a logic analyzer to observe the i2c,
only 0x18+NAK appears at the beginning, and there is no waveform after that. If I use HAL_I2C_Mem_Write function, I am very confused about setting function parameters, I don't know what order slave addr, register addr,
command, data should follow when setting parameters. Can anyone tell me which function I should use if I want to achieve this simple function, and give a simple and complete example? I would be very grateful if you could answer me!
你好!
我是初学者,我正在尝试使用 STM32h723zg Nucleo 板与 DAC AD5675R 实现简单的 I2C 通信,我想首先让 DAC 的第一个通道输出一个电压(比如 2V)。我已将 DC-DC 转换器 TMR 3-1221E 的 +VOUT 连接到 AD5675R 的 VDD 和 VLOGIC,并将 GAIN 连接到 VLOGIC 以实现最大 5V 输出。
使用 CUBEMX 设置 I2C 后,我将电路板的 SDA 和 SCL 以及 GND 连接到 AD5675R 的相应引脚。
我应该使用哪个功能?有HAL_I2C_Master_Transmit(I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint8_t* pData, uint16_t Size, uint32_t Timeout)和HAL_I2C_Mem_Write(I2C_HandleTypeDef * hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t Mem AddSize、uint8_t * pData、uint16_t 大小、uint32_t 超时)
根据A0,A1引脚设置,这个dac的slave地址应该是0001100,即0xC吧?但是我无法使用HAL_I2C_Master_Transmit函数检测到dac的任何反应。当我使用逻辑分析仪观察i2c时,一开始只出现0x18 + NAK,之后没有波形。
如果我使用HAL_I2C_Mem_Write函数,我对设置函数参数很困惑,我不知道设置参数时slave addr、register addr、command、data应该按照什么顺序。
谁能告诉我如果要实现这个简单的功能应该使用哪个功能,并给出一个简单完整的例子?
如果你能回答我,我将不胜感激!

Edit Notes

Translated
[edited by: GenevaCooper at 12:25 AM (GMT -4) on 24 May 2023]