From fa8a365ae6a8ef96f5acce936f9566c72ea14084 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 26 May 2026 14:26:36 +0200 Subject: [PATCH] nrf: avoid too high priority interrupt on SoftDevice The highest priority interrupts are reserved by the SoftDevice, the SoftDevice will refuse to start if any of them are used for other purposes. --- src/machine/machine_nrf.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/machine/machine_nrf.go b/src/machine/machine_nrf.go index a7d1eeb08e..3cdb2058a5 100644 --- a/src/machine/machine_nrf.go +++ b/src/machine/machine_nrf.go @@ -145,7 +145,7 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error { // Set and enable the GPIOTE interrupt. It's not a problem if this happens // more than once. - interrupt.New(nrf.IRQ_GPIOTE, func(interrupt.Interrupt) { + intr := interrupt.New(nrf.IRQ_GPIOTE, func(interrupt.Interrupt) { for i := range nrf.GPIOTE.EVENTS_IN { if nrf.GPIOTE.EVENTS_IN[i].Get() != 0 { nrf.GPIOTE.EVENTS_IN[i].Set(0) @@ -153,7 +153,9 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error { pinCallbacks[i](pin) } } - }).Enable() + }) + intr.SetPriority(0x40) // interrupt priority 2 (highest priority not reserved by the SoftDevice) + intr.Enable() // Everything was configured correctly. return nil