K64 SRAM Use

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

K64 SRAM Use

1,208 Views
ahmedhrabi
Contributor III

Hi Everyone,

I am working on the K64 and I have some questions about the use of SRAM. I already consulted the links below, but I still have some ambiguities:

   1-When i have done a memcpy of a buffer from SRAM_U to SRAM_L the system crashed.

   2-The Cortex M4 ref Manual mentionned that the SRAM section starts from the adress 0x20000000 and can have    0.5GB as size:

SRAM M4.PNG
   So why we don't use a unique sram block of 256Kb starting from 0x20000000 ?

   3-Can i use the totality of the SRAM_U and SRAM_L ? There's no risks? (apart misaligned variable declaration of course)


Links:
https://community.nxp.com/message/844720?commentID=844720#comment-844720
https://mcuoneclipse.com/2013/07/10/freertos-heap-with-segmented-kinetis-k-sram/
https://community.nxp.com/thread/336126
https://community.nxp.com/thread/384917

Best Regards.

Labels (1)
3 Replies

810 Views
nxf51211
NXP Employee
NXP Employee

Hi all,

1. Besides what Mark said, it is also important to make sure that any object is not stored by overlapping both SRAM sections (just like it is mentioned in the discussion from the community you checked: https://community.nxp.com/thread/437160?commentID=844720#comment-844720). This last issue doesn't happen if you use MCUXpresso (the IDE helps you fix the issue).

2a. In the following table from the k64 Reference Manual you can check that indeed it can only be used up to 256k. The memory map you used refers to how much memory the M4 could handle, not how much it has:

pastedImage_11.png

2b. Due to design reasons, you cannot use a unique SRAM block of 256Kb starting from 0x20000000; the k64 is designed with a Harvard architecture and is set with SRAM_L accesible by the code bus and SRAM_U accessible by the system bus (these buses access the memories through the addresses set for the k64).

3. You can indeed use the totality of the SRAM_U and SRAM_L as long as you remember the precautions you must take that were mentioned by Mark and myself.

I hope this information can help you.

Ricardo Delsordo

810 Views
ahmedhrabi
Contributor III

Hi all, 

To the first point i will investigate the reason of the crash, and for the other points, it's clear to me. Thank you for helping.

Best Regards, 

Ahmed HRABI. 

0 Kudos

810 Views
mjbcswitzerland
Specialist V

Hi

1. There is no reason why a memcpy() of data from SRAM_L to SRAM_U would generally crash so check your test to ensure that it isn't trying to write beyond the end of memory, overwriting other variables or stack.

2. This is a question that Freescale needs to answer (I also don't know what addresses below 0x20000000 are used by SRAM in the Kinetis parts)

3. The K64 has 256k and all can be used.

Regards

Mark

Complete K64 solutions, training and support:http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html