hello ,
when i use k144 board i2c with PTA2/A3
void main()
{
#define CONVERT_T 0xCC44
/* Write your code here */
lpi2c_master_state_t lpi2c1MasterState;
CLOCK_DRV_Init(&clockMan1_InitConfig0);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
LPUART_DRV_Init(INST_LPUART_1, &lpUartState1, &lpuart_1_InitConfig0);
LPSPI_DRV_MasterInit(INST_LPSPI_1,&lpspi_1State,&lpspi_1_MasterConfig0);
LPI2C_DRV_MasterInit(INST_LPI2C0, &lpi2c0_MasterConfig0,&lpi2c1MasterState);
while(1)
{
uint8_t cmd[2]={(uint8_t)(CONVERT_T >>8), (uint8_t)(CONVERT_T & 0xFF)};
uint8_t ret = LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C0, cmd, 2, true, OSIF_WAIT_FOREVER);
printf("ret=%d\n\r",ret);
#if 0
uint8_t data[3];
ret = LPI2C_DRV_MasterReceiveDataBlocking(INST_LPI2C0, data, 3, true,OSIF_WAIT_FOREVER);
printf("ret=%d,data[0]=%x,d[1]=%x,d[2]=%x\n\r",ret,data[0],data[1],data[2]);
float iTemp=(uint16_t)data[0]<<8 | data[1];
//printf("iTemp=%.4f\n\r",((float)iTemp/256.0 + 40.0));
#endif
}
//as8579_set_clock();
INT_SYS_InstallHandler(PORTA_IRQn, PORTA_ISR, (isr_t *)0);
INT_SYS_EnableIRQ(PORTA_IRQn);
adc0_init();
}
the device addr is 0x44
when use
uint8_t cmd[2]={(uint8_t)(CONVERT_T >>8), (uint8_t)(CONVERT_T & 0xFF)};
uint8_t ret = LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C0, cmd, 2, true, OSIF_WAIT_FOREVER);
printf("ret=%d\n\r",ret);
i find the waveform like below, it only send the addr 0x44
alice_th_0-1744708826625.png
but if send like this, you can see addr 0x44, 0xcc, 0x44 be send and also other data be send
uint8_t cmd[2]={(uint8_t)(CONVERT_T >>8), (uint8_t)(CONVERT_T & 0xFF)};
uint8_t ret = LPI2C_DRV_MasterSendDataBlocking(INST_LPI2C0, cmd, 3, true, OSIF_WAIT_FOREVER);
printf("ret=%d\n\r",ret);
alice_th_1-1744709008738.pngcan you help to check , what is happend with i2c driver ?
lpi2c_master_user_config_t lpi2c0_MasterConfig0 = {
.slaveAddress = 68U,
.is10bitAddr = false,
.operatingMode = LPI2C_FAST_MODE,
.baudRate = 400000UL,
.transferType = LPI2C_USING_INTERRUPTS,
.dmaChannel = 0U,
.masterCallback = NULL,
.callbackParam = NULL
};
lpi2c_slave_user_config_t lpi2c0_SlaveConfig0 = {
.slaveAddress = 50U,
.is10bitAddr = false,
.operatingMode = LPI2C_STANDARD_MODE,
.slaveListening = true,
.transferType = LPI2C_USING_INTERRUPTS,
.dmaChannel = 0U,
.slaveCallback = NULL,
.callbackParam = NULL
};
{
.base = PORTA,
.pinPortIdx = 2U,
.pullConfig = PORT_INTERNAL_PULL_UP_ENABLED,
.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.passiveFilter = false,
.mux = PORT_MUX_ALT3,
.pinLock = false,
.intConfig = PORT_DMA_INT_DISABLED,
.clearIntFlag = false,
.gpioBase = NULL,
.digitalFilter = false,
},
{
.base = PORTA,
.pinPortIdx = 3U,
.pullConfig = PORT_INTERNAL_PULL_UP_ENABLED,
.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.passiveFilter = false,
.mux = PORT_MUX_ALT3,
.pinLock = false,
.intConfig = PORT_DMA_INT_DISABLED,
.clearIntFlag = false,
.gpioBase = NULL,
.digitalFilter = false,
},