Hi @crist_xu
Thank you for your help. Now I have been able to compile the code.
Instead of giving val a value I have defined it like this:
uint8_t val ;
BOARD_Accel_I2C_Send(SLAVE_ADDR, 0, 0, &val);
This function does:
status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff)
{
uint8_t data = (uint8_t)txBuff;
return BOARD_LPI2C_Send(BOARD_ACCEL_I2C_BASEADDR, deviceAddress, subAddress, subaddressSize, &data, 1);
I have debugged and have seen that the value that data guets is 'S' (0x83 I think)
Then it goes to:
reVal = LPI2C_MasterStart(base, deviceAddress, kLPI2C_Write) and reval gets a value of 0x384 which is a value that gets when the code is testing if the bus is busy.
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base)
{
status_t ret = kStatus_Success;
uint32_t status = LPI2C_MasterGetStatusFlags(base);
if ((0U != (status & (uint32_t)kLPI2C_MasterBusBusyFlag)) && (0U == (status & (uint32_t)kLPI2C_MasterBusyFlag)))
{
ret = kStatus_LPI2C_Busy;
}
return ret;
}
In this function ret gets the value of kStatus_LPI2C_Busy and I don´t understand why.
Regards,
Arantza.