Hello,
i can't get lpspi with dma to work. I have looked into many example projects and community posts, but it doesnt seem to fix my problem. A lot of posts and examples are for the s32k344 or similar. I think i am missing something for the S32k396. Here are my settings. I am using the S32K3 Real-Time Drivers AUTOSAR R23-11 Version 7.0.0.
SPI works fine when i disable DMA. So the Pins and Ports should be correct.
Mcl:
i have enabled DMA support.
Luis1_2-1780050952661.png
Luis1_3-1780050990062.png
same with Rx, just different names ("Tx" -> "Rx")
Mcu:
In Mcu/McuModuleConfiguration/McuModeSettingConf/McuPeripheral i have enabled the peripheral clocks for: eDMA, eDMA_TCD_0 and eDMA_TCD_1, DMAMUX_0, LPSPI_1.
RM:
I enabled the dma mux support and enabled global init.
Luis1_4-1780051351639.png
SPI:
Luis1_5-1780051429008.png
Luis1_6-1780051448572.png
Luis1_7-1780051515307.png
IntCtrl_Ip:
Luis1_8-1780051677533.png
And finally my init:
//initialization of the MCAL Autosar drivers
//CLK
if(Clock_Ip_Init(&Mcu_aClockConfigPB_BOARD_InitPeripherals[0]) == CLOCK_IP_ERROR){
return false;
}//else CLOCK_IP_SUCCESS
//MCU
Mcu_Init(&Mcu_Config_BOARD_InitPeripherals);
//Port
Port_Init(&Port_Config_BOARD_InitPeripherals);
//Interrupts
if(IntCtrl_Ip_Init(&IntCtrlConfig_0) == INTCTRL_IP_STATUS_ERROR){
return false;
}
//DMA
Rm_Init(&Rm_Config_BOARD_INITPERIPHERALS);
Mcl_Init(&Mcl_Config_BOARD_InitPeripherals);
//LPSPI1
Lpspi_Ip_StatusType lpspi_status = Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_1_Instance_1_BOARD_InitPeripherals);
if(lpspi_status==LPSPI_IP_STATUS_SUCCESS){
Lpspi_Ip_UpdateTransferMode(Lpspi_Ip_DeviceAttributes_SpiExternalDevice_1_Instance_1_BOARD_InitPeripherals.Instance, LPSPI_IP_INTERRUPT); //transfer: interrupt
Lpspi_Ip_UpdateLsb(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_1_Instance_1_BOARD_InitPeripherals, 0); //0=MSB (big endian)
}else
return false;
For sending i use something like this:
Lpspi_Ip_AsyncTransmit(&Lpspi_Ip_DeviceAttributes_SpiExternalDevice_1_Instance_1_BOARD_InitPeripherals,
tx_buffer,
rx_buffer,
1,
lpspi1_callback
);
Thank you for helping!
Luis