Hi everyone,
I amb working on SPI with DMA.
Without using DMA with “Lpspi_Ip_SyncTransmit” the transmission works properly but when I use “Lpspi_Ip_AsyncTransmit” only 6 bytes are sent and the transmission never ends.
I attach code:
uint8 u8_frame_reset [] = {102, 170, 170, 170, 170, 170, 166, 166, 255};
int main(void)
{
/* Initalized clock */
Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
/* Initalized pin */
Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
/* Initialize interrupt */
IntCtrl_Ip_Init(&IntCtrlConfig_0);
IntCtrl_Ip_ConfigIrqRouting(&intRouteConfig);
/* Initialize DMA IP} Driver */
(void)Dma_Ip_Init(&Dma_Ip_xDmaInitPB);
/* Initalized spi using instance lpspi as a spi slave */
Lpspi_Ip_Init(&Lpspi_Ip_PhyUnitConfig_SpiPhyUnit_0_Instance_0_BOARD_InitPeripherals);
error = Lpspi_Ip_AsyncTransmit(&MASTER_EXTERNAL_DEVICE, u8_frame_reset, NULL, sizeof(u8_frame_reset), spi_callback);
while(1){
}
return 0;
}
And configuration:
If I try to send 2 bytes, the bytes are sent but the transmision never ends.
No callbacks.
Hi,
The issue is related to TX and RX of SPI.
Is allowed config TX with DMA and RX as interrupt?
Thank you,
Sergi
I'm sorry for the delay, I have been overloaded the last couple of days.
If you only need to send but not receive (you fill NULL for RxBuffer), then you can use half duplex transfers(refer to Lpspi_Ip_HalfDuplexTransfer_S32K312).
Hi Robin,
I think that isn't the same case. I will try to explain in more detail.
I want SPI x4 with DMA. But I have only 6 DMAs for SPI. Every SPI has Tx and Rx so I need 8DMAs.
I only need DMA for Tx channels so my idea is work with 4 SPIs Tx with DMA and Rx without DMA, by simple interrupt. But the S32Design Studio configurator doesn't allowed it.
Are there any possible solution without change microcontroller to get this?
- SPI Tx with DMA x4
- SPI Rx x4 (DMA not needed)
Regards,
Sergi.
But the S32CT will report Issue: The SpiPhyUnitAsyncUseDma is checked, it implies that the DMA channels are activated and selected. Please enable SpiPhyTxDmaChannel, SpiPhyRxDmaChannel.
Hi
See the discussion in LPSPI Chip Select always is LOW (active state), where the project Lpspi_Flexio_Ip_Transfer_S32K344_Update.7z may help.
Best Regards,
Robin