Skip to main content
Yunus ARI
Senior
February 22, 2021
Question

Custom External Quad SPI Loader

  • February 22, 2021
  • 2 replies
  • 2178 views

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.

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
February 22, 2021

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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Yunus ARI
Yunus ARIAuthor
Senior
February 22, 2021

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;

0693W000007Z8kPQAS.png 

Thanks for reply.

Tesla DeLorean
Guru
February 22, 2021

Not sure what I'm supposed to do with the code/config presented.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Yunus ARI
Yunus ARIAuthor
Senior
February 23, 2021

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​