S32k144 LPSPI2 SPI Pal Processor expert

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k144 LPSPI2 SPI Pal Processor expert

Jump to solution
2,059 Views
s_verhoek
Contributor II

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.

SPI problem.PNGSPI problem2.PNG

Is this a bug in the Processor Expert code or am I doing something wrong. Any help would be appreciated.

Kind regards,

Sebastiaan

0 Kudos
1 Solution
1,467 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

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.

pastedImage_1.png

I hope it helps.

Best Regards,

Diana

View solution in original post

0 Kudos
3 Replies
1,467 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

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.

pastedImage_2.png

I hope it helps.

Best Regards,

Diana

0 Kudos
1,467 Views
s_verhoek
Contributor II

Hello Diana,

Thank you for your response.

I am using the following versions:

NXP_versions.PNG

For me spi2.c does not contain an instance definition. Instead in the spi_pal_mapping.h the following enum is defined:

NXP_enum.PNG

For me the original code of the example can be seen below:

NXP_original.PNG

So I simply change the last 0 into a 2 to match the correct instance.

Kind regards,

Sebastiaan

0 Kudos
1,468 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

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.

pastedImage_1.png

I hope it helps.

Best Regards,

Diana

0 Kudos