This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hi ,
I need to vaidate my I2C connections on board.
GPIO 27 is SCL and GPIO26 is SDA. ( i am usingthis for testing since this is default I2c configuration in project. Board default connections are GPIO8, GPIO10. Need to change code to this later)
I am looking for SCL pin toggling whenever I write to transmit register. Not getting any clock on SCL pin. Please go through the configurations below and suggest what is wrong.
GPIO_setPinConfig(DEVICE_GPIO_CFG_SDAA);
GPIO_setDirectionMode(26,GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SDAA, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SDAA, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCLA);
GPIO_setDirectionMode(27,GPIO_DIR_MODE_IN);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCLA, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCLA, GPIO_QUAL_ASYNC);
void HAL_setupI2CA(HAL_Handle halHandle)
{
HAL_Obj *obj = (HAL_Obj *)halHandle;
// Must put I2C into reset before configuring it
I2C_disableModule(obj->i2cHandle);
// I2C configuration. Use a 400kHz I2CCLK with a 50% duty cycle.
I2C_initMaster(obj->i2cHandle, DEVICE_SYSCLK_FREQ, 400000, I2C_DUTYCYCLE_50);
I2C_setConfig(obj->i2cHandle, I2C_MASTER_SEND_MODE);
I2C_setSlaveAddress(obj->i2cHandle, I2C_SLAVE_ADDRESS);
I2C_disableLoopback(obj->i2cHandle);
I2C_setBitCount(obj->i2cHandle, I2C_BITCOUNT_8);
// 27FEB I2C_setDataCount(obj->i2cHandle, 2);
I2C_setDataCount(obj->i2cHandle, 1);
I2C_setAddressMode(obj->i2cHandle, I2C_ADDR_MODE_7BITS);
// Enable stop condition and register-access-ready interrupts
I2C_enableInterrupt(obj->i2cHandle, I2C_INT_ADDR_SLAVE | I2C_INT_ARB_LOST | I2C_INT_NO_ACK | I2C_INT_STOP_CONDITION);
// FIFO configuration
I2C_enableFIFO(obj->i2cHandle);
I2C_setFIFOInterruptLevel(obj->i2cHandle, I2C_FIFO_TXEMPTY, I2C_FIFO_RX2);
// I2C_clearInterruptStatus(obj->i2cHandle, I2C_INT_RXFF | I2C_INT_TXFF);
I2C_clearInterruptStatus(obj->i2cHandle, I2C_INT_ARB_LOST | I2C_INT_NO_ACK);
// Configuration complete. Enable the module.
I2C_setEmulationMode(obj->i2cHandle, I2C_EMULATION_FREE_RUN);
I2C_enableModule(obj->i2cHandle);
return;
} // end of HAL_setupI2CA() function
in 5 msec loop, writiing 0x55 into tx register
HWREGH(I2CA_BASE + I2C_O_DXR) = 0x55;
Thanks,
Anil