8000 rp2350: dvi display blanks during flash writes · Issue #10031 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

rp2350: dvi display blanks during flash writes #10031

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

Closed
jepler opened this issue Feb 6, 2025 · 2 comments · Fixed by #10049
Closed

rp2350: dvi display blanks during flash writes #10031

jepler opened this issue Feb 6, 2025 · 2 comments · Fixed by #10049

Comments

@jepler
Copy link
jepler commented Feb 6, 2025

CircuitPython version and board name

Adafruit CircuitPython 9.2.3-17-gfe23bd7cf8-dirty on 2025-02-04; Adafruit Metro RP2350 with rp2350b

Code/REPL

import board
import picodvi
import displayio
import framebufferio

displayio.release_displays()

fb = picodvi.Framebuffer(320, 240, clk_dp=board.CKP, clk_dn=board.CKN,
                                   red_dp=board.D0P, red_dn=board.D0N,
                                   green_dp=board.D1P, green_dn=board.D1N,
                                   blue_dp=board.D2P, blue_dn=board.D2N,
                                   color_depth=16)
display = framebufferio.FramebufferDisplay(fb)

Behavior

After the code runs, the display is visible. However, copying a file to CIRCUITPY causes the display to blank. It seems the display is not outputting anything at all (not correct sync), because my HDMI to USB video capture dongle shows a test pattern during this time. After the write finishes, the display comes back.

Description

This happens back to 9.2.0, and both on a Feather RP2350 with self-soldered PSRAM and on a Metro RP2350 prototype. Encountered while working on #10028 but is not caused by the method that PR uses to set up the display.

Additional information

No response

@jepler jepler added the bug label Feb 6, 2025
@jepler jepler added this to the 9.x.x milestone Feb 6, 2025
@jepler
Copy link
Author
jepler commented Feb 6, 2025

It looks like picodvi on rp2350 uses an IRQ on core0 to start the frame via irq_set_exclusive_handler(DMA_IRQ_1, dma_irq_handler); in common_hal_picodvi_framebuffer_construct which is running in core0. So, it's expected that flash writing blocks this irq. we'd need to place the irq handler on core1 for this to work. or else not fully block this specific interrupt during flash writes, as it should be safe.

@tannewt
Copy link
Member
tannewt commented Feb 6, 2025

Looks like common_hal_mcu_disable_interrupts guards flash writes:

void port_internal_flash_flush(void) {
if (_cache_lba == NO_CACHE) {
return;
}
// Make sure we don't have an interrupt while we do flash operations.
common_hal_mcu_disable_interrupts();
// and audio DMA must be paused as well
#if CIRCUITPY_AUDIOCORE
uint32_t channel_mask = audio_dma_pause_all();
#endif
supervisor_flash_pre_write();
flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE);
flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE);
supervisor_flash_post_write();
_cache_lba = NO_CACHE;
#if CIRCUITPY_AUDIOCORE
audio_dma_unpause_mask(channel_mask);
#endif
common_hal_mcu_enable_interrupts();
}

We could have it mask by priority and set the DMA interrupt so it is higher. We need to ensure it can run without flash then though.

I don't think running on core1 helps because we're trying to avoid accessing flash by disabling interrupts.

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

Successfully merging a pull request may close this issue.

2 participants
2AB4
0