MPC5777C EB Tresos SPI module configuration field issue

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

MPC5777C EB Tresos SPI module configuration field issue

4,241 次查看
vaibhav_sharma
Contributor III

Hi,

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?

pastedImage_3.png

pastedImage_2.png

Thanks in advance!!

标签 (1)
0 项奖励
回复
9 回复数

3,983 次查看
namnguyenviet
NXP Employee
NXP Employee

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:

DMASPI.JPG

SPIPHY_DMA.JPG

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).

0 项奖励
回复

3,983 次查看
vaibhav_sharma
Contributor III

Hi Team NXP,

Awaiting response!!

0 项奖励
回复

3,983 次查看
namnguyenviet
NXP Employee
NXP Employee

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.

Nam

0 项奖励
回复

3,589 次查看
Simin
Contributor II

hi,

    Based on Autosar MCAL SPI SRS、SWS document,there is not requirement for using DMA,Does

EB tresos SPI configuration DMA which is comply with AUTOSAR standard?

Best regards,

Simin

标记 (4)
0 项奖励
回复

3,983 次查看
vaibhav_sharma
Contributor III

Hi Nam,

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.

0 项奖励
回复

3,983 次查看
namnguyenviet
NXP Employee
NXP Employee

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?

0 项奖励
回复

3,983 次查看
vaibhav_sharma
Contributor III

Hi Nam,

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! 

0 项奖励
回复

3,983 次查看
namnguyenviet
NXP Employee
NXP Employee

Hi,

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.

0 项奖励
回复

3,983 次查看
vaibhav_sharma
Contributor III

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], 32)' & 'Spi_Dspi_au8DmaTcdTxLastArray[SPI_MAX_HWUNIT][32], 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!!

0 项奖励
回复