Hi,
I am using MK66FN2M0VLQ18 MCU and MCUXpresso IDE v11.5.0 [Build 7232] [2022-01-11] for my testing. My board are designed with 32M SDRAM(ADDR=0x70000000) and 32M FLASH(ADDR=0x60000000). I want to use SDRAM as HEAP, and some application and use FLASH as program.
Can anyone tell me how configure SDARM and FLASH by using MCUXpresso IDE?
Thanks,
Christie
已解决! 转到解答。
Hello Christie
You can try by modifying the Reset_ISR function and running your SDRAM initialization code from here.
You can find the Reset_ISR function in the file located in the startup folder of your project.
Can you please try this on your code?
Just be careful when modifying these parts of code because any strange change may cause problems in the MCU.
Regards, Daniel.
Hi,
I tried to use the following definition to set variables in specified SDRAM section:
#include <cr_section_macros.h>
__DATA(RAM4) char data_buffer[1024]; // in SDRAM section
It is all right after I compiled and checking the map file.
But, when I start running, I got hard-fault.
When I use SDRAM as heap stack, it works fine...
I think it may be related to SDRAM initialization because SDARM initialization is done later(after startup)?
Can anyone tell me how to fix this issue, initialize SDRAM earlier, or initialize variables later?
Thanks,
Christie
Hello Christie
Could you please verify that you have the SDRAM Controller enabled?
You can take a look on chapter 35 of the reference manual for more information about the Synchronous DRAM Controller Module.
Here are some links that might help you:
https://www.nxp.com/docs/en/application-note/AN5095.pdf
https://community.nxp.com/t5/Kinetis-Microcontrollers/MK66-SDRAM-databus-lost/td-p/619453
https://community.nxp.com/t5/Kinetis-Microcontrollers/K66F-16-bit-SDRAM/td-p/616441
Best regards, Daniel.
Hi Daniel,
if I use __NOINIT(RAM4) instead of __BSS(RAM4), it works fine because SDRAM is not initialized in start_up routine.
I did SDRAM initialization after start_up routine, then I can initialize variables in SDRAM.
How can do SDRAM initialization before start-up routine, then all variables in BSS can be initialized in start-up routine?
Thanks,
Christie
Hello Christie
You can try by modifying the Reset_ISR function and running your SDRAM initialization code from here.
You can find the Reset_ISR function in the file located in the startup folder of your project.
Can you please try this on your code?
Just be careful when modifying these parts of code because any strange change may cause problems in the MCU.
Regards, Daniel.
You can refer to my two blogs (it is in Chinese) on MCUX linker file topic