Hello,
the OMAP Iam using is interconnected via an SPI connection to another processor. I want to exchange data between this cpu and the OMAP. The CPU acts as a master and the OMAP as slave. If the CPU wants to receive data from the OMAP it pulls up a GPIO and the ISR is invoked at the OMAP site. This ISR then posts a semaphore. The semaphore is pended in the "writer task". The writer task then signals the CPU via another GPIO that it is ready to write data and outputs the data to the SPI bus, using Stream_write. Basically my code will look something like this:
static Void GpioInputIsr(Ptr ignore)
{
Gpio_PinCmdArg pinCmdArg;
/* debug GPIO is resetted here */
ignore = ignore;
pinCmdArg.pin = GPIO_PIN_TO_DRIVER_NUMBER(6, 14);
Gpio_clearInterruptStatus(gpio0, &pinCmdArg, NULL);
Semaphore_post(tx_event);
/* debug GPIO is set here */
}
Void HOST_TaskRawDataTransmitter(UArg a, UArg b)
{
while (1)
{
Gpio_PinCmdArg pinCmdArg;
Semaphore_pend(tx_event, BIOS_WAIT_FOREVER);
/* debug GPIO is toggled here */
/* signal CPU that we are now ready to write */
pinCmdArg.pin = GPIO_PIN_TO_DRIVER_NUMBER(2, 12);
pinCmdArg.value = 0;
Gpio_setPinVal(gpio0, &pinCmdArg, NULL);
Stream_write(spiHandle, out_buffer, out_len, BIOS_WAIT_FOREVER, NULL);
pinCmdArg.pin = GPIO_PIN_TO_DRIVER_NUMBER(2, 12);
pinCmdArg.value = 1;
Gpio_setPinVal(gpio0, &pinCmdArg, NULL);
}
}
All in all the whole transfer lasts around 3.2 ms (1024 bytes of data will be transfered).
For debug reasons I've resetted a debug gpio when the ISR starts and setted it when its finished, furthermore another debug GPIO is toggled right after the Semaphore_pend call in the task. Now the problem is that this task activation lasts too long. (See the picture, the delay is between the two bars.) The strange thing is that this period of time is nearly as long as one SPI transfer. Also the long task activation delay seems only be the case if the Stream_write function call is active. If its commented out and the task only pends on the semaphore, the task activation delay seems to be around 2 us (I would expect this)....
Iam using bios_6_32_05_54, ipc_1_23_05_40 and pspdrivers_02_10_01 on an OMAP-L138.
Any help on this issue would be very appreciated. If you need more information or explanation please let me know.
Kind Regards,
Steve