nrf52840: use higher priority for USB-CDC code

This ensures that stdout (println etc) keeps working in interrupts.

Generally you shouldn't print anything in an interrupt. However,
printing things for debugging is very useful and printing panic messages
can be critical when the code doesn't work for some reason.
This commit is contained in:
Ayke van Laethem
2020-09-09 16:34:29 +02:00
committed by Ron Evans
parent e7227df80d
commit f20c932bb9
+5 -2
View File
@@ -87,9 +87,12 @@ func exitCriticalSection() {
// Configure the USB CDC interface. The config is here for compatibility with the UART interface.
func (usbcdc *USBCDC) Configure(config UARTConfig) {
// enable IRQ
// Enable IRQ. Make sure this is higher than the SWI2 interrupt handler so
// that it is possible to print to the console from a BLE interrupt. You
// shouldn't generally do that but it is useful for debugging and panic
// logging.
usbcdc.interrupt = interrupt.New(nrf.IRQ_USBD, USB.handleInterrupt)
usbcdc.interrupt.SetPriority(0xD0)
usbcdc.interrupt.SetPriority(0x40) // interrupt priority 2 (lower number means more important)
usbcdc.interrupt.Enable()
// enable USB