2021-08-02 01:13 AM
Greetings,
I am using STM32L431RC MCU, and I'm trying to read the MUX for reading temperatures using I2C 3 interface, by using the Device address of the MUX, Acknowledge from the device and my data as the parameters in the format as specified in the image.
And I'm using the HAL_Master_Transmit function to write the slave, but I'm getting wrong values in my buffer.
The function which I have used is right or I should follow a different function?Kindly Help.
#[STM32 MCUs] #stm32L431RC
Thanks and Regards,
Rohith Sai
2021-08-02 06:35 AM
What chip are you interfacing with?
HAL_Master_Transmit isn't a function.
HAL_I2C_Master_Transmit will write data. HAL_I2C_Master_Receive will read data.
You can also use HAL_I2C_Mem_Read/HAL_I2C_Mem_Write which can be convenient if interfacing with registers on the chip.
Ensure your slave address is left-shifted.
2021-08-03 03:26 AM
Greetings,
I am using ADG728 Mux , but when using HAL_I2C_Mem_Read/HAL_I2C_Mem_Write I should pass the register address as a parameter where in this case I dont have any registers to be read or written, my objective is to write data into the mux by passing S pin as a data,
Kindly Help.
Regards,
Rohith Sai
2021-08-03 07:13 AM
From page 10 of the datasheet, to interface with the chip you should write or read 1 byte. So use HAL_I2C_Master_Transmit and HAL_I2C_Master_Receive.