Trying to initialise the SEMC when the M7 core runs with a high clock frequency does lead to a crash of the CPU that I can't recover from (even JTAG doesn't work anymore). A power-cycle is required.
I have set up access to an external SRAM and an exteran SDRAM. Both access work when having the M7 core clock configured to 336 MHz and the SEMC clock to 198 MHz (no SEMC configuration patch). Changing the configured M7 core frequency of the project to 672 MHz does lead to the aforementioned crash.
All clocks are configured once on startup:
SEMC clock config from the MCUXpresso Config Tools:

Working M7 core clock config:

Core M7 clock config that leads to the crash:

The SEMC is configured for SRAM as follows:
void ext_sram_semc_init(void)
{
uint64_t root_clock_hz = CLOCK_GetRootClockFreq(kCLOCK_Root_Semc);
double clock_cycles_per_ns;
semc_config_t sdk_base_config;
semc_sram_cs_t sram_cs_pin;
semc_sram_config_t sdk_sram_config;
memset(&sdk_base_config, 0, sizeof(semc_config_t));
SEMC_GetDefaultConfig(&sdk_base_config);
SEMC_Init(SEMC, &sdk_base_config);
memset(&sdk_sram_config, 0, sizeof(semc_sram_config_t));
sram_cs_pin = kSEMC_SRAM_CS0;
sdk_sram_config.address = 0x98000000;
sdk_sram_config.cePinMux = kSEMC_MUXCSX0;
sdk_sram_config.memsize_kbytes = (512 * 16) / 8; // 8MBit = 512*16*1KBits = 1MB
sdk_sram_config.addrPortWidth = 19; //Address pins A0..A18
sdk_sram_config.advActivePolarity = kSEMC_AdvActiveLow;
sdk_sram_config.addrMode = kSEMC_AddrDataNonMux;
sdk_sram_config.burstLen = kSEMC_Nor_BurstLen1;
sdk_sram_config.portSize = kSEMC_PortSize16Bit;
sdk_sram_config.syncMode = kSEMC_AsyncMode;
sdk_sram_config.waitEnable = false;
sdk_sram_config.waitSample = false;
sdk_sram_config.advLevelCtrl = kSEMC_AdvLow;
sdk_sram_config.tCeSetup_Ns = 0;
sdk_sram_config.tCeHold_Ns = 3;
sdk_sram_config.tCeInterval_Ns = 10;
sdk_sram_config.readHoldTime_Ns = 0xFF;
sdk_sram_config.tAddrSetup_Ns = 0;
sdk_sram_config.tAddrHold_Ns = 10;
sdk_sram_config.tWeLow_Ns = 8;
sdk_sram_config.tWeHigh_Ns = 0;
sdk_sram_config.tReLow_Ns = 6;
sdk_sram_config.tReHigh_Ns = 5;
sdk_sram_config.tTurnAround_Ns = 3;
sdk_sram_config.tAddr2WriteHold_Ns = 0;
sdk_sram_config.tWriteSetup_Ns = 0;
sdk_sram_config.tWriteHold_Ns = 0;
sdk_sram_config.latencyCount = 0;
sdk_sram_config.readCycle = 0;
sdk_sram_config.delayChain = 10;
SEMC_ConfigureSRAMWithChipSelection(SEMC, sram_cs_pin, &sdk_sram_config, root_clock_hz);
}
Why does the CPU crash hard when I use the higher M7 core frequency and try to init the SEMC? The SEMC SDK function calls does finish but the crash happens immediately afterwards. How can I prevent the crash?