Post Go back to editing

Continuous sampling on AD4630 and ZedBoard using python

I'm using pyadi-iio interface for ad4630-24 with a ZedBoard as FPGA. I am sampling data continuous and logging it to a csv file. The logged data is continuous without missing a bit upto 1MSPS of sampling frequency but increasing sampling frequency beyond, there is missing data. The data looks good i.e. their no missing bit in the middle, so the data is continuous from buffer to buffer but the total length of sampled data points is significantly less. For e.g. sampling data for 10 seconds at 2MSPS, I just get about 15M data points instead of 20M in all output data modes except 30diff_avg mode. In 30diff_avg mode ,I get 20M/avg_value as expected. 

 I was reading here,, that slow devices like Zedboard has no problems to stream samples at speeds of 3MSPS without dropping a single bit. Is Zedboard limiting the speed for continuous sampling of data? Since ad4630-24 is dual channel and each channel supports upto 2MSPS.But I see similar behaviour in single channel version of ad4630(part of ad463x family). 

Can anyone tell if we are absolutely hitting the limit of ZedBoard or if there is something wrong else where? Also are there any other options or scope of improvements?

As a side note, I am just logging data of 1 channel at a time to reduce data parsing delay. Also data is stuffed in a queue, and sampled and logged in completely different threads so, I suppose, it(higher level code) is no effecting total length of data. 

From what I understood, the samples are acquired from the hardware using DMA and stuffed into kernel buffer. From their data is passed to iio.buffer using iio.refill() and data from iio.buffer goes to user space buffer using But I couldn't find a command that says all the read is done and time to refill, as refill will discard the unread data. As a work around, I am keeping the user space buffer size same as sampling frequency each refill and read is same and I can keep refilling every-time. Tell me, if I am missing something and/or if there would be some concern in doing so.