AnsweredAssumed Answered

SPI TX trouble on F4

Question asked by woolston.jared on Aug 14, 2014
Latest reply on Oct 9, 2014 by Montassar BEN ROMDHANE
I have an SPI setup using DMA transfers that works for a while, and then reaches a point where the data that is passed to the DMA transfer is not what is sent over the SPI lines. Typically, I am able to successfully make a dozen or so transfers in each direction, then at some point (it varies) when I try and perform a transmit as an SPI slave, the only byte which is sent is the last byte which was received. 

If I check the DMA transfer setup with the following code:
/* Enable the Tx DMA Stream */
printf("Starting DMA TX Transfer for count: %" PRIu16 " From Address %p\n\r", hspi->TxXferCount, hspi->pTxBuffPtr);
HAL_DMA_Start_IT(hspi->hdmatx, (uint32_t) hspi->pTxBuffPtr, (uint32_t) &hspi->Instance->DR, hspi->TxXferCount);
printf("DMA Source: %p\tSPI DR: 0x%02" PRIX8 "\n\r", hspi->hdmatx->Instance->M0AR, hspi->Instance->DR);
I get exactly what I would expect. The DMA source is correct, and the DR contains the first byte of the buffer to be sent, however, when I examine the transmission with a logic probe, The transfer consists of the last received byte, for the length of the transfer. Perhaps even more interesting is that the transfer complete for the DMA is never raised. The DMA has the highest priority preemption interrupt in the system with the exception of SYSTICK. 

Does anyone have any advice on where or how I might determine what is causing this? I'm confused because it all works fine for a while and then suddenly fails like this.