Hi ,
We are using the BQ34Z100EVM with a Stellaris LM3S2965 eval kit ,i have connected SDA,SCL and GND on the bq evm to the corresponding SDA,SCL and GND on the stellaris board ,I want to be able to do the following.
>>Read the standard comands and extended commands with the following code
Eg: TO READ PACK CONFIGURATION
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/debug.h"
#include "driverlib/sysctl.h"
#include "driverlib/i2c.h"
#include "driverlib/gpio.h"
#define SLAVE_ADDRESS 0xAA
void I2Cinit (void);
/*
* main.c
*/
unsigned short Data[2];
void main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_8MHZ);
I2Cinit();
while(1){
I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, SLAVE_ADDRESS , false);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_START);
I2CMasterDataPut(I2C0_MASTER_BASE, 0x3A);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
while(I2CMasterBusBusy(I2C_MASTER_BASE))
{
}
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START);
Data[0] = I2CMasterDataGet(I2C0_MASTER_BASE);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT);
Data[1] = I2CMasterDataGet(I2C0_MASTER_BASE);
I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH);
}
}
void I2Cinit (void){
//Enable the I2C0 & PORT B peripherals
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//Configure PORT B pin 2 & 3 as I2C pins SCL & SDA
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3);
//Set the I2C base 0 master clock at 400Kbps(true)/100Kbps(false) SysCtlClockGet()is same as system clock
I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), true);
}
I'm assuming that the pointer automatically increments hence i use I2C_MASTER_CMD_BURST_RECEIVE_CONT ,but in the watch window Data[0] & [1] are zero always
>>How do the control() and its subcommands work the following post throws some light but still not clear on how to implement this on a stellaris microcontrloller because it shows 3 things the argument ,the data and address
http://e2e.ti.com/support/power_management/battery_management/f/180/t/213060.aspx
and how can i use the yLS and yMS to read the data ,
another question which is unanswered in the post is also creating confusion on the Address of the device on using AA / AB
>>Please could you explain how the blockdata commands are used to read and write the dataflash ,and how does the checksum work is it a longitudinal parity check or some other type of checksum and how is it authenticated by the host and device
>> how should we access the registers and set the settings for the system in the bq
We request you to throw some light on the matter based on how all the above can work with a stellaris micro ASAP ,also if you could post some code examples for each of the above questions.
Regards
Abhay