Hi
Have you taken a look at the I2C eeprom read example within the RTOS PDK? You can find it at <PDK_PATH>/packages/ti/drv/i2c/test/eeprom_read/src/main_test.c
I believe you have the main steps other than enabling interrupt and selecting the intNum. Ensure to call Board_init() as done in the example to set up pinmux, clocking, and UART stdio.
TRANSLATE with x
English
Arabic
Hebrew
Polish
Bulgarian
Hindi
Portuguese
Catalan
Hmong Daw
Romanian
Chinese Simplified
Hungarian
Russian
Chinese Traditional
Indonesian
Slovak
Czech
Italian
Slovenian
Danish
Japanese
Spanish
Dutch
Klingon
Swedish
English
Korean
Thai
Estonian
Latvian
Turkish
Finnish
Lithuanian
Ukrainian
French
Malay
Urdu
German
Maltese
Vietnamese
Greek
Norwegian
Welsh
Haitian Creole
Persian
TRANSLATE with
COPY THE URL BELOW
Back
EMBED THE SNIPPET BELOW IN YOUR SITE
Enable collaborative features and customize widget: Bing Webmaster Portal
Back
Hi,I write code based on the sample.
The currently used TDA4 j721E. We used WKUP_I2C0, MCU_I2C0, and Main_I2C2 in Mcu1_0. Using the same code method in mcu1_0, both WKUP_I2C0 and MCU_I2C0 can successfully communicate with external devices. Main_i2C2 and peripheral communication failed.
The following is the code for operating main_i2c2 in mcu1_0. Please help check if there is any problem.
#define CSL_I2C2_CFG_BASE (0x2020000UL)
#define I2C2_INSTANCE 3
#define CSLR_R5FSS0_INTROUTER0_IN_I2C2_POINTRPEND_0 (183U)
I2C_Params Commoni2cParams;
static void setConfigI2C(uint8_t instance, uint32_t baseAddr){ I2C_HwAttrs i2cCfg;
I2C_socGetInitCfg(instance, &i2cCfg); i2cCfg.baseAddr = baseAddr; i2cCfg.enableIntr = 0U; if(I2C2_INSTANCE == instance) { i2cCfg.intNum = CSLR_R5FSS0_INTROUTER0_IN_I2C2_POINTRPEND_0; } I2C_socSetInitCfg(instance, &i2cCfg);}
void All_I2C_Init_Process(){ Board_initCfg boardCfg; boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK | BOARD_INIT_UART_STDIO | BOARD_INIT_UNLOCK_MMR; (void)Board_init(boardCfg);
I2C_init(); setConfigI2C(I2C2_INSTANCE,CSL_I2C2_CFG_BASE);
I2C_Params_init(&Commoni2cParams);
Commoni2cParams.transferMode = I2C_MODE_BLOCKING; Commoni2cParams.bitRate = I2C_400kHz; Commoni2cParams.transferCallbackFxn = NULL;}
void I2c_Transmit_Test(uint32_t slaveAddr,uint8_t *writeData, uint32_t numWriteBytes,uint8_t *readData, uint32_t numReadBytes){ uint8_t retval = 0; int8_t status = 0U; I2C_Transaction i2cTransaction; I2C_Handle i2cHandle = NULL;
i2cHandle = I2C_open(I2C2_INSTANCE, &Commoni2cParams);
if(NULL == i2cHandle) { retval = 1; } else { I2C_transactionInit(&i2cTransaction); i2cTransaction.slaveAddress = slaveAddr; i2cTransaction.writeBuf = (uint8_t *)&writeData[0]; i2cTransaction.writeCount = numWriteBytes; i2cTransaction.readBuf = (uint8_t *)&readData[0]; i2cTransaction.readCount = numReadBytes; status = I2C_transfer(i2cHandle, &i2cTransaction);
if(I2C_STS_SUCCESS != status) { retval = 2; }
I2C_close(i2cHandle); }
The order of function calls is All_I2C_Init_Process(),I2c_Transmit_Test(xx).
when call function I2C_transfer,Discovered function I2C_v1_waitForPin()entering a dead loop. Reg I2C_IRQSTATUS_RAW value is 0.
function I2C_v1_waitForPin():
status = I2CMasterIntRawStatus(hwAttrs->baseAddr); while ((uint32_t) 0U == (status & flag)) {
}
In summary, please help confirm whether the Main domain I2c can be used in mcu1_0. If can use,please help to investigate the reasons why it is not working well.
Thank you
Hi,
Can you confirm if you would like to configure I2C with interrupts or polling? I see you have selected the correct intNum on the R5 INTRTR, however, you are disabling the enableIntr in the I2C cfg.
Is this a TI EVM or custom board? Can you confirm you have the correct device address and register address you would like to read?
Thanks,
Links
TRANSLATE with x
English
Arabic
Hebrew
Polish
Bulgarian
Hindi
Portuguese
Catalan
Hmong Daw
Romanian
Chinese Simplified
Hungarian
Russian
Chinese Traditional
Indonesian
Slovak
Czech
Italian
Slovenian
Danish
Japanese
Spanish
Dutch
Klingon
Swedish
English
Korean
Thai
Estonian
Latvian
Turkish
Finnish
Lithuanian
Ukrainian
French
Malay
Urdu
German
Maltese
Vietnamese
Greek
Norwegian
Welsh
Haitian Creole
Persian
TRANSLATE with
COPY THE URL BELOW
Back
EMBED THE SNIPPET BELOW IN YOUR SITE
Enable collaborative features and customize widget: Bing Webmaster Portal
Back