cancel
Showing results for 
Search instead for 
Did you mean: 

Mixed DMA RX, polled TX SPI

frackers
Senior
Posted on September 13, 2016 at 03:23

I already know the HAL firmware doesn't support this but is this due to the bad programming of the HAL or inadequacies of the hardware?

I'm interfacing to an external NOR flash device but have run out of DMA channels to have both TX as well as RX running under DMA. Saving data is not time critical, reading (getting sound samples in particular) is, hence the requirement to use DMA on receive only. Note - this is NOT RXONLY mode, as TX is still required.

The HAL_SPI_Receive_DMA function assumes if not RXONLY then DMA both ways but if only one DMA channel is assigned it crashes with a hard fault trying to set the non-existent transmit callbacks (it doesn't check to see if it has one!!).

Has anyone used the old(er) std-periph-lib for SPI RX DMA but polled TX ?

3 REPLIES 3
michaelc.barton9
Associate II
Posted on September 14, 2016 at 09:39

Messing around with a TFT Display ILI9341 and had mixed - polling (RX) + DMA (TX) - working fine at the same time.

It's opposite to what you're wanting to do but pretty sure it would make zero difference whichever way.

frackers
Senior
Posted on September 16, 2016 at 00:16

Although you were using polled mode in one direction, did you assign DMA for both directions because that is where it all goes pear shaped for me!

michaelc.barton9
Associate II
Posted on September 16, 2016 at 16:36

oh ok, I see what you're doing now, I misunderstood !

yeah, I'm doing a TX transfer (to the LCD) via DMA but also setting up an RX DMA transfer to receive the data back via MISO line

I'm guessing it's probably unlikely to work trying to receive the data back via polling ....