Closed urish closed 3 years ago
Regarding hardware IRQ's, quoting @kilograham's comment from the Bug Squashing live stream on YouTube:
clearPend = ExceptionIN(INTNUM) || InterruptDeassertion; setPend = InterruptAssertion || WriteToRegField(ISPR, INTNUM);
Note that for hardware IRQs the InterruptAssertion is always set until the hardware interrupt source is acknowledged via a write to the hardware specific interrupt register (basically level sensitive interrupts)... thus if the ISR doesn't do this you get another IRQ immediately on return from the ISR. For the write to ISPR case, the setPend only happens once.
Quoting the datasheet:
The Pico SDK is using this feature for the STDIO USB driver.
Our NVIC implementation doesn't clear the pending interrupt flag when executing an interrupt. However, it seems that Pico SDK code expects the NVIC to clear the pending interrupt flag (as the SDK code doesn't take care of clearing the flag). The ARMv6 Datasheet seems to be in agreement with this (section B3.4.1 "NVIC operation"):