cancel
Showing results for 
Search instead for 
Did you mean: 

Query regarding reading the data from Bq40z80 (connected to battery) using STM32F072RB.

Shubham1
Associate

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.

  1. Master (STM32) must transmit the target device address + Write bit and the command code to write the command code to BQ40Z80(target/ slave device) .
  2. Transmit device address + Read bit to indicate master (STM32) wants to read the data
  3. The slave device then returns the data to Master

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.

0693W00000AMrvJQAT.png 

0 REPLIES 0