Hello,
I am using a custom board made similar to the MIMXRT1050 writing code with Keilv5 Pro edition. The custom board is using the same processor, Cortex-M7, with QSPI flash and external 256 MB SDRAM, Winbond W9825G6KH. My project involves using a custom bootloader which runs in flash then copies RAM code from a flash location to RAM for execution. I program the two projects to flash using two generated bin files with the Segger Flasher program. Bootloader is programmed to 0x6000_0000 and RAM code is programmed to 0x6020_0000.
I have two separate projects:
Bootloader - Compiled at the start of flash, 0x6000_0000, will begin by initializing the board including clocks, pins, and configuring the SDRAM. Then it will test external RAM by writing to it and reading it back to confirm the writes. Next, bootloader will copy the RAM code from flash location, currently 0x6020_0000, to RAM starting at 0x8000_0000. After copying the code, bootloader will confirm the contents to match the code stored in RAM and then jump to RAM to continue execution.
External RAM code - Compiled at the start of RAM, 0x8000_0000, currently just blinking an LED and printing to the console using serial interface and UART.
My current status on this project is bootlader is working fine, in which it does what its supposed to do every time. However, when I jump over to RAM for execution, I am getting varying results. In some cases, the whole project will run perfectly, other times as soon as I jump to RAM the program just hangs and does nothing, sometimes it will run halfway through the RAM code then hang. The RAM code execution is not hanging in a specific spot every time, it is not consistent so finding the source of the problem is difficult. Adding debug statements like LED or UART text causes the RAM code to hang in a new location.
My theories of the issues that could cause the problem:
The SDRAM is not being configured correctly in bootloader.
When jumping from bootloader to RAM, something is getting reset or reconfigured.
The clock and timing settings are not correct in the RAM project.
The SDRAM runs faster than flash, maybe the SDRAM is running too fast for clean code execution.
Questions:
1) When jumping from Flash to RAM, what steps are needed to make sure nothing is being reconfigured or reset?
2) If I configure all the pins in Flash, do I need to do it again in RAM?
- I tested the one pin by only configuring the LED pin in Flash and it worked in RAM without reconfiguring it.
3) What is the correct clock settings for executing code in external SDRAM?
4) Are there any project examples of projects running only in external SDRAM not internal RAM or Flash?
Any help is appreciated,
Kamal
Hi Kamal Nasif,
Maybe this community document may useful to you:
RT1050 - Booting from serial NOR flash to SDRAM
Now, answer your 4 questions.
Questions:
1) When jumping from Flash to RAM, what steps are needed to make sure nothing is being reconfigured or reset?
Answer: maybe you can try to disable the cache. Just make sure it's no conflict between the flexSPI and the semc.
More details, please check the following application note:
https://www.nxp.com/docs/en/application-note/AN12042.pdf
2) If I configure all the pins in Flash, do I need to do it again in RAM?
- I tested the one pin by only configuring the LED pin in Flash and it worked in RAM without reconfiguring it.
Answer: If you already run the related pins register, then go to RAM partical code, I think you don't need to configure it.
3) What is the correct clock settings for executing code in external SDRAM?
Answer: I think you need to make sure the SDRAM clock(SEMC) should work when you do the clock settings for executing code.
4) Are there any project examples of projects running only in external SDRAM not internal RAM or Flash?
Answer: check my attached project, it is running from external SDRAM in MIMXRT1050-EVKB.
More details about the SDRAM and the MCUXPresso IDE, please check this document:
Overview of using the MIMXRT1050-EVK(B) with MCUXpresso IDE
Have a great day,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------