Dear YK,
I saw there are a lot of posts about implementing CC2530 with I2C. But I still have some questions.
I use hal_i2c file. Revision: 24108
1) Can I use P0.0 for SDA and P0.1 for SCL?
I checked the datasheet and I can't find it anywhere.
2) Does it correct below initialization? How to make sure P0.0 and P0.1 are set to Peripheral function?
void HalI2CInit( void )
{
if (!s_xmemIsInit) {
s_xmemIsInit = 1;
// Set port pins as inputs
//IO_DIR_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_IN );
//IO_DIR_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_IN );
// Set for Peripheral function
IO_FUNC_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_PER );
IO_FUNC_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_PER );
// Set I/O mode for pull-up/pull-down
//IO_IMODE_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_PUD );
//IO_IMODE_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_PUD );
// Set pins to pull-up
IO_PUD_PORT( OCM_CLK_PORT, IO_PUP );
IO_PUD_PORT( OCM_DATA_PORT, IO_PUP );
}
}
3) I put the file to the following directories. Is it correct?
hal_i2c.h >>>>\Components\hal\include\
hal_i2c.c >>>>\Components\hal\target\CC2530EB\
4) I simply call the function as below. But the address value doesn't pass the function inside hal_i2c.c.
uint8 OPT_txBuf[3] = {0};
HalI2CSend(0x44, OPT_txBuf, 3);
One strange that only address value doesn't pass. I see *buf and len value. What could be wrong?
int8 HalI2CSend(uint8 address, uint8 *buf, uint16 len)
I debug this issue for two days already but I still can't solve it. What could be the problem?
Thanks.
Regards,
Thiha Kyaw