2021-04-29 03:07 AM
I am trying to communicate STM32F072RB with BQ40Z80 (which is connected to the battery) via SMBUS protocol. I am not able to read the data from the battery. According to SMBUS protocol to perform a read operation.
I wrote the following code:
-----------------------------------------------------------------------------------------------------------
uint8_t mydata[1]={0x09} //0x09 is the command code that should be written to read battery voltage
HAL_SMBUS_Transmit_IT(&hsmbus1, 0x16, mydata,1,SMBUS_FIRST_FRAME)
Device address is 0x0B, if I include write bit it is 0x16
---------------------------------------------------------------------------------------------------------------
When I run this code, The oscilloscope shows the device address is detected and the acknowledge from the Bq40z80 but it doesnot show the command code being transmitted. I have attached the image from oscilloscope. I have also attached the screenshot for reading a word from SMBUS specification manual.
Could anyone help me regarding how can I read one of the battery parameter using HAL_SMBUS_Transmit_IT() and HAL_SMBUS_Receive_IT() functions.