Hi all!, im trying to write to a IO expander with my Q2687 qith the latest OS. The slave adress is 0x3F.
I managed to Init just fine but when i try to write it return a RET PARAM Error.
The expander is the PCF8574A.
Thank u so much for advance!!!
This is my code.
bool I2C_Init(void)// *(Handler)(int))
{
TRACE((1,"[wav_I2C][I2C_Init]:Inside I2C_Init"));
I2C_MyConfig.AddrLength=ADL_BUS_I2C_ADDR_7_BITS;
I2C_MyConfig.ChipAddress=0x3F;
I2C_MyConfig.Clk_Speed=ADL_BUS_I2C_CLK_STD;
I2C_MyConfig.MasterMode=ADL_BUS_I2C_MASTER_MODE;
I2CAnswer=adl_busSubscribe(ADL_BUS_ID_I2C,1,&I2C_MyConfig);
if(I2CAnswer>0)
{
TRACE((1,"adl_busSubscribe OKAS"));
I2C_Write();
}
***********************************************************************
bool I2C_Write(void)
{
TRACE((1,"[wav_I2C][I2C_Write]:Inside I2C_Write"));
pAccessMode.Address=0;
pAccessMode.Opcode=0;
u8 I2C_DataWrite=0x04;
s32 adlbusWriteAnswer=adl_busWrite(I2CAnswer,&pAccessMode,7,&(I2C_DataWrite));
switch(adlbusWriteAnswer)
{
case OK:
TRACE((1,"adl_busWrite OKAS"));
break;
case ERROR://If a error during the operation occurs.
TRACE((1,"adl_busWrite ERROR"));
break;
case ADL_RET_ERR_PARAM: //If one parameter has an incorrect value.
TRACE((1,"adl_busWrite ADL_RET_ERR_PARAM"));
break;
case ADL_RET_ERR_UNKNOWN_HDL: //If the handle is unknown.
TRACE((1,"adl_busWrite ADL_RET_ERR_UNKNOWN_HDL"));
break;
case ADL_RET_ERR_SERVICE_LOCKED: //If the function was called from a low level interrupt handler in synchronous mode (the function is forbidden in this context).
TRACE((1,"adl_busWrite ADL_RET_ERR_SERVICE_LOCKED"));
break;
}
return TRUE;
}