Other Parts Discussed in Thread: CC2650, LP55231
Tool/software: Code Composer Studio
Hello,
I struggle to get just LED lighted using the TI driver LP55231 (actually the breakout from sparkfun) connected to the Launchpad CC2650 using BLE to send the instruction to light the LED (the LED driver is directly connected to the Launchpad).
The Pins I'm using:
SCL = DI05 (launchpad)
SDA = DI04 (launchpad)
EN = high (3.3v from launchpad)
I've started with Project 0 for Launchpad, it worked ok, then I want to send data using I2C when I light up let's say LED1 over BLE1:
case LS_LED1_ID:
Log_info3("Value Change msg: %s %s: %s",
(IArg)"LED Service",
(IArg)"LED1",
(IArg)pretty_data_holder);
// Locals
uint8_t rxBuffer[32]; // Receive buffer
uint8_t txBuffer[32]; // Transmit buffers
I2C_Handle handle;
I2C_Params params;
I2C_Transaction i2cTrans;
// Configure I2C parameters.
I2C_Params_init(¶ms);
params.transferMode = I2C_MODE_BLOCKING;
params.bitRate = I2C_400kHz;
//params.transferCallbackFxn = transferCallback;
txBuffer[0] = 0x3D; // Reset register
txBuffer[1] = 0xFF; // value Reset
Log_info1("txBuf %x",txBuffer[0]);
// Initialize master I2C transaction structure
i2cTrans.writeCount = 2;
i2cTrans.writeBuf = txBuffer;
i2cTrans.readCount = 0;
i2cTrans.readBuf = NULL;
i2cTrans.slaveAddress = 0x32;
// Open I2C
handle = I2C_open(Board_I2C, ¶ms);
if (handle == NULL ) {
Log_info0("Problem opening I2C");
}
else {
Log_info0("Ok I2C open");
}
// Do I2C transfer (in callback mode)
I2C_transfer(handle, &i2cTrans);
txBuffer[2] = 0x00; // Enable register
txBuffer[3] = 0x40; // LP55231 enabled
I2C_transfer(handle, &i2cTrans);
Task_sleep(5 * (1000/Clock_tickPeriod)); // let's wait 5ms
txBuffer[4] = 0x36;
txBuffer[5] = 0x53;
I2C_transfer(handle, &i2cTrans);
txBuffer[6] = 0x26;
txBuffer[7] = 0x5B;
I2C_transfer(handle, &i2cTrans);
txBuffer[8] = 0x16;
txBuffer[9] = 0x80;
I2C_transfer(handle, &i2cTrans);
Log_info1("after I2C_transfer function %x",(IArg)i2cTrans.writeBuf);
I2C_close(handle);
Log_info0("after I2C_close function");
break;
default:
return;
}
I've tried many things but cannot get anything functioning.
My sequence of data sent is: Reset + Start + D1 current control set + PWM 50%.
Does it seems ok for you? Would you have any idea?
Thanks,
JM