I've just finished some software for ezdsp stick using BSL. I would rather use CSL, so I've written substitutes for BSL functions, such as AIC3204_rset( Uint16 regnum, Uint16 regval ) and so on. However, I am not sure what to do with things like: SYS_EXBUSSEL |= 0x0020; USBSTK5505_I2C_init( ); etc. My initializing code is based on examples and CSL reference but it doesn't work. I2C_write always returns 0x0001 which is not even proper value of SCL_Status. Maybe someone would tell me, how I2C shold be configured? Here is my code:
CSL_FINST(CSL_SYSCTRL_REGS->EBSR, SYS_EBSR_SP0MODE, MODE2);
hGPIO = GPIO_open(&GpioObj,&status);
config.pinNum = CSL_GPIO_PIN26;
config.direction = CSL_GPIO_DIR_OUTPUT;
config.trigger = CSL_GPIO_TRIG_FALLING_EDGE;
GPIO_configBit (hGPIO, &config);
status = GPIO_write(hGPIO,CSL_GPIO_PIN26,1);
i2cSetup.addrMode = CSL_I2C_ADDR_7BIT;
i2cSetup.bitCount = CSL_I2C_BC_8BITS;
i2cSetup.loopBack = CSL_I2C_LOOPBACK_DISABLE;
i2cSetup.freeMode = CSL_I2C_FREEMODE_DISABLE;
i2cSetup.repeatMode = CSL_I2C_REPEATMODE_DISABLE;
i2cSetup.ownAddr = CSL_I2C_OWN_ADDR;
i2cSetup.sysInputClk = CSL_I2C_SYS_CLK;
i2cSetup.i2cBusFreq = CSL_I2C_BUS_FREQ;
status = I2C_init(CSL_I2C0);
status = I2C_setup(&i2cSetup);
void AIC3204_rset( Uint16 regnum, Uint16 regval )
{
Uint16 startStop = ((CSL_I2C_START) | (CSL_I2C_STOP));
CSL_Status stat;
Uint16 cmd[2];
cmd[0] = regnum & 0x007F; // 7-bit Device Address
cmd[1] = regval; // 8-bit Register Data
stat=I2C_write(cmd, 2 ,0x0018, TRUE, startStop, CSL_I2C_MAX_TIMEOUT);
}