Other Parts Discussed in Thread: OMAPL138
Hello All,
I'm working on the OMAP-L138 custom board in that we're having IIC(EEPROM) in build chip, So my requirement is I want to communicate RTC with the help of I2c, From last couple of weeks, I'm facing an issue with master bus busy in the i2c register (I2C_ICSTR)and got stuck in that register. If multiple masters simultaneously ran only i have to get master bus is busy, in our custom board we're having only one slave that's RTC IIC(EEPROM). I'm getting initial start and stop interrupt also is ready to transmit next data before that its got stuck in ICSTR register. I will attach the log and also attach the i2c write, read and interrupt configuration. please do verify and let me know if any changes are there in the i2c configuration.
ISR Log :-
I2CIsr Entered into ISR...
I2CInterruptVectorGet = 0x 5
I2C_INTCODE_TX_READY = 0x 5
I2CMasterDataPut = 0x1d
Entered I2CISR End = 5
I2C_INTCODE_TX_READY = 0x 5
I2CMasterDataPut = 0x 0
Entered I2CISR End = 6
I2C_INTCODE_STOP = 0x 6
Entered I2CISR End = 0
int I2C_write(unsigned int I2C_BaseAddr, int DataCnt, char *TX_data) { int ind = 0; flag = 1; I2CSetDataCount(I2C_BaseAddr, 2); I2CMasterControl(I2C_BaseAddr, I2C_CFG_MST_TX | I2C_CFG_STOP); I2CMasterIntEnableEx(I2C_BaseAddr, I2C_INT_TRANSMIT_READY | I2C_INT_STOP_CONDITION); for (ind = 0; TX_data[ind]; ind++) { slave_data[ind] = TX_data[ind]; printf("slave_data[ind] = %d \r\n", slave_data[ind]); } slave_data[ind] = '\0'; I2CMasterStart(I2C_BaseAddr); // USTIMER_delay(1000000); while (I2CMasterBusBusy(SOC_I2C_0_REGS) == 0) ; #if 0 while(1) { int intr = (HWREG(I2C_BaseAddr + I2C_ICIVR) & I2C_ICIVR_INTCODE); printf("I2C Int = %x \r\n", intr); } #endif /* Wait till data is transmitt fully */ while (flag) ; return 0; } /***************************************************************************** **@name : I2C_read * **@brief : Read the data from the given slave address. * **@param : I2C_BaseAddr :- I2C Base address of I2c instance * dataCnt :- Data count * **@return : 0 :- on succeed. ****************************************************************************/ int I2C_read(unsigned int I2C_BaseAddr, int DataCnt) { I2CSetDataCount(SOC_I2C_0_REGS, DataCnt); I2CMasterControl(SOC_I2C_0_REGS, I2C_CFG_MST_RX | I2C_CFG_STOP); I2CMasterIntEnableEx(SOC_I2C_0_REGS, I2C_INT_DATA_READY | I2C_INT_STOP_CONDITION); I2CMasterStart(SOC_I2C_0_REGS); #if 0 while(1) { int intr = (HWREG(I2C_BaseAddr + I2C_ICIVR) & I2C_ICIVR_INTCODE); printf("I2C Int = %x \r\n", intr); } #endif /* Wait till data is received fully */ while (flag) ; return 0; } /***************************************************************************** **@name : I2CIsr * **@brief : ISR to handler i2c interrupts * **@param : void * **@return : None ****************************************************************************/ void I2CIsr(void) { unsigned int intCode = 0; printf("\tI2CIsr Entered into ISR... \r\n"); // printf("\tBefore I2CInterruptVectorGet = 0x%2x \r\n", intCode); /* Get interrupt vector code */ intCode = I2CInterruptVectorGet(SOC_I2C_0_REGS); printf("\tI2CInterruptVectorGet = 0x%2x \r\n", intCode); while (intCode != 0) { /* Clear status of interrupt */ #ifdef _TMS320C6X IntEventClear(SYS_INT_I2C0_INT); #else IntSystemStatusClear(SYS_INT_I2CINT0); #endif if (intCode == I2C_INTCODE_TX_READY) { printf("\tI2C_INTCODE_TX_READY = 0x%2x \r\n", intCode); /* Put data to data transmit register of i2c */ I2CMasterDataPut(SOC_I2C_0_REGS, slave_data[tcount++]); printf("\tI2CMasterDataPut = 0x%2x \r\n", slave_data[tcount++]); } #if 1 if (intCode == I2C_INTCODE_RX_READY) { printf("\tI2C_INTCODE_RX_READY = 0x%2x\r\n", intCode); Rx_buffer[rcount++] = I2CMasterDataGet(SOC_I2C_0_REGS); printf("\I2CMasterDataGet = 0x%2x \r\n", Rx_buffer[rcount++]); } #endif if (intCode == I2C_INTCODE_STOP) { printf("\tI2C_INTCODE_STOP = 0x%2x \r\n", intCode); /* Disable transmit data ready register */ I2CMasterIntDisableEx(SOC_I2C_0_REGS, I2C_INT_TRANSMIT_READY | I2C_INT_DATA_READY); flag = 0; } intCode = I2CInterruptVectorGet(SOC_I2C_0_REGS); printf("\tEntered I2CISR End = %x \r\n", intCode); } tcount = 0; rcount = 0; }
Thanks in advance,
Regards,
Seyed