2014-09-10 04:13 AM
Goodmorning,
I would like to use, on the STM32420Disco demo board, the external SDRAM as data memory.The FMC example present on the STD lybrary is not taylored to work properly on the disco board, so I have imported the necessary functions to init the memory, the FMC and the relative I/O, from the FMC_SDRAM example dedicated for the disco board.The problem is that as soon as I run the program from the main the micro is pushed into an fault_Hardware handler.Can somebody help me?Thanks2014-09-10 05:33 AM
Well I'm not clear on what tool chain you're using here, or how you're directing data into SDRAM, but you will want to make sure the initial stack is NOT put in SDRAM, and ideally should always be in SRAM due to it being faster and more efficient.
2014-09-10 05:44 AM
I am using EWARM. I have changed the start up file as suggested:
__initial_spTop EQU 0x20000400 ; stack used for SystemInit & SystemInit_ExtMemCtl MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA__vector_table DCD __initial_spTop ; Use internal RAM for stack for calling SystemInit DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD DebugMon_Handler ; Debug Monitor Handler DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handlerin this way the stack should be at 0x20000400 I am also using the stm32f4xx_flash_extsdram.icf as configuration file for the linker.2014-09-10 07:25 AM
I have noted that the SP is not moved to the internal SRAM, also I use a modified start-up file. It is placed in the external SDRAM, this may be cause a fault because as soon the sistem init function run, its stack is placed on the external memory that is still not properly initilized... please, How I can solve this problem?
2014-09-10 07:46 AM
Code called by SystemInit() should configure the external memory and interfaces. You should make sure you have code, or have enabled code, to initialize the SDRAM. After SystemInit() returns you should be able to set the stack, access SDRAM and call cstartup.
As I said putting the stack in SDRAM is inefficient, you should review the segment placement, and settings in the linker script (.ICF) so the stack object is placed in the SRAM not the SDRAM. Note: I primarily use Keil and GNU/GCC, not IAR but the concepts should be the same. Assume I don't know what's in your specific .ICF file.2014-09-10 08:09 AM
I have the code to set the SDRAM into SistemInit() function. I have right selected the option to use the external SDRAM as data memory. If I try to use the SDRAM just to write or read from a location it works fine, so I can be confidente that the int code for the memory is working fine, the problem is if I try to use it as data memory.
To do this, I set the IAR toolchain project->options..->linker -> config edit the memroy region I would like as ROM and RAM.As start-up file called startup_STM32F429_439xx.s I use the one suggested into the readme.txt file. It should allocate the stack for the SistemInit() function inside the internal RAM, but it doesn't work!!!Is there a complete workspace example to make run the SDRAM on the STM32420DISCO, as data memory?? ( this is the real issue...!!)