This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ79656-Q1: SEQUENCE OF COMMAND TO SET GPIO AS ADC AND TO READ ADC VALUE OF GPIO1 TO GPIO8 PIN OF BQ IC.

Part Number: BQ79656-Q1

Hi TI Team,

                       Currently i am working on BQ79656-Q1 BMS IC. I read the 16 cell voltage with my host controller from BQ IC. Now i want to use the BQ IC GPIO1 OT GPIO5 pin to read adc value. 5 volt is present at TSREF pin. I configure the below setting:-

uint8_t Tx_Buffer[7]={0x90,0x00,0x03,0x0A,0X01,0XD3,0X7D};//WRITE uart string to ON THE TREFERENCE of BQ IC

Wake79616();
mSDelay(12*TOTALBOARDS); //wake tone duration is ~1.6ms per board + 10ms per board for each device to wake up from shutdown = 11.6ms per 616 board (rounded to 12ms since variable used is an integer)
Wake79616();
mSDelay(12*TOTALBOARDS); //wake tone duration is ~1.6ms per board + 10ms per board for each device to wake up from shutdown = 11.6ms per 616 board (rounded to 12ms since variable used is an integer)

AutoAddress();//ADDRESS IS ASSIGN TO BQ IC.IF 1 IC THEN ASSIGN ADDRESS=5.
uSDelay(4000); //4ms total required after shutdown to wake transition for AFE settling time, this is for top device only
WriteReg(0, FAULT_MSK2, 0x40, 1, FRMWRT_ALL_W); //MASK CUST_CRC SO CONFIG CHANGES DON'T FLAG A FAULT//broadcast WRITE
ResetAllFaults(0, FRMWRT_ALL_W); //CLEAR ALL FAULTS//broadcast WRITE

R_UART1_Send(Tx_Buffer,7);//WRITE uart string to ON THE TREFERENCE of BQ IC
mSDelay(2);//necessary 1.35ms delay before sending another command to enable TREFERENCE of BQ IC

WriteReg(0, ACTIVE_CELL, 0x0A, 1, FRMWRT_ALL_W); //set all cells to active
WriteReg(0, ADC_CONF1, 0x02, 1, FRMWRT_ALL_W); //26Hz LPF_Vcell (38ms average)
WriteReg(0, ADC_CTRL1, 0x06, 1, FRMWRT_ALL_W); //continuous run, LPF enabled and MAIN_GO
uSDelay(38000+5*TOTALBOARDS); //initial delay to allow LPF to average for 38ms (26Hz LPF setting used)
WriteReg(0, GPIO_CONF1, 0x02, 1, FRMWRT_ALL_W);//GPIO1 AS ADC FOR READ NTC TEMPERATURE
WriteReg(0, ADC_CTRL3, 0x06, 1, FRMWRT_ALL_W); //ADC continuous run

But i am unable to read the GPIO1 ADC value by sending the command as mentioned below:-

while(1)

{

  //wait single round robin cycle time + reclocking delay for each device, every loop
uSDelay(192+5*TOTALBOARDS);

//READ THE NTC TEMPERATURE(GPIO1)
ReadReg(0, /*AUX_GPIO_HI*/GPIO1_HI, response_frame3, 1*2, 1000, FRMWRT_SGL_R);
//format and print the resultant response frame
//convert the two individual bytes of into a single 16 bit data item (by bit shifting)
ADCDataFromBQ1 = (response_frame3[4] << 8) | response_frame3[5];

mSDelay(100);

uint8_t Tx_Buffer[7]={0x90,0x00,0x03,0x0A,0X01,0XD3,0X7D};//WRITE uart string to ON THE TREFERENCE of BQ IC

Wake79616();
mSDelay(12*TOTALBOARDS); //wake tone duration is ~1.6ms per board + 10ms per board for each device to wake up from shutdown = 11.6ms per 616 board (rounded to 12ms since variable used is an integer)
Wake79616();
mSDelay(12*TOTALBOARDS); //wake tone duration is ~1.6ms per board + 10ms per board for each device to wake up from shutdown = 11.6ms per 616 board (rounded to 12ms since variable used is an integer)

AutoAddress();//ADDRESS IS ASSIGN TO BQ IC.IF 1 IC THEN ASSIGN ADDRESS=5.
uSDelay(4000); //4ms total required after shutdown to wake transition for AFE settling time, this is for top device only
WriteReg(0, FAULT_MSK2, 0x40, 1, FRMWRT_ALL_W); //MASK CUST_CRC SO CONFIG CHANGES DON'T FLAG A FAULT//broadcast WRITE
ResetAllFaults(0, FRMWRT_ALL_W); //CLEAR ALL FAULTS//broadcast WRITE
R_UART1_Send(Tx_Buffer,7);//WRITE uart string to ON THE TREFERENCE of BQ IC
mSDelay(2);//necessary 1.35ms delay before sending another command to enable TREFERENCE of BQ IC

WriteReg(0, ACTIVE_CELL, 0x0A, 1, FRMWRT_ALL_W); //set all cells to active
WriteReg(0, ADC_CONF1, 0x02, 1, FRMWRT_ALL_W); //26Hz LPF_Vcell (38ms average)
WriteReg(0, ADC_CTRL1, 0x06, 1, FRMWRT_ALL_W); //continuous run, LPF enabled and MAIN_GO
uSDelay(38000+5*TOTALBOARDS); //initial delay to allow LPF to average for 38ms (26Hz LPF setting used)
WriteReg(0, GPIO_CONF1, 0x02, 1, FRMWRT_ALL_W);//GPIO1 AS ADC FOR READ NTC TEMPERATURE

mSDelay(2);

while(1)

{

  //wait single round robin cycle time + reclocking delay for each device, every loop
uSDelay(192+5*TOTALBOARDS);

//READ THE NTC TEMPERATURE(GPIO1)
ReadReg(0, /*AUX_GPIO_HI*/GPIO1_HI, response_frame3, 1*2, 1000, FRMWRT_SGL_R);
//format and print the resultant response frame
//convert the two individual bytes of into a single 16 bit data item (by bit shifting)
ADCDataFromBQ1 = (response_frame3[4] << 8) | response_frame3[5];

mSDelay(100);

}

}

Please help me to resolve this issue.

Thanks with Regards,

DEEPAK

  • Hi Deepak,

    When you say 

    But i am unable to read the GPIO1 ADC value by sending the command as mentioned below:-

    Do you mean you are not able to receive anything? Or are you reading data that looks to be invalid?

    Are you able to share what the low level commands that are being sent are? I'd like to verify that the correct values are being sent. 

    Best Regards,

    Anthony Pham

  • Hi Anthony Pham,

    I am using the BQ79656-Q1 AUTOMOTIVE GRADE BMS IC. I successfully read the 16 cell voltage by this BQ IC.

    when i set the BQ IC register as mentioned below :- 

    WriteReg(0, GPIO_CONF1, 0x06, 1, FRMWRT_ALL_W);//GPIO1 AS ADC FOR READ NTC TEMPERATURE
    WriteReg(0, ADC_CTRL3, 0x0E, 1, FRMWRT_ALL_W); //ADC continuous run

    and after that When i am sending below command 

    ReadReg(0, AUX_GPIO_HI, response_frame3, 16*2, 1000, FRMWRT_SGL_R); 

    then i received ok data at byte no. 5 & 6 which is change by changing the adc value.

    but when i set the BQ IC register as mentioned below :-

    WriteReg(0, GPIO_CONF1, 0x01, 1, FRMWRT_ALL_W);//GPIO1 AS ADC FOR READ NTC TEMPERATURE
    WriteReg(0, ADC_CTRL3, 0x0E, 1, FRMWRT_ALL_W); //ADC continuous run

    and after that when i am sending below command 

    ReadReg(0, GPIO1_HI, response_frame3, 1*2, 1000, FRMWRT_SGL_R);

    then i get 0x80,0x00 at byte no. 5 & 6 which is not change by changing the adc value.

    My main motive is to use the GPIO1 TO GPIO8 pin as ADC pin & get their observed ADC value via uart communication.

    In the above code i mentioned about the GPIO_CONF1,ADC_CTRL3 register setting. Please check that i set the register properly or not.

    If i make a mistake while setting the BQ IC register then let me know. Also share me the proper sequence how to set the BQ IC register to use the BQ IC GPIO1 TO GPIO8 pin as ADC pin & how to read the GPIO1 TO GPIO8 ADC result via uart communication. I shared the code already in previous email.

    Thanks with Regards,

    DEEPAK

  • Hi Deepak,

    WriteReg(0, GPIO_CONF1, 0x01, 1, FRMWRT_ALL_W);//GPIO1 AS ADC FOR READ NTC TEMPERATURE

    This command indicates you are using the GPIO as ADC & OTUT inputs. Are you also running OTUT protection in another command?

    What if you write the following

    WriteReg(0, GPIO_CONF1, 0x02, 1, FRMWRT_ALL_W); //GPIO as ADC input only

    Best Regards,

    Anthony Pham