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.

BQ27510 Production Code

Other Parts Discussed in Thread: BQ27510

I  have written the firmware to program the BQ27510 from the three page flow chart from Going to Production with the bq2750x.  However, every time I read register 0x66 to see if the data=0x00 I get the data to equal 0x37.  Does anyone have any idea why this might be happening?

I'm thinking maybe it might be the way I am trying to read the register?  When it says read register 0x66 I am assuming it means read data at 0x66?

  • Ok well I figured out I wasn't putting it into ROM mode the right way.  Now, that I have put it into ROM mode everything I try to read now is showing me 0xFF.  Even when I try to just read read the voltage to make sure it is powered it is reading 0xFF!  Someone please help me with this.

    I put it in rom mode with

    i2c_start();

    i2c_write(0xAA);

    i2c_write(0x00);

    i2c_write(0x00);

    i2c_write(0x0F);

    i2c_stop();

  • Lucif,

    I apologize for not posting earlier.  What is happening is the following:

    When you put your device in ROM mode, the I2C slave address changes from 0xAA to 0x16. I believe that you are still sending data to 0xAA.

    Let me know if this helps.

    Cheers,

    Charles

  • Charles,

    Thanks that was actually one of my problems.  I was changing my read and write address to 0x16 instead of 0x16 write and 0x17 for read.  Now I'm getting hung up on checking Register 0x66 to equal 0x00 the third time it is checked.  I am thinking I might be calculating my checksum wrong which could cause me to write the wrong LSB and MSB of Checksum to 0x64 and 0x65.  Which I am assuming could make 0x66 != 0x00???

    Thanks

  • What does register 0x66 equal?  This is an error code and will help figure out what is going wrong.

    The checksum is a byte-wise sum of the data you have written to the registers:

    i.e. if you send:

    command = 0x00

    Data[0] = 0x0C

    Register 0x04 = 0x83

    Register 0x05 = 0xDE

    Therefore, the Checksum is 0x00+0x0C+0x83+0xDE = 0x016D

     

    You write the lower byte into address 0x64:

    Register 0x64 = 6D

    and the higher byte into address 0x65:

    Register 0x65 = 0x01

     

    The command only executes when you write to the checksum MSB (0x65) and the checksum is verified.

    Let me know how it goes,

    Charles

     

  • 0x66 = 0x02.  It has me calculating Checksum=[0x0A+iRow+sum(yRowData)]%0x10000.  I'm pretty sure I have calculated it right.  I am now seeing that sometimes 0x66 is  equaling 0x00 but for the most part it doesnt and starts me back at the beginning of Start Writing Image.  Why does it work sometimes but not others?

  • That means that it is a checksum error. 

    One thing you might check is the following:

    I'm assuming from the data in your second post that you are bitbanging.  With that in mind, check the following:

    1. Is the device ACK'ing to every byte you send?

    2. Does your bitbanging code support clock stretching?  If not, you may be losing part of your message while the gauge clock stretches.

    Thanks,

    Charles

  • No I am not bitbanging I'm using i2c on the PICC and yes it is ACK'ing or it would be hanging giving me no response.  I'm not sure about clock stretching but I'm assuming since it is hardware it does support clock stretching.

  • hmm,

    The reason why I ask is because you read 0xFF from address 0xAA when the device was in ROM mode (on your second post).  Am I not understanding that properly?

    OK, you can rule out a comm error (for whatever reason) by reading back the register values from the bank once you write them.  Make sure that you can read each and every of the values you write. 

    If this isn't the case, can you send me a sequence that causes an error?  I'll run it on my end, and we'll see if we can figure out what's going on.

    Cheers,

    Charles

  • That is correct I was reading 0xFF because i was using address 0xAA but now I am past that and am reading from adress 0x16.

    I'll try reading every value I write to check it on my own and let you know how it goes.

  • ok can i send you the code and let you look at it.