I try to setup SPI to transmit/receive 8 bytes of data with one CS, and perform 4 of such transfers in sequence as quick as possible. S/W should only need to setup rx/tx buffers uint8[32] and call a non-blocking function to start entire communication. Sending/receiving of 32 bytes and generating 4 CS signals expected from the H/W.
It appears that I want to use dma scatter/gather with minor loop of 8 and major loop at 4. (Wonder if that is the best way?) But setup of Lpspi and Dma-Ip components are not very intuitive and I can't get needed functionality.
Perhaps any example or a similar setup exists to study?
I don't see any SPI activities, CS and CLK are at passive level.
Ports setup should be OK because earlier I saw proper communication, when I tried SPI configuration for sending a single byte without DMA.
If you define callback to Lpspi_Ip_AsyncTransmit call, do your code get to that point?
Also I haven't seen whether you have defined callback in DMA configuration. Maybe it would be better to share screenshots from S32DS screens.
I didn't define a callback for transmit. I much prefer to avoid it, if it is possible
Config setup and code is in SPI_DMA_Setup1.xlsx
Note: Lpspi_Ip_AsyncTransmit() does not do anything to SPI (first call returns SUCCESS, further returns BUSY)
I tried Dma_Ip_SetLogicChannelCommand(DMA_LOGIC_CH_0, DMA_IP_CH_SET_SOFTWARE_REQUEST)
That call causes CS go active and one byte of data shifted out. Other bytes are not coming out and CS stays active forever.
You don't have checked 'Enable DMAMUX Source' and 'Enable DMA Request' in both DMA Logic channel configurations.
Thank you, that works a little better (I can see 32 bytes transmitted) but unfortunately not quite as needed.
Lpspi_Ip_AsyncTransmit only works once, getting 32 bytes out, other calls return FAIL and no SPI activity
CS goes active as expected but never goes back to passive level (when SpiCsContinous=TRUE)
I tried SpiCsContinous=FALSE, then CS goes active/passive for each byte. That is not right, I need to send 32 bytes with one CS
It appears that SpiCsContinous=TRUE is a correct configuration.
It also appear that one minor loop is executed once and not completed successfully (since CS stays active) and it never gets to major loop.
You need to add Interrupt Callback, pay attention here:
https://community.nxp.com/t5/S32K/LPSPI-Chip-Select-always-is-LOW-active-state/m-p/1563159
SW pointers to transmit/receiver buffer are somehow different between 4 data batches or why you need to use scatter/gather? According to you description I don't see a reason for this.
Minor Loop count = 8 and Major loop Count = 4 seems to be right option for such transfer.
OK. What is the behavior you are facing?