AUTOSAR MCAL Config tool: EB Tresos 20.1
MCAL Package: MPC5777C_MCAL4_0_RTM_HF5_1_0_1
Issue config field: SpiPhyTxDmaChannelAux in SpiPhyUnit tab
I configured 2 DMA channels (eDMA_A channel no. 12 & 13), each one for TFFF & RFDF handling of DSPI_B module, then assigned the Tx & Rx channel to the respective channels in SPI module. But what should be assigned to 'SpiPhyTxDmaChannelAux' field?
Thanks in advance!!
The SpiPhyTxDmaChannelAux is a secondary TX DMA channel used for sending internal prepared dataframes to the DSPI PUSH register. Basically you can use any DMA channel to be linked to that channel, here is an example:
Remember, after assigned a DMA channel for TX_AUX, that channel should not be used in any other DMA transfer, e.g. when eDMA_18 is used for TX_AUX DMA channel, it must not be used in any other eSCI or LIN DMA request (as how it's mapped in RM).
Hi Vaibhav Sharma,
Sorry for late reply. TCD is internally configured in MCAL SPI driver. So you don't need to configure it manually. Just make sure that you have called Mcl_Init before Spi Initialization, also I recommend to turn on Development Error Detect feature for easy checking.
Got your point.
But atleast the TxDMABuffer (Source address)must be updated somewhere by user, which will be put to PUSH register of SPI_B in my case, which is nowhere configured. Is there any API for this? How DMA_TCDn_SADDR register gets filled?
Already did this- MCL_INIT then SPI_INIT.
And whenever i'll need to communicate to EEPROM through SPI, I'll set the START bit of (DMA_TCDn_CSR) register.
Development error trace errors are switched on.
Hi Vaibhav Sharma,
My understanding here is TxDmaBuffer will be updated internally also, by configure TCD in Spi_Dspi_InitDma, then DMA will be enabled to start in Spi_Dspi_ChannelTransferDmaInit. DMA_TCDn_SADDR are get filled by calling Mcl_DmaConfigTcd in Spi_Dspi_InitDma.
May I ask if you're having any troubles?
1. Actually I am using MPC5777C in Slave mode of SPI. So transmission completion is shown by the RFDF flag rather than TCF flag; and Spi_Dspi_IsrRxDma_DSPI_B notification function is called eventually.
So where would be the DMA channel's destination address configured? Where will it put the data popping from the RxFIFO/ POPR? Specifically Spi_SetupEB() API needs to be called?
2. Please let me know the supported baud rates & Cs2Cs, Cs2Clk & Clk2Cs timing values when working in slave mode?
Thanks in advance!
1. If you're using Internal Buffer, you don't need to configure DMA channel's destination address, since it's configured internally. When the transmission is completed, just call Spi_ReadIB() with parameter as pointer to the array result, to store the result data.
In case of using External Buffer, you have to call Spi_SetupEB(), and pass the pointers, not only to the source address buffer, but also to the destination address buffer. When finished, result will be store in the destination buffer.
2. In slave mode, these parameters are un-used.
Thanks Nam for responding!
DMA with SPI configuration was done according to your suggestion.
But the DMA doesn't give the option to configure the TCD parameters. Why?
I found the API- 'Spi_Dspi_InitDma' which puts static values to the TCDs, & doesn't have the input TxBuffer which will be used to fill the PUSHR.
The pointer (pDspiDev in the API in static file) gets the configuration from 'Spi_Dspi_aDeviceState', but the latter is also not configured anywhere in the project & no API is provided to do so.
Could you plz let me know how to go forward, & if I fill the TCD manually, how can I fill the configurations fields of TCD for Aux channel? & significance of 'Spi_Dspi_au8DmaTcdTxArray[SPI_MAX_HWUNIT], 32)' & 'Spi_Dspi_au8DmaTcdTxLastArray[SPI_MAX_HWUNIT], 32)'.
Should I fill them manually too?
It would be good if you can share the zipped complete code or code snippets depicting the TCD filling for SPI communication using DMA!!