• One of the functions that I need for my project is to capture two analog signals and time stamp, and at least 70 samples. I tried to use a Beaglebone Black and wrote a simple Python program. I then tried STM32F4 Discovery and wrote the same function using Espruino. I was pleasantly surprised to see that the sample rate was almost five times higher with this approach. It is almost fast enough for what I am doing, but it would be nice to get a factor of 10 improvement in sampling rate. Right now the measurement takes 35ms to complete, that is reading two analog signals and the time 70 times and saving it in an array for transfer to a PC later. If anyone has insight into how I can speed up my measurement, I am very interested to hear more. My little program is:

    function capture() {
      digitalWrite(C0,0);
      setTimeout(read(),2000);
      send();
    }
    function read() {
      tick1=getTime();
      for (var i=0; i<samples*3; i=i+3) {
        data[i]=(getTime()-tick1);
        data[i+1]=(analogRead(C1));
        data[i+2]=(analogRead(C5));
      }
    }
    function send() {
      for (var k=0; k<samples*3; k=k+3) {
        print (data[k],data[k+1],data[k+2]);
      }
    }
    var samples=70;
    var data=new Float32Array(samples*3);
    capture();
    
About

Avatar for tage @tage started