Hello everyone,
I am trying to use the processor expert spi pal to initialize a slave spi instance on the LPSPI2 pins.
When doing this, however, the code gets stuck on the:
SPI_SlaveInit(SPI_OVER_LPSPI02_INSTANCE, &SlaveConfig0);
function.
More specifically on the:
status = LPSPI_DRV_SlaveInit(instance, (lpspi_state_t*)(&LpspiState[index]), &lpspiConfig);
fucntion of spi_pal.c and
(void)LPSPI_SetMasterSlaveMode(base, LPSPI_SLAVE);
of lpspi_slave_driver.c.
Afterwhich the WDOG_EWM_IRQHandler() is called.
This happens for all projects I create and also the basic spi_pal_s32k144 example project where the spi2 component is changed to LPSPI2 and in the SPI_SlaveInit the instance is changed to "SPI_OVER_LPSPI02_INSTANCE". See modification steps from the images below. LPSPI0 and LPSPI1 are working fine.
Is this a bug in the Processor Expert code or am I doing something wrong. Any help would be appreciated.
Kind regards,
Sebastiaan
Solved! Go to Solution.
Hello Sebastiaan,
Thank you for your details. In that case, I would like to recommend you to use the newest SDK version.
(if your application requirements allow it)
S32 Design Studio for ARM 2018.R1 - Update 9 available
After that, you can try that spi_pal_S32K144 example with LPSPI2 works without problem.
I hope it helps.
Best Regards,
Diana
Hello Sebastiaan,
I have checked the spi_pal_S32K144 example. The SPI_SlaveInit function expects as the first parameter type (const spi_instance_t * const instance,...)
So, I'm not sure why you change the &spi2Instance in the function SPI_SlaveInit(&spi2Instance, &SlaveConfig0);
Which SDK version do you use?
If I change the LPSPI2 in the spi2 component the generated code change also index of the instance.
I hope it helps.
Best Regards,
Diana
Hello Diana,
Thank you for your response.
I am using the following versions:
For me spi2.c does not contain an instance definition. Instead in the spi_pal_mapping.h the following enum is defined:
For me the original code of the example can be seen below:
So I simply change the last 0 into a 2 to match the correct instance.
Kind regards,
Sebastiaan
Hello Sebastiaan,
Thank you for your details. In that case, I would like to recommend you to use the newest SDK version.
(if your application requirements allow it)
S32 Design Studio for ARM 2018.R1 - Update 9 available
After that, you can try that spi_pal_S32K144 example with LPSPI2 works without problem.
I hope it helps.
Best Regards,
Diana