cancel
Showing results for 
Search instead for 
Did you mean: 

Tutorial for CubeIDE with QuadSPI

Kevin(Dr.Electron)
Associate III

I found out today that my project was not properly configured. So i did run out of flash memory.

By comparing with a Designer project I found out how to change the FLASH.ld file to use QuadSPI and some other things that were different in the Designer project regarding QuadSPI.

But my program crashes again and again in the function

void touchgfx::Texts::setLanguage(touchgfx::LanguageId id).

Is there something like a tutorial on how to configure TouchGFX + QuadSPI in CubeIDE?

Regards,

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions
chaaalyy
Senior II

In this video you can find a cutom board method for setting up tGFX on the f746 disco:

https://www.youtube.com/watch?v=o42r4xXOnbo&t=90s

There´s also another channel available with useful tutorials:

https://www.youtube.com/channel/UCPc2YUw_rpxWJLc4PFwSZag

And never forget to set the external loader, when it comes to flashing / debugging ;) Otherwise, qspi flash isn´t accessable via stlink ...

View solution in original post

10 REPLIES 10
Romain DIELEMAN
ST Employee

Could you give more details on your HW settings (i suppose you are using a custom board)? Could you share your flash.ld file to have a look?

Have your Hard Fault Handler output actionable data.

Make sure the QSPI memory is properly initialized before touching it. Perhaps have the code dump some of the content.

Check clocks and content.

Check the .MAP output matches expectations created by the .LD file.

Refine "crashes" to some more specific mode of failure.​

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

Thanks for your help.

I'm using a STM32F7-Discovery.

I uploaded the Flash.ld file as .txt

Hi and thanks for your answear. I only started programming microcontrollers again after I learned the basics in school a few years ago.

So how do i let my Hard Fault Handler output actionable data?

Shouldn't CubeMX initialize the memory? I think i should read some more about QSPI.

.Map seems to be fine.

First my program always crashed on this line in setLanguage()

currentLanguageTypedText = typedTextDatabaseArray[id];

and jumped in the HardFaultHandler.

Now it only breaks on the begining of setLanguage, without a error visible.

>>Now it only breaks on the beginning of setLanguage, without a error visible.

Breaks how exactly? Hard to guess at this, where is the CPU stuck if you stop it in the debugger? Same place all the time? Same register values?

>>currentLanguageTypedText = typedTextDatabaseArray[id];

Ok, but that provides me with no context. What are the addresses and indexes here?

Look at the disassembly, look at the processor registers. The C code itself is not that instructive.

If the array is in QSPI, dollars to doughnuts you haven't initialized the clocks, pins and interface properly.

>>So how do i let my Hard Fault Handler output actionable data?

Well not with a while(1) loop, try something that unpacks the processor state. Have a debug UART working, or the SWV debug communications channel via PB0 / SWO pin

https://community.st.com/s/question/0D50X0000BxwhEhSQI/my-stm32h743vi-application-runs-to-a-debug-instruction-in-the-startup-code

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

So I did some more debugging. I'm not sure anymore if QSPI is the source of the errors. Although QSPI is the last thing I changed.

I get into the FreeRTOS vPortSVCHandler.

There I jump into the HardFault at bx lr. (lr = 0xfffffffffd)

238 __asm volatile (
          SVC_Handler:
0800f010: ldr r3, [pc, #28] ; (0x800f030 <SVC_Handler+32>)
0800f012: ldr r1, [r3, #0]
0800f014: ldr r0, [r1, #0]
0800f016: ldmia.w r0!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
0800f01a: msr PSP, r0
0800f01e: isb sy
0800f022: mov.w r0, #0
0800f026: msr BASEPRI, r0
0800f02a: bx lr
0800f02c: nop.w   
0800f030: lsls r4, r2, #17
0800f032: movs r0, #0
252 }

The error i get:

Failed to execute MI command:

         -data-disassemble -s 4294967277 -e 4294967322 -- 3

         Error message from debugger back end:

         Cannot access memory at address 0xffffffec

Could that be something?

As said i think I'm to unexperienced to understand completely.

I also don't understand which data I should output when i reach the HardFaultHandler... Sorry for my unknowingness, but I'm not shure if i can always follow your explanations.

I don't have time today. I'll continue testing tomorrow. And try to give you more useful information.

Thanks for your time

Martin KJELDSEN
Chief III

Your texts are probably in External Flash. Be sure that you're initializing it, and that it is addressable, before TouchGFX starts and attempts to initialize texts. CubeMX might have jumpled the init order.

MX_QSPI_Init();
MX_TouchGFX_Init();

 /Martin

Init order is right. I tried to copy code from TouchGFX Demo 1. And i don't find a difference. I copied the Flash.ld file, added the user code in the QSPI_Init()

/* USER CODE BEGIN QUADSPI_Init 2 */
  BSP_QSPI_Init();
 
  BSP_QSPI_MemoryMappedMode();
  HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
 
  /* USER CODE END QUADSPI_Init 2 */

and checked clock settings.

chaaalyy
Senior II

In this video you can find a cutom board method for setting up tGFX on the f746 disco:

https://www.youtube.com/watch?v=o42r4xXOnbo&t=90s

There´s also another channel available with useful tutorials:

https://www.youtube.com/channel/UCPc2YUw_rpxWJLc4PFwSZag

And never forget to set the external loader, when it comes to flashing / debugging ;) Otherwise, qspi flash isn´t accessable via stlink ...