Not applicable
Jan 29, 2014
10:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 29, 2014
10:37 PM
1) Check "Use RTOS" in USBLD001 UI

2) Change the stack size to 2048 in RTOS001 RTX tab

3) Place "USBVC001_Init()" inside the thread function
4) Add main USB management task "USB_USBTask()" right after the application tasks (eg. USBVC001_SendString((const char *)"Hello World" in the following example)
2) Change the stack size to 2048 in RTOS001 RTX tab
3) Place "USBVC001_Init()" inside the thread function
4) Add main USB management task "USB_USBTask()" right after the application tasks (eg. USBVC001_SendString((const char *)"Hello World" in the following example)
* Thread declaration */
void USB_Thread (void const *Argument);
int main(void)
{
DAVE_Init();
osThreadId ThreadId1;
/* Thread definition */
osThreadDef(USB_Thread, osPriorityNormal, 1, 0);
/* Thread creation */
ThreadId1 = osThreadCreate(osThread(USB_Thread),NULL);
if (ThreadId1 != NULL)
{
/* Start the OS kernel explicitly.*/
osKernelStart();
}
return 0;
}
void USB_Thread(void const *Argument)
{
uint16_t Bytes = 0;
/* Buffer to receive data */
int8_t RxBuffer[10] = { 0 };
USBVC001_Init();
while(1)
{
/* Check if bytes are received */
Bytes = USBVC001_BytesReceived();
if(Bytes)
{
/* Receive the byte */
USBVC001_ReceiveByte(&RxBuffer[0]);
/* Send the receive data back to the host */
USBVC001_SendString((const char *)"Hello World");
}
/* Main USB management task */
USB_USBTask();
...
}
1 Reply
Feb 07, 2014
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 07, 2014
07:25 AM
It seems that in the USB_Thread() - while(1) loop, there shouldn't be RTOS calls like osDelay().
On the other side, USBVC001- send() or Receive() functions should be in this loop, Otherwise I see an unstable behavior. Maybe a Send/Receive (in other thread) crashes with USB_USBTask();
Does anybody has the same findings?
On the other side, USBVC001- send() or Receive() functions should be in this loop, Otherwise I see an unstable behavior. Maybe a Send/Receive (in other thread) crashes with USB_USBTask();
Does anybody has the same findings?