I've got an LPC54S016 set up as an SPI slave on Flexcomm 0 using the standard settings on the Peripherals setup page.
I'm sending a 512 byte packet of data from the transmitter to the LPC, and simultaneously transmitting a 512 byte packet back from the LPC to the transmitter.
The LPC is receiving the packet correctly, but when transmitting, it will occasionally transmit a duplicate of the first byte, and omit the last.
The packet transmitted from the LPC consists of the repeated string "fedcba9876543210"
This is what I'm receiving. As you can see the first byte is duplicated on the first packet, and not on the second:

I've checked the signal with a logic analyzer, and can see the repeated byte going over the wire, so it does seem to be generated by the LPC, and not an artefact of the receiver.
I found this problem regarding the K22, and wondered if the LPC54 series had the same problem, and if so what the solution is: https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-DSPI-in-Slave-Mode-Sometimes-Has-Duplicate...
I tried clearing the TX and RX FIFOS in the DMA callback, and it didn't seem to do anything.
Any ideas?