Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

All,

   

I am using the CY8CKIT-001 PSoC-5 demo board and have been able to get the 16-bit ADC example to work in "diff" mode, and then send the data out using the USBUART example. I use the original switch routine to start the conversion, then I turn on an LED showing the the DMA is done, then use another switch to dump the data out the USBUART portion.....BUT.... when I try to setup my array to bigger than 2,000 and do an ADC sample, I end up with a bunch of 0's in the reset of the array. Example, if I wanted to make my array 20,000 samples, only about the first 2000 samples are actual data, while the rest are all 0's. (it varies from acquire to acquire)

   

the uint16 should be 0 -- 65535 values so that should be ok.  The code is exactly as the original Cypress example. I have just changed the NO_OF_SAMPLES to a larger number.

   

#define NO_OF_SAMPLES 2000

   

uint16 ADC_sample[NO_OF_SAMPLES]={0};

   

The array of 2,000 works fine, along with a sample rate of upto 100,000Sps. Verified with sig-gen and Excel. I don't understand why changing the array won't work. Even changing it to 3,000 samples doesn't work. Why / Where is the array/DMA transfer limitation?

   


Any ideas????

   

Keith

0 Likes
1 Reply
Anonymous
Not applicable

The problem is with the DMA.  The maximum Transfer Count for both PSoC 3 and PSoC 5 is (4K - 1) bytes.  For 2,000 uint16's you are transferring 4,000 bytes.  That works just fine.  This parameter is just put into the TD memory in a 12-bit field, so if you provide a number greater than that you are just going to get the lower 12-bits and therefore strange results.

   

The solution to this is pretty simple.  You'll need to create multiple TDs and configure them in a chain where each will transfer an amount that is within the (4K - 1) limit.

   

Brad Budlong
PSoC Sensei

0 Likes