TWR-K70 using external DDR2 memory with MQX 4

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TWR-K70 using external DDR2 memory with MQX 4

Jump to solution
2,505 Views
lorenzofornari
Contributor III

i'm devoloping a simple mqx application on twr-k70, with codewarrior 10.3, and i have to use the external ram module (1 gb ddr2).

So i'm trying to debug with DDRData target configuration (getting started guide explains that this is the way to use external ram instead of the internal one, that is only 128k).

As result mqx doesn't start, locking in a loop trying to initialize a lwsem (light weight semaphore component) in mqx() start function in mqx.c file.

With SRAM debug configuration all works properly (but i haven't enough memory).

I have the same problem with mqx 3.8.1 and 4.0, using provided bsps.

It seems that ddr module isn't properly initialized, since the global pointer to kernel data _mqx_kernel_data has some erratic or uninitialized values (0xbabababa), and the application cannot write on it, nor in the other variables.

I found out a bug in ddr2 initialization function: _bsp_ddr2_setup(), in init_hw.c, so i corrected it following the ddr2 init function provided in bare metal sample code, but with the same result.

At last i tried one of the bare metal examples (hello world) with EXTERNAL_DDR build and debug configuration (i had some problems with references to the settings file, but i fixed them), and it wont start... locking at first asm instruction...

I know that EXTERNAL_DDR configuration means that the application code is loaded on external ram, while DDRData of mqx project means that che variables are loaded on external ram; but anyway the external ddr module is unusable.

Some one has the same issue? Is it a hardware problem?

Labels (1)
0 Kudos
1 Solution
978 Views
lorenzofornari
Contributor III

this check is performed in _mqx function, if(PSP_KERNEL_DATA_VERIFY_ENABLE)

it returns "MQX_CORRUPT_MEMORY_SYSTEM".

Anyhow, i've made a test with another twrk70, flashing it with the same .afx, and it works. So it is finally an hardware problem.

Thank you for replies.

View solution in original post

0 Kudos
8 Replies
978 Views
JerryFan
NXP Employee
NXP Employee

Just as a debug method, you can run program in flash or sram to verify the DDR2 after it be initialized. At least, we should make sure the DDR2 is stable enough firstly.

0 Kudos
978 Views
lorenzofornari
Contributor III

Hi Fan,

in DDRData configuration program is just running on internal flash, and ddr is used for data storage (if i understand correctly mqx getting started guide).

DDR is initialized in _bsp_ddr2_setup() function, but it seems to be unusable, in fact i cant write on it using cw memory debug tool (in memory view).

0 Kudos
978 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Lorenzo,

Please look at next thread:

Re: K70 Tower System MQX Application in RAM

This question is already answered here.

Hope it helps!

CAMC

0 Kudos
978 Views
lorenzofornari
Contributor III

Hi Carlos,

if i understand your answer, my problem is different, since you explain how to execute the whole application in external ddr2, as is in internal ram configuration, conversley i'm trying to use provided INT_FLASH_DDRData build/debug configuration, where application code is executed out of internal flash, and external ddr ram is used for application's variables, dynamic memory and so on.

0 Kudos
978 Views
LuisCasado
NXP Employee
NXP Employee

Hi lorenzo,

In this case, you only have to select the right 'Build Configuration' for your project. Select "Int Flash DDRData Debug" or   "Int Flash DDRData Release". That configuration does what you need.

Luis

0 Kudos
978 Views
lorenzofornari
Contributor III

i'm sorry for my bad explanation, but the problem is just that with provided build/debug configuration mqx won't start.

Neither new project, nor provided demo (hello world, web_hvac... so on) work with ddrdata configuration,while with intsram they work properly...

After several attemps, i guess it should be a hardware issue... i'm trying to get another K70 twr to check this.

0 Kudos
978 Views
JerryFan
NXP Employee
NXP Employee

I recommanded to run the DDR2 memory test to tell the stablility of the DDR2. You can easily do this using _mem_verify(base, extend). It is always very neccessary to validate the DDR2 memory before using it.

979 Views
lorenzofornari
Contributor III

this check is performed in _mqx function, if(PSP_KERNEL_DATA_VERIFY_ENABLE)

it returns "MQX_CORRUPT_MEMORY_SYSTEM".

Anyhow, i've made a test with another twrk70, flashing it with the same .afx, and it works. So it is finally an hardware problem.

Thank you for replies.

0 Kudos