MPC5744p overlay RAM

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

MPC5744p overlay RAM

4,123 Views
ivanmandic
Contributor II

Hello,

 

Which part of SRAM can be used for overlay on MPC5744p? Addresses 0x40000000 -- 0x4005FFFF are not reserved, are those okay to use?

 

Best regards,

Ivan Mandić

Labels (1)
Tags (1)
9 Replies

2,760 Views
tom_cruise_234
Contributor II

Dear all,

      I was trying to implement overlay ram code , but its not working.

1)Controller i am using is MPC5744P

2)I tried the example code from this link.

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-Flash-Overlay-SRAM-S32DS-Power-... 

3) I also tried implement this code in my existing code also.

 

In all the cases its not working.Is there anything i am missing.

0 Kudos

3,207 Views
zhouhuiying
Contributor I

i use 0x4000000 as the overlay SRAM. when i change the RAM value. the corresponding flash   follows. but after Reset. flash backs to 0xffffffff

0 Kudos

3,207 Views
zhouhuiying
Contributor I

hello ,when i use this code ,it seems working fine,but after reset the flash value is still 0xffffff,how could this happen?

0 Kudos

3,207 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

this is copied from reference manual:

pastedImage_1.png

That means you can use any address within RAM implemented on this device (0x40000000 -- 0x4005FFFF).

Regards,

Lukas

0 Kudos

3,207 Views
ivanmandic
Contributor II

Hello Lukas,

Thanks for the quick response. Now I'm trying to use the overlay with the function below. To my understanding it should copy the part of flash i chose to the location in SRAM i also defined, but nothing gets copied.

void Overlay(void) 
{
    PFLASH.PFCRD[0].Word0.B.LSTARTADDR = (Mirror_Small_Flash_Memory_Block_0_BEGIN>>4);
    PFLASH.PFCRD[0].Word1.B.PSTARTADDR = (0x40010000>>4);
    PFLASH.PFCRD[0].Word2.B.CRDSize = B64;
    PFLASH.PFCR1.B.RWSC = 0b0101;
    PFLASH.PFCR1.B.APC = 0b010;

    C55FMC.MCR.B.PGM = 1;
    *(unsigned int *)Small_Flash_Memory_Block_0_BEGIN = 0xffffffff;
    C55FMC.MCR.B.PGM = 0;

    PFLASH.PFCRDE.B.CRD0EN = 1;
    PFLASH.PFCRCR.B.GRMEN = 1;
}

Mirror_Small_Flash_Memory_Block_0_BEGIN is defined as 0x08F98000, and Small_Flash_Memory_Block_0_BEGIN as 0x00F98000. B64 is 0b00110 just for testing a small transfer. Is there something additional i need to do or change in order for this to work?

Best regards,

Ivan Mandić

0 Kudos

3,207 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

I did quick test in debugger:

I configured descriptor 0 to overlay 32 bytes of flash at address 0x08F98000 by RAM at 0x40010000. When I enable the descriptor, I can see the RAM content at flash address:

pastedImage_1.png

If I disable the overlay, I can see original content (all 0xFF) at 0x08F98000:

pastedImage_2.png

Please check my configuration.

By the way, this piece of code:

C55FMC.MCR.B.PGM = 1;
    *(unsigned int *)Small_Flash_Memory_Block_0_BEGIN = 0xffffffff;
    C55FMC.MCR.B.PGM = 0;

... doesn't make sense. When you enable the overlay, it does not copy any data. It just re-map the RAM, so you see the RAM at flash addresses. If you want to see the flash again at the same addresses, you have to disable the overlay.

Regards,

Lukas

3,207 Views
dhanesh_pandian
Contributor II

Hi Lukas,

I too have the same use case and I just followed your step, but not successful. but my target is MPC5777M Microcontroller.

When I try to set the PFCRD0_WORD0 & PFCRD0_WORD1 there is >> 4-bit shifting is happening, but I couldn't able to see this behavior in your screenshot.

pastedImage_1.png

0 Kudos

3,207 Views
ivanmandic
Contributor II

Hello again,

I looked at your configuration and saw that i haven't set M0EN as  '1'. That basically fixed my problem. The part of the code that doesn't make sense is used for safety measurement if there will be the use of line read buffer.

Capture.JPG

Thanks for the help again.

Best regards,

Ivan Mandić

0 Kudos

3,207 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

That's a good point! I didn't notice this note in RM. Thanks for sharing.

Regards,

Lukas

0 Kudos