Sequencing SAR ADC with greater than 2 channels and DMA | Cypress Semiconductor
Sequencing SAR ADC with greater than 2 channels and DMA
I'm looking to DMA from the Sequencing SAR ADC to a results array. I have no problem with 2 channels, but once I go to more than 2 channels I only get the first 2 channel results repeated. I've gone over and over the DMA setup and I think it is correct but I must be missing something. I used this article www.cypress.com/ as a base to get the 2 channel setup working.
I've written a minimum project (attached) that in my mind should work when the number of channels in the designer is changed. There are 2 results arrays; 1 which extracts the results from the ADC using the API GetResult16() function, and 1 which gets the results via DMA. If you put a breakpoint on the "DMADone = 0;" line in main.c you can compare the results in the two arrays. These are equivalent when sampling two channels...but any channels over that don't appear in the results. (I've set up a few different voltages on the input pins to test it).
From reading the documentation I understand that the number of bytes in each DMA burst should be NumChannels * sizeof(uint16) to read all the results from the ADC_1_finalArray, and the TD should be set to be the number of results array elements * sizeof(uint16).
I have the TD set such that the destination results array increments automatically, which from the DMA documentation I think should take the size of the number of bytes per burst into account. I wonder however, if this is incrementing correctly for two input channels but needs some adjustment for more channels than that.
Any info and help would be much appreciated.