AnsweredAssumed Answered

RT1020-EVK: FreeRTOS + USB + SDRAM = HardFault

Question asked by Eduard Vaselo on Aug 30, 2019
Latest reply on Sep 2, 2019 by Eduard Vaselo

Hello,

 

I am trying to setup a MIMXRT1020-EVK project using MCUXpresso and SDK-2.6.1. I want to use SDRAM since my project will use large amounts of memory. The RAM usage is already quite high when I add LWIP and USB stacks to the project.

 

The only working example with SDRAM I found is 'lwip_httpscli_mbedTLS_freertos' which seems to include the correct implementation of SDRAM, however I had to modify the .scp connect script to include memory initialization routines for it to start debugging at all (POKE32 & PEEK32 commands, to correspond to what is done in this SDRAM driver (Edit: Correction: from dcd_data in evkmimxrt1020_sdram_ini_dcd.c) or else it goes to Hard Fault upon debug.

 

With USB stack, the situation gets more problematic. I tried to accommodate USB to no avail. There was a similar issue in early 2019 with RT1050 and the older SDK 2.5.x that was discussed here https://community.nxp.com/thread/497440
Preprocessor defines added as per the recommendations in the last post:


SKIP_SYSCLK_INIT
XIP_BOOT_HEADER_DCD_ENABLE=1

Also,

BOARD_SDRAM and BOARD_SDRAM_NONCACHEABLE are listed first and split 30MB : 2MB as described in that thread.

 

FreeRTOSConfig.h is also the same as in the 'lwip_httpscli_mbedTLS_freertos' example.

 

I get HardFaults whenever I try to use USB stack in the project that has the SDRAM setup. It does not seem to enter the main loop; at times it is stuck in SystemInit() on SystemInitHook(), and sometimes goes to 0x0 with INVSTATE Hard Fault.

 

What else do I need for RT1020 + FreeRTOS + USB to work with SDRAM? This use case seems to be quite obscure, as there are user manuals for each of these separately, but I found none that would mention these concepts together.

Outcomes