S32K148 SPI Slave with Real Time Driver

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

S32K148 SPI Slave with Real Time Driver

Jump to solution
2,540 Views
wkim
Contributor II

Hello,

I am trying to set up a simple routine for the S32K148 EVB to act as a SPI-Slave. My issue is with the functions from the Lpspi_Ip. Following version is used:

* Project : RTD AUTOSAR 4.4
* Platform : CORTEXM
* Peripheral : LPSPI
* Dependencies :
*
* Autosar Version : 4.4.0
* Autosar Revision : ASR_REL_4_4_REV_0000
* Autosar Conf.Variant :
* SW Version : 1.0.0
* Build Version : S32K1_RTD_1_0_0_D2108_ASR_REL_4_4_REV_0000_20210810

 

I have tried implementing following functions:

/* Initalized clock */
Clock_Ip_Init(&Mcu_aClockConfigPB[0]);

/* Initialize interrupt */
IntCtrl_Ip_Init(&IntCtrlConfig_0);
IntCtrl_Ip_ConfigIrqRouting(&intRouteConfig);

/* Initalized spi using instance lpspi as a spi slave */
Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_0_BOARD_InitPeripherals);

/* Update Transfer Mode */
Lpspi_Ip_UpdateTransferMode(SLAVE_EXTERNAL_DEVICE.Instance, LPSPI_IP_INTERRUPT);

/* Slave set up and waiting active signal of Cs from master to process data reception */
Lpspi_Ip_AsyncTransmitHalfDuplex(&SLAVE_EXTERNAL_DEVICE, RxSlaveBuffer, (uint16)NUMBER_OF_BYTES, LPSPI_IP_HALF_DUPLEX_RECEIVE, SpiCallBack);

I use an external device to send SPI-frames to the board. --> If I send something, the Lpspi_Ip_GetStatus(SLAVE_EXTERNAL_DEVICE.Instance); status stays BUSY. I am realy not sure how to aproach this properly.

Can you help me out somehow? 

Thanks in advance for your support!

0 Kudos
Reply
1 Solution
2,286 Views
wkim
Contributor II

Following sample could solve my issue. See attached file SPI_Slave_solved

 

Thank you for your assistance!

View solution in original post

0 Kudos
Reply
8 Replies
2,287 Views
wkim
Contributor II

Following sample could solve my issue. See attached file SPI_Slave_solved

 

Thank you for your assistance!

0 Kudos
Reply
2,338 Views
wkim
Contributor II

Hello @namnguyenviet,

I urgently need assistance. Your colleague @cuongnguyenphu does not seem to answer to my request. It is quite important, that we solve this issue, due to a deadline of our customerproject.

Regards,

Kim

0 Kudos
Reply
2,403 Views
wkim
Contributor II

Hello @namnguyenviet,

could you open my project? Is there any more information I can provide to you, so you can better understand my issue?

Thanks for you Help.

Kim

0 Kudos
Reply
2,501 Views
namnguyenviet
NXP Employee
NXP Employee

Hello @wkim,

Have you checked whether the interrupt handle could be called? 

Best Regards,

Nam

0 Kudos
Reply
2,463 Views
wkim
Contributor II

Hello @namnguyenviet,

thank you for your quick reply. And also a happy new year!

The interrupt handle is called without issues using following function:  Lpspi_Ip_IrqHandler(SLAVE_EXTERNAL_DEVICE.Instance);

Also I have added some void testFunction in the "generic interrupt settings" (LPSPI0_IRQn)

This function is also never called if my external device sends dome SPI commands.

Best Regards,

Kim

0 Kudos
Reply
2,458 Views
namnguyenviet
NXP Employee
NXP Employee

Hello @wkim,

I assumed you might have missed some interrupt installation. Can you share with me the project so I will check in my site?

Best Regards,

Nam

0 Kudos
Reply
2,455 Views
wkim
Contributor II

Hello @namnguyenviet,

sure. The project is in the 7zip file.

Thank you for your assistance.

Kim

0 Kudos
Reply
2,390 Views
cuongnguyenphu
NXP Employee
NXP Employee

Hi @wkim ,
I'm checking your issue on be half of @namnguyenviet

0 Kudos
Reply