Hi,
this bug has another side effect.
In my case, I wanted to use SPI2.
Configuring the SPI2 interface leads to a HardFault, caused itself by a memory access to the main configuration register (SPI2->MCR).
The chip reacts so because SPI2 is not clocked, even though this is the first action performed by DSPI_MasterInit
To be clocked, the driver tries to recognise the SPI instance first:
uint32_t DSPI_GetInstance(SPI_Type *base)
{
uint32_t instance;
for (instance = 0; instance < FSL_FEATURE_SOC_DSPI_COUNT; instance++)
{
if (s_dspiBases[instance] == base)
{
break;
}
}
assert(instance < FSL_FEATURE_SOC_DSPI_COUNT);
return instance;
}
As pointed by Joel, FSL_FEATURE_SOC_DSPI_COUNT is set to 1. So this function exits the loop before trying to recognize the SPI instance.
In my case, it gets even worse: I use the NDEBUG parameters, so the assert functions is not doing anything. So even if the function failed to recognized a valid SPI instance, it returns the value 0, which is a valid SPI instance.
This then leads to enable the wrong SPI clock. Which will crash the chip when the code tries to go further with the initialization.
Since there is 3 SPI intstance on the chip I suggest to correct FSL_FEATURE_SOC_DSPI_COUNT to value 3.