This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DMA for SPI master

I'm reading AD-converter data usin nRF51822 SPI-Master. BLE-stack is active so I can't use interrupts with SPI. I get data every 2 ms. Sometimes Events are delayed so long that I get erroneous data from AD.

Is there some way to implement DMA for the SPI-Master, maybe using SPI-slave some way?

Juha Okkonen

Parents
  • I have been trying to make implementation using two timers and spi slave device to handle data transfer every two milliseconds. One timer generates correct SCK for the SPI slave by toggling output pin. Second timer counts pulses and stops first timer. For some reason I can get correct output only if I run code in debugger by stepping source lines. If I just run without breakpoints nothing happens. And usually when stepping and things seem to work correctly otherwise ( I see correct pulse train on logicanalyzer ) debugging freezes immediately after starting both timers. Any ideas what's going on???

    Another question; how are functions wired into pins. Can I connect SPI:s SCK to same I/O-pin that timer is toggling. Or is only one function connected at a time. I have seen comments that behaviour is not specified if two different outputs are connected to same PIN, which would seem to implicate that what I want to do is possible. I also need to connect SPI:s CS to a pin thats configured for output.

Reply
  • I have been trying to make implementation using two timers and spi slave device to handle data transfer every two milliseconds. One timer generates correct SCK for the SPI slave by toggling output pin. Second timer counts pulses and stops first timer. For some reason I can get correct output only if I run code in debugger by stepping source lines. If I just run without breakpoints nothing happens. And usually when stepping and things seem to work correctly otherwise ( I see correct pulse train on logicanalyzer ) debugging freezes immediately after starting both timers. Any ideas what's going on???

    Another question; how are functions wired into pins. Can I connect SPI:s SCK to same I/O-pin that timer is toggling. Or is only one function connected at a time. I have seen comments that behaviour is not specified if two different outputs are connected to same PIN, which would seem to implicate that what I want to do is possible. I also need to connect SPI:s CS to a pin thats configured for output.

Children
No Data
Related