summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2020-07-24 01:28:49 +0700
committerGitHub <[email protected]>2020-07-24 01:28:49 +0700
commit60355720364f66fff7856c3de1d18382f7912e31 (patch)
tree792ac21e71f560e5dc2d2eb109eb4cbed8366acb /examples
parent72c5167fa5a57e57aa1047c7046a3d2354a1b610 (diff)
parent503c15217edad86426db4792364b88b35ec04d31 (diff)
Merge pull request #471 from hathach/call-usbinit-after-kernel-started
call tud_init() after freeRTOS kernel is started
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c5
-rw-r--r--examples/device/hid_composite_freertos/src/main.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index a847f4915..1371b84c3 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -83,7 +83,6 @@ void cdc_task(void* params);
int main(void)
{
board_init();
- tusb_init();
// soft timer for blinky
blinky_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &blinky_tmdef);
@@ -116,6 +115,10 @@ void usb_device_task(void* param)
{
(void) param;
+ // This should be called after scheduler/kernel is started.
+ // Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
+ tusb_init();
+
// RTOS forever loop
while (1)
{
diff --git a/examples/device/hid_composite_freertos/src/main.c b/examples/device/hid_composite_freertos/src/main.c
index 8a8570d60..de065ee64 100644
--- a/examples/device/hid_composite_freertos/src/main.c
+++ b/examples/device/hid_composite_freertos/src/main.c
@@ -79,7 +79,6 @@ void hid_task(void* params);
int main(void)
{
board_init();
- tusb_init();
// soft timer for blinky
blinky_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &blinky_tmdef);
@@ -112,6 +111,10 @@ void usb_device_task(void* param)
{
(void) param;
+ // This should be called after scheduler/kernel is started.
+ // Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
+ tusb_init();
+
// RTOS forever loop
while (1)
{