Hi, I'm trying to read from IIC chips and:
- first, init IIC:
tIICParameters.Channel = OUR_IIC_CHANNEL;
tIICParameters.usSpeed = 100; // 100k
tIICParameters.Rx_tx_sizes.TxQueueSize = 64;
tIICParameters.Rx_tx_sizes.RxQueueSize = 64;
tIICParameters.Task_to_wake = 0; // No wake on transmission
if (InternalIICPortID = fnOpen( TYPE_IIC, FOR_I_O, &tIICParameters )) {
...
- start reading:
static const unsigned char ucReadIICADC[] = {3, MAX1037_ADDR_READ, OWN_TASK};
fnRead(InternalIICPortID, (unsigned char *)&ucReadIICADC, 0);
- wait for data in main loop:
while ( fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH )) { // check input queue
switch ( ucInputMessage[ MSG_SOURCE_TASK ] ) { // switch depending on message
...
}
if (fnMsgs(InternalIICPortID)) {
while ((LengthIIC = fnRead( InternalIICPortID, ucInputMessage, MEDIUM_MESSAGE)) != 0) {
int x = 0;
while (x < LengthIIC) { // display received bytes
fnDebugHex(ucInputMessage[x++], (WITH_LEADIN | WITH_SPACE | 1));
}
fnDebugMsg("\r\n");
}
}
The problem is that task is not woken afrer IIC read. When it wakes up on timer event - IIC data are ready and I can successfully read. However if I disable timer events for this task - it will wait forever...
Did I miss something?