Skip to content

Conversation

@RathiSonika
Copy link
Collaborator

@RathiSonika RathiSonika commented Sep 30, 2025

Change description

When I tested NAND flash on the P4, I found that it was failing at the SPI driver level due to an RX length alignment issue. After reviewing esp_driver_spi, I noticed that SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE is enabled for the ESP32-P4, which requires data length alignment in addition to buffer alignment. I’m adding this fix to handle that requirement.
Adjusted the handling logic to ensure proper alignment, restoring correct flash operation.

@RathiSonika RathiSonika force-pushed the fix/nand_flash_not_working_with_esp32p4 branch from c6fe5f6 to fec10df Compare September 30, 2025 08:33
@RathiSonika RathiSonika changed the title fix(spi_nand_flash): fix nand flash issue caused by length unalignment on esp32p4 fix(spi_nand_flash): fix nand flash issue caused by data length unalignment on esp32p4 Sep 30, 2025
@RathiSonika RathiSonika requested a review from igrr September 30, 2025 08:47
@mythbuster5
Copy link
Contributor

spi_nand_program_load what about program direction?

@RathiSonika RathiSonika force-pushed the fix/nand_flash_not_working_with_esp32p4 branch from fec10df to 61fff94 Compare October 20, 2025 12:24
@RathiSonika
Copy link
Collaborator Author

spi_nand_program_load what about program direction?

@mythbuster5 My bad! I hadn’t pushed the latest changes earlier — I’ve done it now. PTAL

@mythbuster5
Copy link
Contributor

LGTM otherwise

@RathiSonika RathiSonika force-pushed the fix/nand_flash_not_working_with_esp32p4 branch from f4e2b91 to 823795a Compare November 10, 2025 16:11
@pacucha42
Copy link
Collaborator

@RathiSonika please, provide more details in description (how did you find out, related issue reports if any, and other context).
Also rebase your branch as suggested by the bot, and remove 'Dratf' once the PR is ready to merge.

So far, the update looks reasonable

@RathiSonika RathiSonika marked this pull request as ready for review November 25, 2025 11:39
@pacucha42
Copy link
Collaborator

Could you also explain how you test the fix? I don't see anything related in your test_app...

@RathiSonika
Copy link
Collaborator Author

Could you also explain how you test the fix? I don't see anything related in your test_app...

If the length is not aligned, the SPI driver will trigger an assertion. This is generally handled by the esp_driver_spi. reference link to check how spi driver handles https://github.com/espressif/esp-idf/blob/master/components/esp_driver_spi/src/gpspi/spi_master.c#L1180

@pacucha42
Copy link
Collaborator

Could you also explain how you test the fix? I don't see anything related in your test_app...

If the length is not aligned, the SPI driver will trigger an assertion. This is generally handled by the esp_driver_spi. reference link to check how spi driver handles https://github.com/espressif/esp-idf/blob/master/components/esp_driver_spi/src/gpspi/spi_master.c#L1180

Ok, understand. Thanks

Copy link
Collaborator

@pacucha42 pacucha42 left a comment

Choose a reason for hiding this comment

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

Fix approved

@pacucha42 pacucha42 merged commit ac7a4e5 into espressif:master Nov 27, 2025
85 checks passed
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.

3 participants