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.

BQ27Z561: what is DC_STATE for bq27z561 IC ?

Part Number: BQ27Z561
Other Parts Discussed in Thread: BQSTUDIO, EV2400

I am using slua801 application note for writing configuration file bq27542G1.bq.fs to bq27z561. but i have seen that this application note given example for  change configuration parameter  based on offset but in bq27z561 TRM, they give address value  0x449F.

[ Q-1 ] how to write golden image file for this address based parameter ?

[ Q-2 ] what is use of below 2 function calls why its necessary  ? is it necessary for bq27z561 configuration file upload ?

gauge_read_data_class    (pHandle, DC_STATE, pData,  DC_STATE_LENGTH);

gauge_write_data_class(pHandle, DC_STATE, pData,  DC_STATE_LENGTH);

[ Q-3 ] to upload golden image file to bq27z561, is it necessary to use above 2 function?

  • The bq27z561 isn't organized with classes and blocks like the bq274xx but instead uses addresses. Therefore there is no DC_STATE for this gauge. 

    If you got this from the slua801 app note, you can use the flash stream parser from that app note, which is compatible with the bq27z561 .bq.fs and .df.fs files. You may have to increase the maximum block size but the format is compatible.

  • CAN YOU TELL ME IN CODE OF SLUA801 WHERE AND WHAT VALUE OF BLOCK SIZE I NEED TO WRITE ?

  • I have uploaded golden image file to bq27z561 using code of slua801a application note  without bqstudio and ev2400 . 

    i want to know if i write below code to upload configuration file to fuel gauge.

    [Q - 1] Is my approach is right to verify golden image file written to my fuel gauge ic successfully ?

    int main(void)
    {
        TI2C i2c;
        void *pHandle = (void*) & i2c;
        int nSourceFile;
        struct stat st;
        long n;
        int nSeconds;
        unsigned int nResult;
        char *pFileBuffer;

        unsigned char pData[DC_STATE_LENGTH];

        printf("gauge test\n\r");
        if((i2c.nI2C= open("/dev/i2c-2", O_RDWR))<0)
        {
            printf("cannotopenI2C bus\n\r");
            exit(1);
        }

        printf("openend I2C bus\n\r");

        gauge_address (pHandle, GAUGE_DEVICE_ADDRESS);

    //    nResult = gauge_control(pHandle, 0x0001);
    //    printf("  FW_VERSION= 0x%04X\n\r", nResult);

        nResult = gauge_cmd_read (pHandle, 0x2c);
        printf("  VOLTAGE = %04d [mV]\n\r", nResult);

        nResult = gauge_control(pHandle, SUB_CMD_CONTROL_STATUS);
        printf("  CONTROL_STATUS= 0x%04X\n\r", nResult);

        stat(SOURCE_FILE,&st);
        printf("source file '%s', size = %d\n\r",  SOURCE_FILE, st.st_size);
        if((nSourceFile= open(SOURCE_FILE,O_RDONLY))<  0)
        {
            printf("cannotopendataclassessourcefile\n\r");
            exit(1);
        }

       pFileBuffer =(char *) malloc(st.st_size);
        if(!pFileBuffer)
        exit(1);
        read(nSourceFile, pFileBuffer, st.st_size) ;
        close(nSourceFile);

       printf("%s",gauge_execute_fs(pHandle, pFileBuffer));

    // above line print nothing so i think configuration file uploaded successfully

        free(pFileBuffer);


        close(i2c.nI2C);
        printf("closedI2C bus\n\r");

    }

    -----------------------------

    [ Q-2 ] is any other way is there to verify my golden image file uploaded successfully  or  not to bq27z561 ?

    [ Q-3 ] Is it neccessary to chage parameter through code because i think flash stream file know design capacity, design energy, terminate voltage and taper current ?

    [ Q-4 ]  If any where i am wrong please let me know ?

    Thanks,

    Ti community.

  • Mangal,

    Unfortunately we cannot parse your code and provide feedback since we do not have the full image, and it is against our legal policy to provide support like this. 

    What I can say is the best way to validate you are uploading the correct image is to open the device in  bqStudio after you perform your update. Then check a few things

    1) The device auto-detects. This will ensure the instruction flash is correct

    2) Compare the datamemeory is updated to the correct settings. This is easily done by comparing the GG file exports

    3) use the checksum commands to make sure they are correct.

    Thanks,

    Eric Vos