Hello,
I have some problem with my code and I dont know how to go on.
Device: TivaC launchpad + TI RTOS. I have several tasks running on uC and using USB Receive and USB transmit task to communicate with the serial host. I am using semaphores + queues combo for inter thread communication. The starting point of my application is "usbserialdevice" TI RTOS example.
When the serial host - client communication is very often, the uC program hangs in Usb transmit task. The uC can receive additional serial requests, but unable to transmit the answer to the serial host.
Here is a screenshot of ROV:
I assume the problem is in the first row. How should it be possible that count is 2 but there is no pendedTasks?
And here is my Usb Transmit task:
//-------------------------------------------------------------------------- // Task to transmit serial data. // // This task periodically sends data to the USB host once it's connected. void USB_Task_USBTransmit(UArg arg0, UArg arg1) { USB_TransmitQueueElement_t msgobj; USB_TransmitQueueElement_t* msgp; msgp = &msgobj; char replyHeader[MSG_REPLY_HEADER_SIZE]; while (true) { USBCDCD_waitForConnect(BIOS_WAIT_FOREVER); // Block while the device is NOT connected to the USB */ Semaphore_pend(USB_Semaphore_Transmit,BIOS_WAIT_FOREVER); // Wait for incomming data to send to USB HOST msgp = Queue_get(USB_Transmit_Queue); replyHeader[0] = LOWBYTE(msgp->size); replyHeader[1] = HIGHBYTE(msgp->size); USBCDCD_sendData((const unsigned char*)replyHeader,MSG_REPLY_HEADER_SIZE,BIOS_WAIT_FOREVER); // Send reply length as U16 USBCDCD_sendData((const unsigned char*)msgp->data, msgp->size, BIOS_WAIT_FOREVER); // Send reply message } }
In the project I am using
Semaphore_pend(USB_Semaphore_Transmit,BIOS_WAIT_FOREVER); // Wait for incomming data to send to USB HOST
only ones, in this task.