AnsweredAssumed Answered

MIMXRT1050 SDRAM Code Varying Results Help

Question asked by Kamal Nasif on Feb 28, 2020
Latest reply on Mar 2, 2020 by Kerry Zhou

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

Outcomes