PIC32 Oscilloscope

PIC32 Oscilloscope

 

 

Bruce Land sent in a tip that can help you save ADC data from a PIC 32 really fast. This can come in handy when you are doing things like reading in analog data for something like an Oscilloscope.

“Bruce Land wrote:

Turns out that the DMA channels on a PIC32 can move data from the ADC using the ADC done interrupt flag, but without wasting time in an ISR. The ADC can be triggered by a timer interrupt flag, again without software intervention. Doing this means that you can blast ADC into memory at just under a Megasample/sec with NO software overhead!

Using another DMA channel to feed memory to a buffered SPI port means that video data can be streamed to a TV with less than 7% software overhead, sustaining a 5 megabit/sec pixel rate. Most of the video overhead is in the SYNC generator state machine ISR. But the rigid NTSC time requirements are easy to meet because all the actual SYNC generation and video timing are also done completely in hardware with no software intervention. One timer triggers two output pulse generators, one to generate SYNC, one to time the video “backporch”.

When the backporch pulse gen times out, it triggers the video DMA burst from the frame buffer in memory to the SPI port.

A simple 3 resistor DAC combines the SYNC and video stream. Resolution is 256×200. There is plenty of CPU left for FFT or game generation.”