Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raspberrypi: Don't block DMA_IRQ_1 during common_hal_mcu_disable_interrupts #10049

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jepler
Copy link
Member

@jepler jepler commented Feb 10, 2025

doing so causes the picodvi display on rp2350 to blank, because this irq is handed by cpu0.

Instead, use the BASEPRI register so that common_hal_mcu_disable_interrupts masks interrupts with lower priority (higher priority values) than PICO_ELEVATED_IRQ_PRIORITY. This has the effect of masking "regular" interrupts while still letting this priority interrupt occur.

port_idle_until_interrupt now needs to directly manipulate the interrupt enable state, because an interrupt masked via BASEPRI also does not cause the WFI instruction to complete. Since I don't know that nesting_count==0 is a precondition of port_idle_until_interrupt, also set and restore BASEPRI before WFI.

Testing performed: display on metro rp2350 doesn't blank while writing to flash. neopixel status LED still works, though that's not a comprehensive test that DMA is still working properly.

Closes #10031

@jepler jepler requested a review from tannewt February 10, 2025 20:40
@RetiredWizard
Copy link

I tested this artifact on a Solderparty rp2350 stamp xl and it did eliminate the screen going black during writes to flash.

ports/raspberrypi/common-hal/microcontroller/__init__.c Outdated Show resolved Hide resolved
ports/raspberrypi/supervisor/port.c Outdated Show resolved Hide resolved
@jepler
Copy link
Member Author

jepler commented Feb 11, 2025

Updated, hopefully it's green now.

@jepler
Copy link
Member Author

jepler commented Feb 11, 2025

welp 🤣

@jepler
Copy link
Member Author

jepler commented Feb 12, 2025

I put back the old code for2040s with Cortex M0, and without BASEPRI. At this point, if it doesn't interfere with review, I'd prefer to rebase it so that the git blame of the file isn't deceptive, showing that the rp2040 implementation of the routine was invented in this PR.

@jepler jepler requested a review from tannewt February 12, 2025 14:59
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Go ahead and rebase.

…rrupts

doing so causes the picodvi display on rp2350 to blank, because this
irq is handed by cpu0.

Instead, use the BASEPRI register so that common_hal_mcu_disable_interrupts
masks interrupts with lower priority (higher priority values) than
PICO_ELEVATED_IRQ_PRIORITY. This has the effect of masking "regular"
interrupts while still letting this priority interrupt occur.

port_idle_until_interrupt now needs to directly manipulate the interrupt
enable state, because an interrupt masked via BASEPRI also does not
cause the WFI instruction to complete. Since I don't know that
`nesting_count==0` is a precondition of `port_idle_until_interrupt`,
also set and restore BASEPRI before WFI.

Because RP2040 is Cortex M0+ lacking BASEPRI, the old implementation
is used there.
@jepler jepler force-pushed the keep-dma-irq-enabled-rp2350 branch from a0e3918 to f331a85 Compare February 12, 2025 20:22
@jepler
Copy link
Member Author

jepler commented Feb 12, 2025

rebased.

@jepler jepler requested a review from tannewt February 12, 2025 20:22
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rp2350: dvi display blanks during flash writes
3 participants