I have a board using a LPC55S06 and a Winbond W25Q32 connected to the HS SPI interface.
CLOCK_SetClkDiv(kCLOCK_DivFrohfClk, 0U, true); /*!< Reset FROHFDIV divider counter and halt it */
CLOCK_SetClkDiv(kCLOCK_DivFrohfClk, 2U, false); /*!< Set FROHFDIV divider to value 2 */
CLOCK_AttachClk(kFRO_HF_DIV_to_HSLSPI); /*!< Switch HSLSPI to FRO_HF_DIV */
//CLOCK_AttachClk(kMAIN_CLK_to_HSLSPI);
RESET_PeripheralReset(kHSLSPI_RST_SHIFT_RSTn);
spi_master_config_t master_config = {0};
SPI_MasterGetDefaultConfig(&master_config);
master_config.sselNum = (spi_ssel_t)0;
master_config.sselPol = (spi_spol_t)kSPI_SpolActiveAllLow;
master_config.baudRate_Bps = 12000000U;
uint32_t clk = CLOCK_GetHsLspiClkFreq();
SPI_MasterInit(SPI8, &master_config, CLOCK_GetHsLspiClkFreq());
Stepping through the code the MCU crashes when it returns from FLEXCOMM_GetInstance. I have tried a few difference baud rates.
uint32_t FLEXCOMM_GetInstance(void *base)
{
uint32_t i;
pvoid_to_u32_t BaseAddr;
BaseAddr.pvoid = base;
for (i = 0U; i < (uint32_t)FSL_FEATURE_SOC_FLEXCOMM_COUNT; i++)
{
if (BaseAddr.u32 == s_flexcommBaseAddrs[i])
{
break;
}
}
assert(i < (uint32_t)FSL_FEATURE_SOC_FLEXCOMM_COUNT);
return i;
}
When this routine runs i is 8 as is FSL_FEATURE_SOC_FLEXCOMM_COUNT when it gets to the assert line. If i step into this line I get the following line in the debugger console
[Inferior 1 (Remote target) exited normally]
Any idea what causes this?