When I comment out the #ifndef XIP_EXTERNAL_FLASH
check from mflash_drv_init_internal
function in file mflash_drv.c
, I no longer get these faults. I do not have the WiFi module and therefore cannot test the complete demo. @gammla, would you please do the same and share your results?
The updated definition of mflash_drv_init_internal
should be:
static int32_t mflash_drv_init_internal(void)
{
/* NOTE: Multithread access is not supported for SRAM target.
* XIP target MUST be protected by disabling global interrupts
* since all ISR (and API that is used inside) is placed at XIP.
* It is necessary to place at least "mflash_drv.o", "fsl_flexspi.o" to SRAM */
/* disable interrupts when running from XIP
* TODO: store/restore previous PRIMASK on stack to avoid
* failure in case of nested critical sections !! */
__asm("cpsid i");
//#ifndef XIP_EXTERNAL_FLASH
flexspi_config_t config;
/* Get FLEXSPI default settings and configure the flexspi. */
FLEXSPI_GetDefaultConfig(&config);
/* Set AHB buffer size for reading data through AHB bus. */
config.ahbConfig.enableAHBPrefetch = true;
config.ahbConfig.enableAHBBufferable = true;
config.ahbConfig.enableAHBCachable = true;
/* enable diff clock and DQS */
config.enableSckBDiffOpt = true;
config.rxSampleClock = kFLEXSPI_ReadSampleClkExternalInputFromDqsPad;
config.enableCombination = true;
FLEXSPI_Init(MFLASH_FLEXSPI, &config);
/* AHB Read Address option bit. This option bit is intend to remove AHB burst start address alignment limitation */
MFLASH_FLEXSPI->AHBCR |= FLEXSPI_AHBCR_READADDROPT_MASK;
/* Configure flash settings according to serial flash feature. */
FLEXSPI_SetFlashConfig(MFLASH_FLEXSPI, &deviceconfig, kFLEXSPI_PortA1);
//#endif
/* Update LUT table. */
FLEXSPI_UpdateLUT(MFLASH_FLEXSPI, 0, customLUT, CUSTOM_LUT_LENGTH);
/* Do software reset. */
FLEXSPI_SoftwareReset(MFLASH_FLEXSPI);
__asm("cpsie i");
return 0;
}
Thanks.