cancel
Showing results for 
Search instead for 
Did you mean: 

QSPI with stm32cubeIDE on custom stm32f746IGT board

istepne
Associate III

Is there any one to help me on get QSPI work?

I am using n25q128 and the SPI pins;

 /**QUADSPI GPIO Configuration   

   PE2    ------> QUADSPI_BK1_IO2

   PF9    ------> QUADSPI_BK1_IO1

   PB2    ------> QUADSPI_CLK

   PD11    ------> QUADSPI_BK1_IO0

   PD13    ------> QUADSPI_BK1_IO3

   PB6    ------> QUADSPI_BK1_NCS

   */

I am trying to find out a sample code to get it work. I tried to test my hardware is OK or not via ST-Link External memory read&write but my hardware olsa used different pins. So, how can I change *.stldr file according to my hardware easily?

Regards,

Murat

void HAL_QSPI_MspInit(QSPI_HandleTypeDef* hqspi)

{

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 if(hqspi->Instance==QUADSPI)

 {

 /* USER CODE BEGIN QUADSPI_MspInit 0 */

 /* USER CODE END QUADSPI_MspInit 0 */

   /* Peripheral clock enable */

   __HAL_RCC_QSPI_CLK_ENABLE();

   __HAL_RCC_GPIOE_CLK_ENABLE();

   __HAL_RCC_GPIOF_CLK_ENABLE();

   __HAL_RCC_GPIOB_CLK_ENABLE();

   __HAL_RCC_GPIOD_CLK_ENABLE();

   /**QUADSPI GPIO Configuration   

   PE2    ------> QUADSPI_BK1_IO2

   PF9    ------> QUADSPI_BK1_IO1

   PB2    ------> QUADSPI_CLK

   PD11    ------> QUADSPI_BK1_IO0

   PD13    ------> QUADSPI_BK1_IO3

   PB6    ------> QUADSPI_BK1_NCS

   */

   GPIO_InitStruct.Pin = GPIO_PIN_2;

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

   GPIO_InitStruct.Pull = GPIO_NOPULL;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;

   HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

   GPIO_InitStruct.Pin = GPIO_PIN_9;

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

   GPIO_InitStruct.Pull = GPIO_NOPULL;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;

   HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

   GPIO_InitStruct.Pin = GPIO_PIN_2;

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

   GPIO_InitStruct.Pull = GPIO_NOPULL;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;

   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

   GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_13;

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

   GPIO_InitStruct.Pull = GPIO_NOPULL;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;

   HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

   GPIO_InitStruct.Pin = GPIO_PIN_6;

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

   GPIO_InitStruct.Pull = GPIO_NOPULL;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;

   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

   /* QUADSPI interrupt Init */

   HAL_NVIC_SetPriority(QUADSPI_IRQn, 0, 0);

   HAL_NVIC_EnableIRQ(QUADSPI_IRQn);

 /* USER CODE BEGIN QUADSPI_MspInit 1 */

 /* USER CODE END QUADSPI_MspInit 1 */

 }

}

19 REPLIES 19
istepne
Associate III

Hi Dams,

The .stldr file must be compiled and created according to your own hardware. In my case Mr Clive Two.Zero (thanks to him again) has created the .stldr file and I have successfully tested with MT25QL128ABA1ESE (Micron). First of all, check that the IC is compatible or not because the IC that I used was not compatible.

The second think The STM32CubeProgrammer is also can read & write the external QSPI memory. But, "Device Memory" window, displaying the memory, sometimes reads as all 0x00 and seems to be work. Try to connect and disconect to get back working with QSPI.

STM32CubeProgrammer "Download Flash" section (external loader enabled) when programming is works.

And also mostly failed when mapped mode is activated with trying TouchGFX tests.

Now, I switched to STemWin and currently I am using the QSPI memory as storage.

Regards,

Murat

Noted, I'll get to this in a bit..

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

Hi,

Thanks for all advices.

I now have something pretty working, I can read and write data but the problem is that after switch the power off , data disapear. I read 0xff everywhere after power again the board.

If I connect -> write data -> disconnect (from soft) -> reconnect -> data are correctly read.

It's like if data are written on MCU RAM instead of QSPI Flash.

If someone has an idea, thanks to give it to me 🙂

Regards,

Dams

CLIVEONE-N25Q128A_STM32F746IG-DAMS

PB2:9 PF8:10 PF9:10 PE2:9 PF6:9 PB6:10

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

Hi,

Thanks for the file, it works fine !

Regards,

Dams

Please appreciate via PayPal, sourcer32@gmail.com

Helps defray part costs from DigiKey/Mouser, ST provides no sponsorship

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

Any luck with this configuration?

Also - Would you care to shed a bit of light on the process of developing that .stldr file? I still can't find a single word of documentation on it...

These ones were developed by patching the object file. Basically reassociating pins. Also built ones that can be reassembled.

More generally these loaders require some prerequisite knowledge and understanding, of the tools, and the concepts of object files, loaders, and "DLLs" in the wider context.

The STLDR are small applets, in a model derived from the Keil FLM, which export a few basic functions, generally to initialize the hardware interfaces, and then map the memory, or provide methods to erase the sectors and/or chip, and write/verify blocks of data.

The ST-LINK tools (ie Utilities / STM32 Cube Programmer) load and call these applets in RAM, whilst also moving data into and out of RAM and funnelled via the routines you provide to execute the task.

These are things that tool vendors or SoC engineers have had to build for decades to facilitate the support of new devices/hardware.

ST has provided a subset of examples. Some of the concepts need to be absorbed thru osmosis, and understanding of the basic concepts at play.

In all these things are poorly documented and even more poorly tested, the ST-LINK tools being particularly inconsistent and frustrating.

thanks! I will have a look at how in the world this is built.