Need more help with SDRAM on RT1064 EVk

cancel
Showing results for 
Search instead for 
Did you mean: 

Need more help with SDRAM on RT1064 EVk

1,292 Views
ncampbell
Contributor II

Asked this before but only got partial answers, for one specific case. Here's what I need to do:

- on the RT1064 EVK, using MCUXpresso, I need to use the SDRAM for data (not code)

- data is "static" so (to conform to C specification) must be cleared by the C runtime before the "main" program starts (this means the SDRAM must be initialized PRIOR to main being executed)

- I need this to work in two scenarios: execute-in-place, and running in RAM. For the RAM case obviously I also need to be able to burn the code to flash so that the EVK can run without the debugger attached

So my questions are (and if possible please answer each one):

- should I enable the SEMC in the MCUXpresso Peripherals page, and if so, what settings should I use for the dozens of parameters?

- should I use the Pins page to configure the pins used by the SDRAM and if so which pins and to what values should I set them?

- should I put XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT in the Preprocessor settings?
- should I declare my C variables using the __BSS(BOARD_SDRAM) qualifier or is there a better way?

- are there any other steps I need to take to get the SDRAM to work under both my scenarios?

Thanks

Norm

0 Kudos
14 Replies

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Norm,

- should I enable the SEMC in the MCUXpresso Peripherals page, and if so, what settings should I use for the dozens of parameters?

Yes. Since you want SDRAM get ready before main(), you can have boot ROM enable SDRAM. Everything is ready, just add XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT in the Preprocessor settings.

- should I use the Pins page to configure the pins used by the SDRAM and if so which pins and to what values should I set them?

No, DCD file has configured pin for you.

- should I put XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT in the Preprocessor settings?

Yes

- should I declare my C variables using the __BSS(BOARD_SDRAM) qualifier or is there a better way?

If there are not too many variables, you can declare in this way. If there are lots of variables, you can move their files in a folder and assign all the variables in this folder to SDRAM address. Please see sector 17.11 and 17.13 in MCUXpresso_IDE_User_Guide.pdf .

- are there any other steps I need to take to get the SDRAM to work under both my scenarios?

I think both of the scenarios are same to SDRAM, isn't it?

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

Thanks for the response. Unfortunately the SDRAM is not initialized correctly. I have done all the steps you mentioned, but when I start the debugger, it hits HardFault_Handler before getting to main(). However, if I change __BSS to __NOINIT then it works fine, so the problem is likely that the C runtime attempts to zero the SDRAM arrays before the SDRAM is initialized.

Here are my preprocessor settings:

What other steps must I take?

Thanks

Norm

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT is to add DCD into image head. Boot ROM can configure SDRAM base on the head. If you want to download code to SDRAM, you must let debugger initialize the SDRAM. Please look at this link

Overview of using the MIMXRT1050-EVK(B) with MCUXpresso IDE 

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

Thanks for that info - seems pretty important and I'm surprised that's not in the RT1064 intro documentation.

But in any case it didn't work for me. The SDRAM is still uninitialized at the start of main. See below:

Did I enter the script correctly? Note that the layout of the debugger params is very different than in the documentation you sent me.

Thanks

Norm

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I must correct my last reply. When MCUXpresso debug RT, it will execute the script(.scp) first. Then Boot ROM will take charge. After that, debugger will control the system.

The SDRAM script in the link I attached in last reply is used for having IDE download code to SDRAM directly.

I made a demo in your case. I just add XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT in predefine. It can debug and works well. I define a string in SDRAM. You can see that the string can be print. It needn't rt1050_sdram.scp.

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

Thanks for the update. I have debugged your project and as you say it does initialize the SDRAM before getting to main().

However, this doesn't solve my problem. As you can see from my earlier e-mail, I have the same preprocessor defines that you mentioned (XIP_BOOT_HEADER_DCD_ENABLE=1 and SKIP_SYSCLK_INIT).

Your debug launch specifies a connect script - RT1064_connect.scp. What is that? I can't find it anywhere. Is it required to make the SDRAM work?

Also, do you configure the SEMC in your peripherals page? I can't view that (MCUXpresso says it was configured with an older version of the tool and it appears to be blank). I am using MCUXpresso v11.0.1. My SDK is 2.6.1.

Thanks

Norm

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I use RT1064 SDK v2.7.0 and MCUXpresso 11.1. You can update your tools and try again. 

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

This isn't going well. I went to the NXP SDK builder and built SDK 2.7 with support for my board, and downloaded that as a zip file. Then I tried to drag the zip file into MCUXpresso's SDK pane, but it says "unable to load one or more SDKs. This may be because the SDK was not created for MCUXpresso or your IDE is not up to date". So I downloaded MCUXpresso 11.1. That runs, but I can't open my existing project. Project - Open is greyed out.

I can import the project, but then the entire thing, including all the source files, gets duplicated into my new workspace folder. I can't allow the whole thing to get duplicated, it's all in software configuration control so I need it to stay where it is. How do I just OPEN the existing project?

Also, you didn't answer my previous question: what is RT1064_connect.scp? Do I need it? If so, where do I find it?

Thanks

Norm

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Norm,

RT1064_connect.scp comes with MCUXpresso. When you click the drop_down menu, you can see it in the list. It is in MCUXpressoIDE_11.1.1_3241\ide\binaries\Scripts.

If you don't want to copy the project into work space, you should deselect this option.

pastedImage_1.png

Regards,

Jing

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

RUN->Debug Configurations. Do you select .scp here? Do you means there is nothing in in MCUXpressoIDE_11.1.1_3241\ide\binaries\Scripts?

pastedImage_1.png

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

I found the script where you said it would be - thanks. It's not super-obvious because that dropdown list is NOT initially populated with anything, and clicking on FileSystem does not by default take you to the Scripts folder. But I've got it now. However it seems to have no bearing on operation of the SDRAM.

Can we return to my other question? Where is the option to not copy the files into the workspace during a project import? As you can see in the screenshot I sent you, there is no such checkbox.

Thanks

Norm

0 Kudos

1,014 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Please go this path:

Quickstart Panel ->import project(s) from file system -> project directory(unpacked)

Regards,

Jing

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

Thanks, that worked.

It didn't solve my original problem, of course (initializing the SDRAM). But I eventually figured out how to make it work - in the SEMC tab of the Peripherals pane, set the mode dropdown to DCD.

So I guess you can mark the ticket as closed. But I'm a little disappointed that it took this long. There doesn't seem to be anywhere in the documentation that coherently explains how to use the SDRAM, and you weren't even aware, apparently, about that dropdown in the SEMC page, or at least you didn't mention it to me.

Thanks

Norm

0 Kudos

1,014 Views
ncampbell
Contributor II

Hi Jing -

Re the dropdown box - do you mean the Connect Script box? It's blank!

And re copying the files: I should deselect what option?

Thanks

Norm

0 Kudos