Skip to content

SPI DMA with SPI FLASH not working for STM32H7XX #83124

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

Open
bhardadinesh-eaton opened this issue Dec 17, 2024 · 10 comments
Open

SPI DMA with SPI FLASH not working for STM32H7XX #83124

bhardadinesh-eaton opened this issue Dec 17, 2024 · 10 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug Waiting for response Waiting for author's response

Comments

@bhardadinesh-eaton
Copy link

bhardadinesh-eaton commented Dec 17, 2024

Describe the bug
SPI DMA with serial flash not working for STM32H7XX due to cache memory validation which got added in this PR,
#57786

To Reproduce

Steps to reproduce the behavior:

  1. We have tested this example with some modification for NUCLEO STM32H743ZI with Click 11 ( External Flash - https://www.mikroe.com/flash-11-click) for this https://github.com/zephyrproject-rtos/zephyr/tree/v3.6.0/samples/drivers/spi_flash
  2. I will attached the modified code soon.
  3. In Project Config ( Prj.conf ), If we disable this CONFIG_SPI_STM32_DMA=n, SPI Flash is working.
  4. In Project Config ( Prj.conf ), If we enable this CONFIG_SPI_STM32_DMA=y, SPI Flash is not working.
  5. If we keep CONFIG_SPI_STM32_DMA=y and comment this code at line number 959 to 964, it is working
    image
  6. By further debugging, It is failing buf_within_nocache memory validation.
    image

Expected behavior
It should work with buf_within_nocache along with SPI DMA

Logs and console output
Not working Logs :
image

Working Logs after commenting below code :
image

Environment (please complete the following information):

  • OS: Windows
  • Toolchain : Zephyr SDK, ...
  • Commit SHA or Version used : Zephyr v3.6.0

cc : @darshanmirajkar-eaton

@bhardadinesh-eaton bhardadinesh-eaton added the bug The issue is a bug, or the PR is fixing a bug label Dec 17, 2024
@kartben kartben added the platform: STM32 ST Micro STM32 label Dec 17, 2024
@kartben
Copy link
Collaborator

kartben commented Dec 17, 2024

triaging as low as this seems to be specific to just one SoC series

@kartben kartben added the priority: low Low impact/importance bug label Dec 17, 2024
@JarmouniA
Copy link
Collaborator

@bhardadinesh-eaton
Copy link
Author

@JarmouniA Thank you prompt response. We have tried your suggestions which you have mentioned above and debugged the same. Still looks like validation is getting failed,

buf_within_nocache = (buf >= ((uintptr_t)__rodata regionstart)) && ((buf + len bytes - 1) <= ((uintptr_t)__rodata region_end)); printk("__rodata_region_start: %p, __rodata_region_end: %p\n", __rodata_region_start, __rodata_region_end);

Logs :
image

@SadanandPenore-eaton, @prayassamriya

@erwango
Copy link
Member

erwango commented Dec 19, 2024

Commit SHA or Version used : Zephyr v3.6.0

As mentionned V3.6.0 is no longer supported. Would you m mind confirming that your seeing the same issue on v3.7.0 ?

@bhardadinesh-eaton
Copy link
Author

@erwango We have manually checked the code for latest version too. The code is same only. So, Issue should be there in latest version too. I might need to setup for latest version for test and debug.

@JarmouniA
Copy link
Collaborator

JarmouniA commented Dec 19, 2024

@erwango We have manually checked the code for latest version too. The code is same only. So, Issue should be there in latest version too. I might need to setup for latest version for test and debug.

@bhardadinesh-eaton there were multiple changes to the Cache management part of the driver since, notably in this PR #71048.

Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added Stale and removed Stale labels Feb 18, 2025
@GeorgeCGV
Copy link
Collaborator

I didn't observe any issues on H730 as long as the buffers used in SPI transactions are correctly aligned and located within the no cache region. However, the current approach is not sustainable, as drivers that use SPI DMA on H7 require modification.

@FRASTM
Copy link
Collaborator

FRASTM commented Mar 17, 2025

@bhardadinesh-eaton
could you please check with a more recent version ?

@FRASTM FRASTM added the Waiting for response Waiting for author's response label Mar 17, 2025
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label May 17, 2025
@github-actions github-actions bot removed the Stale label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug Waiting for response Waiting for author's response
Projects
None yet
Development

No branches or pull requests

6 participants