S32K148 SPI Slave with Real Time Driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K148 SPI Slave with Real Time Driver

跳至解决方案
2,426 次查看
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 项奖励
回复
1 解答
2,172 次查看
wkim
Contributor II

Following sample could solve my issue. See attached file SPI_Slave_solved

 

Thank you for your assistance!

在原帖中查看解决方案

0 项奖励
回复
8 回复数
2,173 次查看
wkim
Contributor II

Following sample could solve my issue. See attached file SPI_Slave_solved

 

Thank you for your assistance!

0 项奖励
回复
2,224 次查看
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 项奖励
回复
2,289 次查看
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 项奖励
回复
2,387 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @wkim,

Have you checked whether the interrupt handle could be called? 

Best Regards,

Nam

0 项奖励
回复
2,349 次查看
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 项奖励
回复
2,344 次查看
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 项奖励
回复
2,341 次查看
wkim
Contributor II

Hello @namnguyenviet,

sure. The project is in the 7zip file.

Thank you for your assistance.

Kim

0 项奖励
回复
2,276 次查看
cuongnguyenphu
NXP Employee
NXP Employee

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

0 项奖励
回复