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.

BQ76930: Coulomb Counting "One shot" question

Part Number: BQ76930

I would like to use the coulomb counting to act as a simple current measurement, i.e. knowing that 250ms worth of coulombs have been counted I can just multiply by 4 to get a current indication.

If I set the CC_ONESHOT bit, does the coulomb counter reset to zero each time the CC_READY flag is cleared?

(Or do I need to subtract the old coulomb reading from the new?)

Thanks,

Mike

  • Hi Mike,
    The coulomb counter is an integrating converter rather than a sampling converter, so its value represents the current passed in that unit of time. You won't know if the result is from a continuous value or a low value with one or more peaks, so it may be typical to just use the value as the current rather than trying to calculate out the time.
    Each one-shot value is a reading, so subtracting is not desired. If you had a continuous 1A current, the reading should correspond to the 1A level through the sense resistor. Another reading later of the same current should show the same 1A value, you would not want to subtract it.
    To count coulombs you would want to run the CC continuously, sum the values and account for the time units.
  • Thank you, I thought that's how it works.

    I like the idea of just using the CC register value as current, I can calibrate readings to a known current and just leave it at that.

    Thanks again.

  • I'm struggling to get the "one shot" function to work.

    My code does this:

    Initialise SYS_CTRL1 to 0x18 [set ADC_EN, set TEMP_SEL]
    Initialise SYS_CTRL2 to 0x20 [set CC_ONESHOT, clear CC_EN]
    Read SYS_STAT [to obtain CC_READY bit]

    if (CC_READY)
    {

    read CC_HI and CC_LO in one read.
    write 0x80 to SYS_STAT to clear CC_READY
    write 0x2n to SYS_CTRL2 to set CC_ONESHOT (n=current state of CHG&DSG bits)

    }

    The issue I have is that CC_READY is never being set, so I read no currents.

    The datasheet implies that, after setting CC_ONESHOT then 250ms CC_READY will automatically be set, but I never see it set.

    Any ideas?

    Thanks in advance....

  • Hi Mike,
    The one-shot function implies you want a single reading, so the CC_Ready should be cleared from the prior read before setting CC_ONESHOT. This is probably done or you would see it when you checked.
    The Oneshot reading takes a 250 ms acquisition time, and from a casual read of the data sheet it may seem you could wait 250ms see the status bit and value, however the scheduler in the part is on a fixed timeline, so the CC_ONESHOT bit write must be synchronized to the internal 250 ms timeline. If the write just preceeds the schedule start the CC_READY should go high at 250ms, if the write just missed the interval the CC_READY will not go high for 500 ms. CC_ONESHOT should also be cleared when the conversion is complete.
    ALERT should go high with CC_READY, you might look at the hardware signals with a scope if needed for an indication of what is happening.
  • Thank you for your reply,

    I should say that my "if (CC_READY) { }" test is in a 250ms loop. I expect up to 500ms delay or so, but I never see anything, ever.

    I've looked at the ALERT pin, and it never goes high either. I guess that's telling me something.... 

    The CC_ONESHOT bit does clear though, so there must be a bug in my code somewhere. I'll keep digging.

    Thanks for your comments - it helps to know how it *should* work!

    Mike

  • Hi Mike,
    You might look for an unexpected write to SYS_CTRL2 that clears the CC_ONESHOT before the process completes. The part would then abort the acquisition never setting CC_READY or ALERT. Everyone has their own debug techniques of course, but a scope or bus analyzer on the comm signals may show something unexpected. A logic failure is not expected, a power loss might do that but should show on other bits and would likely affect your MCU also.