STM32 FATFS with SPI FLASH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 4:40 AM
I am trying to interface a SPI flash from Winbond (W25Q64JV) with FATFS.
I have no previous experience with FATFS.
I initialize FATFS in CubeMX with the option "used-defined" and modified the MAXIMUM and MINIMUM Sector Size to 4096, as it is the smallest possible erase sector dimension.
I Got a Sample github code. This is It.
https://github.com/maxiufeng258/SPI_Flash_Uart_Led_Polling_V1.0.
i got w25Qxxx file from this github file which contain spi command to interact with w25q64.
Now i know i should edit User_diskio or diskio,c as mentioned in the gitcode.
i done it and got hardfault error at HAL_SPI_Transmit() function.
i know that so many done and success it before .
but i dont get a clear picture of how it done. anyone guide ASAP
Solved! Go to Solution.
- Labels:
-
STM32F3 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 11:56 AM
>>before first byte transfer it goes to hard fault error.
Debug the Hard Fault cause, usually pretty fundamental. Look at the faulting code, look at the registers when it faults. Likely you're using a bad pointer, pointing to the wrong memory, or exceeding that memories limits. Potentially the stack might be too small.
Ideally have a Hard Fault Handler that outputs actionable data.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 6:09 AM
Hello @NOVAL_______BOBY
Could you please share more details about the issue?
Does the SPI start writing and then go to a hard fault after transmitting a given number of bytes?
Does the execution go to a hard fault since the first bytes?
You mentioned in the post below that you succeeded in making the writing process work but failed in the reading process.
FatFS write successful but read not working on w2... - STMicroelectronics Community
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 9:28 AM
before first byte transfer it goes to hard fault error.
when i try to do first time , i write sucessfully. but after try to open it show no such file and if i try to list all files, shows no such root directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-29 11:56 AM
>>before first byte transfer it goes to hard fault error.
Debug the Hard Fault cause, usually pretty fundamental. Look at the faulting code, look at the registers when it faults. Likely you're using a bad pointer, pointing to the wrong memory, or exceeding that memories limits. Potentially the stack might be too small.
Ideally have a Hard Fault Handler that outputs actionable data.
Up vote any posts that you find helpful, it shows what's working..
