MPC5646C RAM read using BAM

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

MPC5646C RAM read using BAM

Jump to solution
892 Views
BorisB
Contributor I

Hi,

I am trying to read the internal RAM using the BAM module, via the UART

The problem is that there is a repeating pattern in the received file, that doesn't look correct.

This is the code i am using.

 

#define RAM_BASE    0x40000000
#define RAM_SIZE    256*1024
#define RAM_END     RAM_BASE + RAM_SIZE    

int main(void) {

  int32_t  i = 0, r = 0;
  uint32_t word = 0x00;

			      				      			      
  InitHW();    
  InitializeUART(kBaud500000);	

        
  /* Start the other core */   
  SSCM.DPMBOOT.R = (unsigned long)__start_p1;
  SSCM.DPMKEY.R  = (unsigned long)0x00005AF0;
  SSCM.DPMKEY.R  = (unsigned long)0x0000A50F;

  for (;;)
  {   
  	for (i = RAM_BASE; i <  RAM_END; i+= 4)
  	{
  		word = *(uint32_t*) i;
  		uart_print_int(word);
  	}

  	delay_100ms(1);
  }
}

 

the pattern i am getting is:

00 00 20 7E 04 00 00 00 20 4E 04 00 00 00 10 0E 
00 00 00 00 00 00 04 00 00 03 30 00 04 00 00 09 
F0 DC 0F F0 F5 00 00 00 04 00 00 00 50 F0 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 04 00 00 02 60 00 00 00 00 00 70 CA 04 00 
00 09 F0 D0 04 00 00 00 10 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 
00 00 20 7E 04 00 00 00 20 4E 04 00 00 00 10 0E 
00 00 00 00 00 00 04 00 00 03 30 00 04 00 00 09 
F0 DC 0F F0 F5 00 00 00 04 00 00 00 50 F0 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 04 00 00 02 60 80 00 00 00 00 70 CA 04 00 
00 09 F0 D0 04 00 00 00 10 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 
00 00 20 7E 04 00 00 00 20 4E 04 00 00 00 10 0E 
00 00 00 00 00 00 04 00 00 03 30 00 04 00 00 09 
F0 DC 0F F0 F5 00 00 00 04 00 00 00 50 F0 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 04 00 00 02 70 00 00 00 00 00 70 CA 04 00 
00 09 F0 D0 04 00 00 00 10 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 
00 00 20 7E 04 00 00 00 20 4E 04 00 00 00 10 0E 
00 00 00 00 00 00 04 00 00 03 30 00 04 00 00 09 
F0 DC 0F F0 F5 00 00 00 04 00 00 00 50 F0 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 04 00 00 02 70 80 00 00 00 00 70 CA 04 00 
00 09 F0 D0 04 00 00 00 10 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 
00 00 20 7E 04 00 00 00 20 4E 04 00 00 00 10 0E 
00 00 00 00 00 00 04 00 00 03 30 00 04 00 00 09 
F0 DC 0F F0 F5 00 00 00 04 00 00 00 50 F0 00 00 

 

Is this supposed to be normal, or i am getting something wrong. Its a new processor, an empty one, isn't it supposed to be empty.

0 Kudos
Reply
1 Solution
860 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @BorisB 

RAM memory contains random data after power on. It must be initialized:

lukaszadrapa_0-1718861515281.png

 

lukaszadrapa_1-1718861520748.png

 It's done in startup code like this:

lukaszadrapa_2-1718861539171.png

 

stmw instruction is used - it writes all GPR core registers to RAM in a loop. That's the reason why you can see such pattern in the RAM.

Regards,

Lukas

 

View solution in original post

0 Kudos
Reply
1 Reply
861 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @BorisB 

RAM memory contains random data after power on. It must be initialized:

lukaszadrapa_0-1718861515281.png

 

lukaszadrapa_1-1718861520748.png

 It's done in startup code like this:

lukaszadrapa_2-1718861539171.png

 

stmw instruction is used - it writes all GPR core registers to RAM in a loop. That's the reason why you can see such pattern in the RAM.

Regards,

Lukas

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1889286%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPC5646C%20RAM%20read%20using%20BAM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889286%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20read%20the%20internal%20RAM%20using%20the%20BAM%20module%2C%20via%20the%20UART%3C%2FP%3E%3CP%3EThe%20problem%20is%20that%20there%20is%20a%20repeating%20pattern%20in%20the%20received%20file%2C%20that%20doesn't%20look%20correct.%3C%2FP%3E%3CP%3EThis%20is%20the%20code%20i%20am%20using.%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%23define%20RAM_BASE%20%20%20%200x40000000%0A%23define%20RAM_SIZE%20%20%20%20256*1024%0A%23define%20RAM_END%20%20%20%20%20RAM_BASE%20%2B%20RAM_SIZE%20%20%20%20%0A%0Aint%20main(void)%20%7B%0A%0A%20%20int32_t%20%20i%20%3D%200%2C%20r%20%3D%200%3B%0A%20%20uint32_t%20word%20%3D%200x00%3B%0A%0A%09%09%09%20%20%20%20%20%20%09%09%09%09%20%20%20%20%20%20%09%09%09%20%20%20%20%20%20%0A%20%20InitHW()%3B%20%20%20%20%0A%20%20InitializeUART(kBaud500000)%3B%09%0A%0A%20%20%20%20%20%20%20%20%0A%20%20%2F*%20Start%20the%20other%20core%20*%2F%20%20%20%0A%20%20SSCM.DPMBOOT.R%20%3D%20(unsigned%20long)__start_p1%3B%0A%20%20SSCM.DPMKEY.R%20%20%3D%20(unsigned%20long)0x00005AF0%3B%0A%20%20SSCM.DPMKEY.R%20%20%3D%20(unsigned%20long)0x0000A50F%3B%0A%0A%20%20for%20(%3B%3B)%0A%20%20%7B%20%20%20%0A%20%20%09for%20(i%20%3D%20RAM_BASE%3B%20i%20%26lt%3B%20%20RAM_END%3B%20i%2B%3D%204)%0A%20%20%09%7B%0A%20%20%09%09word%20%3D%20*(uint32_t*)%20i%3B%0A%20%20%09%09uart_print_int(word)%3B%0A%20%20%09%7D%0A%0A%20%20%09delay_100ms(1)%3B%0A%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3Ethe%20pattern%20i%20am%20getting%20is%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E00%2000%2020%207E%2004%2000%2000%2000%2020%204E%2004%2000%2000%2000%2010%200E%20%0A00%2000%2000%2000%2000%2000%2004%2000%2000%2003%2030%2000%2004%2000%2000%2009%20%0AF0%20DC%200F%20F0%20F5%2000%2000%2000%2004%2000%2000%2000%2050%20F0%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2004%2000%2000%2002%2060%2000%2000%2000%2000%2000%2070%20CA%2004%2000%20%0A00%2009%20F0%20D0%2004%2000%2000%2000%2010%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2004%2000%20%0A00%2000%2020%207E%2004%2000%2000%2000%2020%204E%2004%2000%2000%2000%2010%200E%20%0A00%2000%2000%2000%2000%2000%2004%2000%2000%2003%2030%2000%2004%2000%2000%2009%20%0AF0%20DC%200F%20F0%20F5%2000%2000%2000%2004%2000%2000%2000%2050%20F0%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2004%2000%2000%2002%2060%2080%2000%2000%2000%2000%2070%20CA%2004%2000%20%0A00%2009%20F0%20D0%2004%2000%2000%2000%2010%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2004%2000%20%0A00%2000%2020%207E%2004%2000%2000%2000%2020%204E%2004%2000%2000%2000%2010%200E%20%0A00%2000%2000%2000%2000%2000%2004%2000%2000%2003%2030%2000%2004%2000%2000%2009%20%0AF0%20DC%200F%20F0%20F5%2000%2000%2000%2004%2000%2000%2000%2050%20F0%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2004%2000%2000%2002%2070%2000%2000%2000%2000%2000%2070%20CA%2004%2000%20%0A00%2009%20F0%20D0%2004%2000%2000%2000%2010%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2004%2000%20%0A00%2000%2020%207E%2004%2000%2000%2000%2020%204E%2004%2000%2000%2000%2010%200E%20%0A00%2000%2000%2000%2000%2000%2004%2000%2000%2003%2030%2000%2004%2000%2000%2009%20%0AF0%20DC%200F%20F0%20F5%2000%2000%2000%2004%2000%2000%2000%2050%20F0%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2004%2000%2000%2002%2070%2080%2000%2000%2000%2000%2070%20CA%2004%2000%20%0A00%2009%20F0%20D0%2004%2000%2000%2000%2010%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%20%0A00%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2000%2004%2000%20%0A00%2000%2020%207E%2004%2000%2000%2000%2020%204E%2004%2000%2000%2000%2010%200E%20%0A00%2000%2000%2000%2000%2000%2004%2000%2000%2003%2030%2000%2004%2000%2000%2009%20%0AF0%20DC%200F%20F0%20F5%2000%2000%2000%2004%2000%2000%2000%2050%20F0%2000%2000%20%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EIs%20this%20supposed%20to%20be%20normal%2C%20or%20i%20am%20getting%20something%20wrong.%20Its%20a%20new%20processor%2C%20an%20empty%20one%2C%20isn't%20it%20supposed%20to%20be%20empty.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1891089%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MPC5646C%20RAM%20read%20using%20BAM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1891089%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F221860%22%20target%3D%22_blank%22%3E%40BorisB%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERAM%20memory%20contains%20random%20data%20after%20power%20on.%20It%20must%20be%20initialized%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22lukaszadrapa_0-1718861515281.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lukaszadrapa_0-1718861515281.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F284989iAEB07A86D06262E8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22lukaszadrapa_0-1718861515281.png%22%20alt%3D%22lukaszadrapa_0-1718861515281.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22lukaszadrapa_1-1718861520748.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lukaszadrapa_1-1718861520748.png%22%20style%3D%22width%3A%20394px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F284990iDE0A9945779B87A8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22lukaszadrapa_1-1718861520748.png%22%20alt%3D%22lukaszadrapa_1-1718861520748.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3BIt's%20done%20in%20startup%20code%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22lukaszadrapa_2-1718861539171.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lukaszadrapa_2-1718861539171.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F284992i78F33A39FA7B5DB4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22lukaszadrapa_2-1718861539171.png%22%20alt%3D%22lukaszadrapa_2-1718861539171.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3Estmw%20instruction%20is%20used%20-%20it%20writes%20all%20GPR%20core%20registers%20to%20RAM%20in%20a%20loop.%20That's%20the%20reason%20why%20you%20can%20see%20such%20pattern%20in%20the%20RAM.%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3ELukas%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E