• AVR Freaks

Hot!I2C design help

Author
gabbla
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2016/05/03 08:54:03
  • Location: 0
  • Status: offline
2019/03/22 16:34:40 (permalink)
0

I2C design help

Hi all,
 
I'm working on a custom board that is equipped with a battery gauge (BQ27441) connected to a PIC32MX274F256D via I2C. The chip has a pretty simple command set to get/set thresholds and battery parameters. I was looking on how to interact with it, using harmony: let's say I want to read the voltage, how would you design an API (SYNCHRONOUS) to do that? I may bring up a callback system, but I don't really like the idea since it is async. I saw the example shipped with the framework, but they seem pretty complex even to achieve simple tasks (ie a series of commands to enter in a specific mode). I tried to open the driver with DRV_IO_INTENT_BLOCKING, but there is no way to get the data sent without a call to DRV_I2C_Tasks().
 
Any source where I can find some tutorials or example?

Thanks,
Gabriele
 
 
#1

3 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17341
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: I2C design help 2019/03/22 16:46:35 (permalink)
    0
    That is SMBus not I2C. That will mean you have use I2C, But you must Conform to the Minimum SMBus Timing.
    Unless you disable that in The BQ27441.  I2C or SMBus you need to complete a Transaction to the Slave device before you can start another. Also the BQ27441 will send warnings and alerts without being prompted. (unless you turn them off). So you must be ready for Multi Mastering.
    #2
    gabbla
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2016/05/03 08:54:03
    • Location: 0
    • Status: offline
    Re: I2C design help 2019/03/22 17:03:21 (permalink)
    0
    NKurzman
    That is SMBus not I2C. That will mean you have use I2C, But you must Conform to the Minimum SMBus Timing.
    Unless you disable that in The BQ27441.  I2C or SMBus you need to complete a Transaction to the Slave device before you can start another. Also the BQ27441 will send warnings and alerts without being prompted. (unless you turn them off). So you must be ready for Multi Mastering.




    HI,
     
    thank you for your reply. Shouldn't the BQ27441 drive GPOUT to signal that something has changed and then the host ask? I can't find any reference of "spontaneous write" performed by the BQ. Same as SMBus, no reference in the TRM.
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 17341
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: I2C design help 2019/03/22 17:09:26 (permalink)
    0
    SMBus allows for an SMBus Batter to send Voltage and Current requests to an SMBus Battery Charger.  And Alert Messages to the Host controller.  The SMBus Battery can send an /Alert signal.  That should all be configurable in the BQ27441 configuration registers.. 
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5