cam_hal: PSRAM: forward-scan last dma node to find JPEG EOI reliably #785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR requires the following PRs to be merged first, and thus contains their commits:
fix jpeg soi check for psram_mode (DMA) #776fix jpeg eoi check for psram_mode (DMA) #777cam_hal: drop caches for psram_mode frames before hand-off to application #778Issue
I've noticed that my previous implementation of the EOI search isn't
optimal, as it will not find the EOI, depending on where the image ends
in the last buffer due to padding.
Description
When
psram_mode
is active,cam_take()
used to copy only 32 bytesfrom PSRAM and scan backward for the JPEG EOI (FF D9). Because DMA
rounds the captured length up to a half-buffer, the true EOI often
falls earlier and was missed, leading to repeated "NO-EOI" resets.
This change:
invalidation.
starting 1 byte before the final block to catch split EOIs.
avoid stale markers from a larger previous frame.
SRAM mode keeps the simple backward check (we only accept EOI at offset
0 there), so no extra complexity or perf work is added.
Net effect: robust EOI detection without garbage tails and fewer
spurious "NO-EOI" resets in PSRAM captures.
Testing
Does fix some crashes, but not everything in
psram_mode
with JPEGs.It will now reliably fetch one frame and then the frame capture stalls somewhere until the watchdog kills it (after 4 seconds) and the device reboots. I'm investigating.
Checklist
Before submitting a Pull Request, please ensure the following: