Solution RAM options in LPC4367 ?

cancel
Showing results for 
Search instead for 
Did you mean: 

Solution RAM options in LPC4367 ?

317 Views
Contributor II

Hi,

I am using LPC4367 controller in one of my project. I am using all the three cores (M4. M0App, M0Sub). i have configures the MCU setting as follows,

For M4 Core:

pastedImage_2.png

For M0App,

pastedImage_1.png

For M0Sub:

pastedImage_3.png

While developing the application i fund that the memory consumption (RAM) for M0App is almost 80% of 32KB for M0App core. It requires more RAM for further development. 

I am also using SDRAM (8MB) interfaced with M4 core. Is it possible to use this SDRAM for M0App core by allocating some data to this RAM?

Also there is IPC memory of 32 KB. Need to know whether it uses this memory if the existing allocated RAM is consumed.? I am using this memory for interprocessor communication. Then how to allocate the extraRAM to this core.

Belwo mentioned is the screen shot of the compiled output of the code.

pastedImage_9.png

I need the information and the solution for the same .

1.What to do to increase the RAM size for the core?

2. Can SDRAM is accessed for both the cores even though it is interface or controlller by M4 Core:?

3. How to allocated IPC  memort in case if the RAM is 80% full? will it affect the IPC communication part?

Thanks

Gaurav More

Labels (2)
0 Kudos
4 Replies

212 Views
NXP TechSupport
NXP TechSupport

Hello Gaurav,

 

The M4 and the M0 have the same access rights so you should not face any issues. However, you should not access they cannot access at the same time and you need to take into consideration the following priority order of the different ports that connect with the bus master.

 

1. LCD controller

2. M4 S-bus

3. M4 I/D-bus, M0APP bus

4. Other bus masters including M0SUB bus

 

Regarding the RAM consumption of your project I see you have used around 27KB of the 154 KB of total SRAM you have available. I recommend you to check the following document that explains how you can relocate code and data to other RAM spaces using MCUXpresso.

 

Relocating Code and Data Using the MCUXpresso IDE 

 

I hope this helps.

 

Have a great day,

Felipe

-------------------------------------------------------------------------------

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.

------------------------------------------------------------------------------ 

0 Kudos

212 Views
Contributor II

Hi Felipe,

Thanks for the reply,

As per your input it referred the link Relocating Code and Data Using the MCUXpresso IDE  and asper that i tried to allocate the data to RAM. Below are the details.

I have interfaced the SDRAM with the M4 Core, i can access it using the pointers., Now in that code I have created memory configuration as follows,

pastedImage_3.png

You can see i have added RAM7  0x28000000, 0X800000. Then after in the code the created the buffer in this RAM  Location 

__SECTION(data,RAM7) uint16_t data_buffer[1024]; 

and then after refering the link you mentioned in tried that as well

__DATA(RAM7) uint16_t data_buffer[1024]; 

But still after compilation am not able to see the effect . Beloow is the compilation output

pastedImage_4.png

You can see there is no such allocation of the memory in the defined SDRAM location. It should show 2KB in used size column.

Also find the attached code for your reference,

One more query , i also want to assigned the data in continous mannaer means

structure Data[1000] followed by other structure array as such, so please suggest the solution for the same. In order to avoid the pointer access as so as to optimise the code.as well.

Please check the code the suggest the solution or modification since it is on high priority  w.r.t th application development.

Thanks 

Gaurav More

0 Kudos

212 Views
Senior Contributor IV

Having allocated data_buffer[1024], is it referenced in your code? If it is unused, then it will be discarded. Either use it or use  __attribute__((used)) when defining it.

I think the only way to guarantee data is allocated consecutively is to place it into a structure. However, generally, items will be allocated consecutively, but not guaranteed.   

0 Kudos

212 Views
Contributor II

Hi Converse,

Thanks for the reply,

I modified the code as per ypur inputs and check the same and founf it is proper. Thansk for the help . I was not assigning values to the buffer allocated in SDRAM.

Reagrading the functionality i am facing some issue for SDRAM.

After modification I tried to check whether the buffer allocated in getting updated properly after assigning the values to buffer. Using the below mentioned code,

__DATA(RAM7) uint32_t data_buffer[512];

for (Value = 0; Value < (512); Value++)
{
data_buffer[Value] = Value+1;
}
for (Value = 0; Value < (512); Value++)
{
if(data_buffer[Value] != (Value + 1) )
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 5, 19, (bool) false);
while(1);
}
}

while(1)
{
Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 5);

for (i=0; i<0xFFFFF;i++ );

Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 19);
for (i=0; i<0xFFFFF;i++ );
// for (i=0; i<0xFFFFFF;i++ );
}

As per the above code  the values acpested is 1 to 513 in the buffer array but after debugging i found that the data is not updated properly. values are wrong. some location it is not writing the values it is showing zero values. and other place it is updating wrong values.

Then I performed the other test where i modified the code with below mention method,

/* Initialize code */

#define EMC_ADDRESS_DYCS0   (0x28000000)

int Main(void)

{

uint32_t *sdram = (uint32_t *)(EMC_ADDRESS_DYCS0); /* SDRAM start address. */

uint32_t index, i;
uint32_t sdramAddr;
uint32_t Data = 0XA5A5A5A5;
uint32_t Data1 = 0x5A5A5A5A;

for (index = 0; index < (SDRAM_SIZE ); index++)
{
Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 5);

if(Flag == 0 )
{
sdramAddr = Data;

//*(sdram + index ) = sdramAddr;
*(uint32_t *)(sdram + index ) = sdramAddr;

Flag = 1;
}
else
{
sdramAddr = Data;

//*(sdram + index) = sdramAddr;
*(uint32_t *)(sdram + index ) = sdramAddr;

Flag = 0;
}

if(*(uint32_t *)(sdram + index ) != sdramAddr )
// if(*(sdram + index) != sdramAddr )
{
while(1);
}
}

while(1)
{
Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 5);

for (i=0; i<0xFFFFF;i++ );

Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 19);
for (i=0; i<0xFFFFF;i++ );
// for (i=0; i<0xFFFFFF;i++ );
}

}// Eof Main

Using this mehtod i tested the complete size of the SDRAM and fout it working properly. 

please let mw know what is the issue in the code. ia have also attached the code for your reference.

Please let me know where is the mistake in the code. Since i have to allocate the data in SDRAM ram due to some memory contraints and application requirement.

Thanks 

Gaurav More

0 Kudos