I need to create a data logger using an Xmega chip. It will be a small battery powered device to sample 4 channels of muscle EMG and record to an SD card. 4 channels * 1000 samples/second = 4000 words/sec = 8000 bytes/second. I want to use the FAT16 file system so I can remove the SD card and read it in a Windows computer.
Questions:
1) It seems the E-Lab compiler only supports GetADC(), which doesn't use interrupts or DMA, therefore I wonder if this will be fast enough for this application? I am also concerned that the GetADC sampling might not occur exactly every millisecond.
2) I think a better way to sample is to set up the Xmega event system, DMA, and A/D to trigger a scan of the 4 channels every millisecond. The DMA would send the samples to a RAM buffer; when the buffer fills I will write it to the SD card. If the DMA supports it, I would use two buffers in a ping-pong fashion so I can write one while the other fills.
Has anyone created similar code that sets up the event system, DMA, and A/D?
Questions:
1) It seems the E-Lab compiler only supports GetADC(), which doesn't use interrupts or DMA, therefore I wonder if this will be fast enough for this application? I am also concerned that the GetADC sampling might not occur exactly every millisecond.
2) I think a better way to sample is to set up the Xmega event system, DMA, and A/D to trigger a scan of the 4 channels every millisecond. The DMA would send the samples to a RAM buffer; when the buffer fills I will write it to the SD card. If the DMA supports it, I would use two buffers in a ping-pong fashion so I can write one while the other fills.
Has anyone created similar code that sets up the event system, DMA, and A/D?