This thread is originally from https://forum.pjrc.com/threads/4811...rrupt-priorities-USB-transmit-buffer?p=160973 after Yannick's excellent insight that my problem may be solved best with DMA. I am creating a new one specifically about the possibility of using DMA.
What I have is a peripheral ADC which sends data to the Teensy by clocking out a serial clock along with eight parallel data lines. The peripheral is the serial master.
I am thinking now that what I need to do is connect the input signals to the Teensy such that the eight bits are aligned with a physical port, configure it to use DMA to transfer from the PORT to memory, and then set it up to trigger when it sees the edge of the incoming clock line.
I had never heard of DMA prior to today really, so I'd really appreciate some guidance on whether this makes sense and how to do it. I found:
https://github.com/PaulStoffregen/co...3/DMAChannel.h
https://forum.pjrc.com/threads/31541-Interrupt-Jitter
This look extremely promising, but I cannot seem to find documentation for the DMAChannel library and cannot quite follow how it works. It almost seems that if I do the pin connections right I can simply swap the source() and destination() when configuring the DMA and figure out what interrupt to assign to it for an edge trigger. But I don't understand what the transfer size and transfer count are.
I'm also curious if it is possible to turn off the DMA unless the data ready line from the peripheral is low. It uses that to indicate that it is sending data, so I should ignore clock signals if it is not pulled down. I was planning to just check that input pin inside an ISR that reads the input data into a buffer, but DMA is hardware and not sure if that still makes sense.
What I have is a peripheral ADC which sends data to the Teensy by clocking out a serial clock along with eight parallel data lines. The peripheral is the serial master.
I am thinking now that what I need to do is connect the input signals to the Teensy such that the eight bits are aligned with a physical port, configure it to use DMA to transfer from the PORT to memory, and then set it up to trigger when it sees the edge of the incoming clock line.
I had never heard of DMA prior to today really, so I'd really appreciate some guidance on whether this makes sense and how to do it. I found:
https://github.com/PaulStoffregen/co...3/DMAChannel.h
https://forum.pjrc.com/threads/31541-Interrupt-Jitter
This look extremely promising, but I cannot seem to find documentation for the DMAChannel library and cannot quite follow how it works. It almost seems that if I do the pin connections right I can simply swap the source() and destination() when configuring the DMA and figure out what interrupt to assign to it for an edge trigger. But I don't understand what the transfer size and transfer count are.
I'm also curious if it is possible to turn off the DMA unless the data ready line from the peripheral is low. It uses that to indicate that it is sending data, so I should ignore clock signals if it is not pulled down. I was planning to just check that input pin inside an ISR that reads the input data into a buffer, but DMA is hardware and not sure if that still makes sense.