Thank you for your sampling code for a DSPI driver ( MPC5777M DSPI_SimpleTXRX S32DS)
Is it possible to provide also an example or tips to use DMA to fill the TX FIFO ? In particular, is it possible to fill the TX command part of the PUSHR register only one time and then fill the TX data part of this register with DMA
Best regards.
Paulo
Hi Paulo,
Yes, it is possible to initialize PUSHR register by SW and then use DMA for loading any additional data into this register.
There is actually not a specific example for this case, however you can have a look at MPC5 software example list and use MPC5744P or MPC5775K DMA example or any other of MPC57xx.\
There is already posted MPC5775K DMA example for S32DS by Martin Kovar.
Just have a look on it, take AIPS and DMA initialization routines and use them for your project. This should be smooth and without any additional effort.
Peter
Hello Peter and thank you for your answer.
I've had a look to the examples and I've tried to set a transfer with the following configuration:
input source buffer (src) has a size of N*2 bytes
DMA configuration:
SADDR : src
SLAST : src + N*2
SOFF : 2
DADDR : 0xFBE78036 (PUSHR register + 2)
DLASTSGA : = DADDR
DOFF : 0
ATTR : 0x0101 => source buffer is 16bits and destination buffer is 16bits
NBYTES.MLNO : 2
BITER.ELINKNO = CITER.ELINKNO = N
SPI configuration:
MCR.XPI = 1
CTARE.DTCP = N*2
CTARE.FMSZE = 1
CTAR.FMSZ = 0xF
Unfortunately, it seems that the frame sent is not correct.
The expected data to be sent is for example 0xabcdef99 followed by 0x12345678 and the observed sent frame is
0xAB 0xCD 0x00 0x00 0x12 0x34 0xEF 0x99 ...
Have you any idea of what is the mistake in the upper configuration ?
Best regards.
Paulo
Hi,
Why would you do 2x*16-bit transfers?
The PUSHR register is 32-bit.
You have to use 32-bit writes. Otherwise you will send out data with unknown command (chip select, timing, etc..)
Peter
Hello Peter,
I've supposed that having set one time the PUSHR TX command field before doing the DMA transfer, then I need only to write my data into the TX data field which have a size of 16bits. My understanding is that if I make a 32 bits transfer with DMA then the TX command field is overwritten at each cycle.
My goal is to set once the TX command field and then do the DMA transfer for performances. Otherwise, I need to perform first a "for loop" to copy my data into a buffer buff containing the TX command and the TX data and then transfer this buffer buff by DMA using 32 bits transfer which already works in my application.
Regards.
Paulo
Hi,
Honestly this is an application problem.
You have to write to PUSHR register full 32-bits each time.
If you use SW for buffer preparation or another DMA channel, this is on you.
Peter