Problem I2C Freertos driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem I2C Freertos driver

跳至解决方案
2,625 次查看
ypkdani
Contributor III

Hello,

i have to transmit the data to a I2C memory. I have init the I2C0 with:

@

I2C_MasterGetDefaultConfig(&i2c0_config);
NVIC_SetPriority(I2C0_IRQn, 6);

error = I2C_RTOS_Init(&i2c0_handle, I2C0, &i2c0_config, CLOCK_GetFreq(I2C0_CLK_SRC));

then i have to write a data so:

data_transfer.slaveAddress = 0x50U;
data_transfer.direction = kI2C_Write;
data_transfer.subaddress = 0;
data_transfer.subaddressSize = 0;
data_transfer.data = data;
data_transfer.dataSize = n;
data_transfer.flags = kI2C_TransferDefaultFlag;

error = I2C_RTOS_Transfer(&i2c0_handle, &data_transfer);

but nothing happen and the device stop with the function

/* Wait for transfer to finish */
xSemaphoreTake(handle->semaphore, portMAX_DELAY);

in the function I2C_RTOS_Transfer. 

Other question is what are the variable ?

data_transfer.subaddress = 0;
data_transfer.subaddressSize = 0;

are the address of the device to point ? 

Thanks

1 解答
2,242 次查看
ypkdani
Contributor III

Solved, it was a my error with the I2C0 instead I2C2

在原帖中查看解决方案

3 回复数
2,242 次查看
Carlos_Mendoza
NXP Employee
NXP Employee


Hi Daniele,

Could you tell us which MCU are you using?

Thanks in advance!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 项奖励
回复
2,242 次查看
ypkdani
Contributor III

yes sorry, K22FX512

0 项奖励
回复
2,243 次查看
ypkdani
Contributor III

Solved, it was a my error with the I2C0 instead I2C2