edsut opened a new issue, #6531:
URL: https://github.com/apache/incubator-nuttx/issues/6531

   I am working with a Teensy4.1 and had a consistent hardfault whenever I 
connected QGC to Mavlink over USB.  I eventually realized that I did not have 
CONFIG_USBDEV_DUALSPEED enabled, but line 1975 of imxrt_usbdev.c 
(https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/imxrt/imxrt_usbdev.c#L1975)
 was being executed at startup.  The iMXRT1062 (Teensy4.1 SOC) does support 
HIGH speed, so I enabled CONFIG_USBDEV_DUALSPEED and the crash disappeared.
   There should be some coordination between CONFIG_USBDEV_DUALSPEED and the 
link's speed at startup.
   I modified imxrt_wakeup to force FULL speed if CONFIG_USBDEV_DUALSPEED is 
not set, and this allowed my code to avoid the hardfault regardless of the 
setting of CONFIG_USBDEV_DUALSPEED...
   ```
   static int imxrt_wakeup(struct usbdev_s *dev)
   {
     irqstate_t flags;
   
     usbtrace(TRACE_DEVWAKEUP, 0);
   
     flags = enter_critical_section();
   #ifndef CONFIG_USBDEV_DUALSPEED
     imxrt_setbits(USBDEV_PRTSC1_PTC_FS | USBDEV_PRTSC1_FPR, 
IMXRT_USBDEV_PORTSC1);
   #else
     imxrt_setbits(USBDEV_PRTSC1_FPR, IMXRT_USBDEV_PORTSC1);
   #endif
     leave_critical_section(flags);
     return OK;
   }
   
   Any thoughts on this?
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to