Hello,
my initial problem is solved, but now I see another problem (maybe I missunderstand what a function should do)
I'm using SDK 2.4 for LPC54618.
I2C communication works fine with and without DMA enabled in RTE_device.h
#define RTE_I2C1 1
#define RTE_I2C1_DMA_EN 1
I read data from a I2C-device, and with the CMSIS-Function GetDataCount() I check that I received the requested number of databytes.
This works fine if DMA is disabled. (in interrupt mode)
If DMA is enabled I see that the call of GetDataCount() calls the function I2C_MasterTransferGetCountDMA(), which should return the number of bytes.
I2C-communication is already finished and the variable "handle->state" is idle. This seems to make sense to me.
Problem that I see is that in this case this function returns a count of 0 and an error.
If this implementation is correct,I will not be able to use the function GetDataCount() once the communication is finished.
In the debugger I can look at handle->transferCount, and this shows the correct number of databytes.
status_t I2C_MasterTransferGetCountDMA(I2C_Type *base, i2c_master_dma_handle_t *handle, size_t *count)
{
assert(handle);
if (!count) {
return kStatus_InvalidArgument;
}
/* Catch when there is not an active transfer. */
if (handle->state == kIdleState) {
*count = 0;
return kStatus_NoTransferInProgress;
}
/* There is no necessity to disable interrupts as we read a single integer value */
*count = handle->transferCount;
return kStatus_Success;
}
What is the correct usage of GetDataCount()?
Thank you.