How to achieve a higher Sample Rate from RedPitayas slow Analog Inputs?

Applications, development tools, FPGA, C, WEB
Post Reply
timosmd
Posts: 5
Joined: Mon Oct 14, 2019 3:26 pm

How to achieve a higher Sample Rate from RedPitayas slow Analog Inputs?

Post by timosmd » Mon Nov 11, 2019 5:26 pm

Hello RedPitaya-Community,

I am trying to read the analog inputs of my RedPitaya (Stemlab 125-14).

According to the datasheet the slow analog inputs should be capable of around 100kS/s.

The maximum I can achieve with the following C-code is around 10-16kS/s. The code is executed & running directly on the Linux OS of the RedPitaya.

Does anyone have an idea on how to maximize the sample rate? Or any ideas for alternate approaches?

For my project I need around 50kS/s.

Thanks in advance!

Code: Select all

// Test für maximale Sample Rate (minimalstes Programm)
#include <stdio.h> 
#include <stdlib.h> 
#include <time.h>
#include <sys/time.h>						        //Header for timestamp
#include "/RedPitaya/api/include/redpitaya/rp.h"   //Header for RP API

int main() 
{  
	float voltage;				//Measured Voltage
	struct timeval currentTime;  //Timestamp
    
	// Initialization of RP-API
    if (rp_Init() != RP_OK) 
	{
        fprintf(stderr, "Red Pitaya API init failed!\n");
        return EXIT_FAILURE;
    }
	
	int counter = 0;	
	while(counter<=100000)				//counter ist Anzahl der Pakete - spaeter while(1)
	{

				//Get AI-Values	
				rp_AIpinGetValue(1, &voltage);				//Read Voltage of Pin1
				
				// Timestamp in microseconds
				
				gettimeofday(&currentTime, NULL);
				unsigned long long microsecondsSinceEpoch = 
				  (unsigned long long)(currentTime.tv_sec) * (int)1e6 + 
				  (unsigned long long)(currentTime.tv_usec);	
				
				printf("%.4f // %llu \n", voltage, microsecondsSinceEpoch);
				
				counter++;
	} 
return 0; 
}

Ilka31415
Posts: 2
Joined: Sun May 31, 2020 9:21 pm

Re: How to achieve a higher Sample Rate from RedPitayas slow Analog Inputs?

Post by Ilka31415 » Sun May 31, 2020 9:23 pm

I would very much like to know that, too! Unfortunately, I could not find anything in the docs.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 9 guests