2021-02-22 10:51 AM
Hi everyone,
I am trying to create an external loader for my project by ST's "How to create an external QSPI loader MOOC" lesson. Actually lesson's github repository have microcontroller and quad spi flash configurations that I use. I just change some pin configurations for my board's need.
Although I do everything like lesson but my external loader doesn't work correctly. It load flash shifting a byte. For example if my first 4 byte is {11 22 33 44}, external loader is loading these bytes flash like this {22 33 44 xx}. My all data is becoming can't usable because of this problem.
What am I do wrong? Somebody help me pls :(.
Thanks in advance. Be healthy.
2021-02-22 11:00 AM
Implement and test your BSP code outside the loader context where you can debug it and understand what's going on.
Create a test harness/fixture for the loader itself if that helps.
Byte shift could be a disagreement about dummy cycles.
All the UART and LEDs on your board are usable for diagnostic output/signalling.
2021-02-22 12:05 PM
Actually lessons code have a test harness. I implemented this section to my project like this;
uint8_t buffer_test[MEMORY_SECTOR_SIZE];
uint32_t var = 0;
CSP_QUADSPI_Init();
for (var = 0; var < MEMORY_SECTOR_SIZE; var++) {
buffer_test[var] = (var & 0xff);
}
for (var = 0; var < SECTORS_COUNT; var++) {
if (CSP_QSPI_EraseSector(var * MEMORY_SECTOR_SIZE,
(var + 1) * MEMORY_SECTOR_SIZE - 1) != HAL_OK) {
while (1)
; //breakpoint - error detected
}
if (CSP_QSPI_WriteMemory(buffer_test, var * MEMORY_SECTOR_SIZE,
sizeof(buffer_test)) != HAL_OK) {
while (1)
; //breakpoint - error detected
}
}
if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {
while (1)
; //breakpoint - error detected
}
for (var = 0; var < SECTORS_COUNT; var++) {
if (memcmp(buffer_test,
(uint8_t*) (0x90000000 + var * MEMORY_SECTOR_SIZE),
MEMORY_SECTOR_SIZE) != HAL_OK) {
while (1)
; //breakpoint - error detected - otherwise QSPI works properly
}
}
When I debug code with this, code stopped to last "while". My quad spi configuration like this;
Thanks for reply.
2021-02-22 12:10 PM
Not sure what I'm supposed to do with the code/config presented.
2021-02-22 12:16 PM
maybe you can see something I didn't realize?
2021-02-22 12:46 PM
It's all pretty top-level superficial stuff.
You'd want to look at the commands being sent, the dummy cycle configurations, and the mode settings and expectations of the device, say quad mode, and 3 or 4 byte addressing.
I'd probably have 1-bit and 4-bit read operations immediately after the write to cross-check that works before doing the memory mapping.
Right now I have no idea what STM32, which pins, what QSPI Memory device are involved here.
Figuring a 256 Mbit (32MB) device, needing 4-byte addressing.
For the H7 I'd watch for the end-of-memory errata on the QSPI
2021-02-22 01:40 PM
I use STM32H743XI microcontroller and MT25QL512 quad spi nor flash. I am using exact same Loader files and quad spi drivers in this repository. Maybe these would be revealing
I will look up to your saying.
2021-02-22 03:07 PM
Did you pull the appropriate quadspi.c / quadspi.h files? The default ones have a broken implementation with respect to configuring the Micron parts.
2021-02-22 09:54 PM
Yes, I did. Repository has just user side of code. When compiled cubemx project it creating needed stuff inside the source/header files. Project cubemx side is based on me. So I pretty sure problem is here. :grinning_face_with_sweat:
2021-02-22 10:01 PM
I did everything the same with the yours lesson and example code but still my code didn't work. Is there any advice to solve problem?
@Tilen MAJERLE @christophe cadoret