cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with STM32H750VBT6 controller with external W25Q128 QSPI memory.

Alex777
Associate II

Hi Clive.
I am running a project on the STM32H750VBT6 controller with external W25Q128 QSPI memory.
I need to write data to flash. Your bootloader:
https://github.com/cturvey/stm32extldr/blob/main/h7_w25q128/W25Q128_STM32H7XX-CUSTOM27.FLM
didn't work.
I decided to write my own. It works, but strangely. It works at first, then it can stop working
It can be cured by commenting out an unused function or changing the optimization type.
It works for a while, then it stops. And I have 2 identical boards. It works on one,
on the other it doesn't.

I ask for help. I am attaching my project. What could be the problem?
If not, can you fix your bootloader W25Q128_STM32H7XX-CUSTOM27.FLM ?
It doesn't work for me.

cube1.pngcube2.pngkeil_error.png

1 ACCEPTED SOLUTION

Accepted Solutions

The problem was that I tried to deinitialize hspi before initializing it and the application crashed in assert.

HAL_StatusTypeDef W25Q128_QSPI_SPI_Init(QSPI_HandleTypeDef *hqspi)
{
if (HAL_QSPI_DeInit(hqspi) != HAL_OK) // !!!!!!!!!!! here hqspi also has a random value. Sometimes it is NULL.
return HAL_ERROR;
if (MX_QUADSPI_Init() != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_ResetChip(hqspi) != HAL_OK)
return HAL_ERROR;
HAL_Delay(1);
if (W25Q128_QSPI_Configuration(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_AutoPollingMemReady(hqspi) != HAL_OK) return HAL_ERROR;
return HAL_OK;
}
Solution:
HAL_StatusTypeDef W25Q128_QSPI_SPI_Init(QSPI_HandleTypeDef *hqspi)
{
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.FifoThreshold = 32;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 23;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.FlashID = QSPI_FLASH_ID_2;
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;

if (DEF_QUADSPI_Init() != HAL_OK)
return HAL_ERROR;
if (HAL_QSPI_DeInit(hqspi) != HAL_OK)
return HAL_ERROR;
if (HAL_QSPI_Init(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_ResetChip(hqspi) != HAL_OK)
return HAL_ERROR;
HAL_Delay(1);
if (W25Q128_QSPI_Configuration(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_AutoPollingMemReady(hqspi) != HAL_OK)
return HAL_ERROR;
return HAL_OK;
}

View solution in original post

6 REPLIES 6

How is it building for the 0x30000000 address space? The loaders header describes the 0x90000000 address space which is why Keil complains there's no Flash algorithm associated with it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Alex777
Associate II

This is an application project setting.

cube3.png

I think it does not affect. It works on another board.

 

I'll have to check the manual, is it a secondary mapping for the QSPI address space or RAM?

I can change the mappings in the loaders header, but you should see the current coverage when selecting the Flash Algorithm tab via the debug settings. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Addresses 0x300ххххх are secondary mapping for RAM address space for Ethernet and DMA UART buffers. Keil just complains that there are no algorithms for writing to RAM.
It doesn't matter. I'm sewing the project from address 0x90000000. And it will work when the application is already launched from address 0x90000000.

Alex777
Associate II

A simple LED blinking project, it also doesn't load with my bootloader.

keil_1.pngkeil_2.pngkeil_3.png

 

 

 


And it doesn't load with your bootloader either.

keil_4.pngkeil_5.png

The problem was that I tried to deinitialize hspi before initializing it and the application crashed in assert.

HAL_StatusTypeDef W25Q128_QSPI_SPI_Init(QSPI_HandleTypeDef *hqspi)
{
if (HAL_QSPI_DeInit(hqspi) != HAL_OK) // !!!!!!!!!!! here hqspi also has a random value. Sometimes it is NULL.
return HAL_ERROR;
if (MX_QUADSPI_Init() != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_ResetChip(hqspi) != HAL_OK)
return HAL_ERROR;
HAL_Delay(1);
if (W25Q128_QSPI_Configuration(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_AutoPollingMemReady(hqspi) != HAL_OK) return HAL_ERROR;
return HAL_OK;
}
Solution:
HAL_StatusTypeDef W25Q128_QSPI_SPI_Init(QSPI_HandleTypeDef *hqspi)
{
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.FifoThreshold = 32;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 23;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.FlashID = QSPI_FLASH_ID_2;
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;

if (DEF_QUADSPI_Init() != HAL_OK)
return HAL_ERROR;
if (HAL_QSPI_DeInit(hqspi) != HAL_OK)
return HAL_ERROR;
if (HAL_QSPI_Init(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_ResetChip(hqspi) != HAL_OK)
return HAL_ERROR;
HAL_Delay(1);
if (W25Q128_QSPI_Configuration(hqspi) != HAL_OK)
return HAL_ERROR;
if (W25Q128_QSPI_AutoPollingMemReady(hqspi) != HAL_OK)
return HAL_ERROR;
return HAL_OK;
}