Not applicable
Feb 28, 2015
03:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Feb 28, 2015
03:17 PM
Hello,
I created a simple project that prints something to a usb serial terminal using USBD_VCOM.
If I put WFI into my main loop, it doesn't work. In fact, the USB device won't even enum.
I've attached a simple demonstration app.
Can anyone reproduce this behaviour or suggest a solution?
Best,
Luke
I created a simple project that prints something to a usb serial terminal using USBD_VCOM.
If I put WFI into my main loop, it doesn't work. In fact, the USB device won't even enum.
#include//Declarations from DAVE3 Code Generation (includes SFR declaration)
int period = 100;
handle_t main_tmr;
//Write to Terminal
void write() {
char buffer[32];
sprintf(buffer, "Blah %d\r\n", period);
USBD_VCOM_SendString(buffer);
}
//Check for receive to make sure connection is established, then start write timer
void tick() {
if (USBD_VCOM_BytesReceived())
{
SYSTM001_StopTimer(main_tmr);
handle_t tmr = SYSTM001_CreateTimer(period, SYSTM001_PERIODIC, write, NULL);
SYSTM001_StartTimer(tmr);
}
}
int main(void)
{
DAVE_Init(); // Initialization of DAVE Apps
USBD_VCOM_Init();
//Start check timer
main_tmr = SYSTM001_CreateTimer(1000, SYSTM001_PERIODIC, tick, NULL);
SYSTM001_StartTimer(main_tmr);
while(1)
{
//Comment in to break USB
//asm("WFI");
}
return 0;
}
I've attached a simple demonstration app.
Can anyone reproduce this behaviour or suggest a solution?
Best,
Luke
- Tags:
- IFX
2 Replies
Not applicable
Mar 03, 2015
01:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 03, 2015
01:09 AM
Hi lerlacher,
In order for the USB VCOM to work, you need to keep running the CDC_Device_USBTask in the background.
So, if you put WFI in the while loop, basically the CPU will go into IDLE mode and all other USB tasks are not running.
This is also why the USB is not enumerated.
In order for the USB VCOM to work, you need to keep running the CDC_Device_USBTask in the background.
So, if you put WFI in the while loop, basically the CPU will go into IDLE mode and all other USB tasks are not running.
This is also why the USB is not enumerated.
Not applicable
Mar 04, 2015
02:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 04, 2015
02:04 PM
How are the USB tasks scheduled? Is there any kind of specification for how often they must be run? Could I do this from a timer interrupt?