SPI ESP32 Arduino

jorgefuentes_87
Posts: 1
Joined: Sat May 14, 2022 7:57 pm

SPI ESP32 Arduino

Postby jorgefuentes_87 » Sat May 14, 2022 8:14 pm

Good day

I am getting samples from a 24 bit ADC (ADS127L01). when I sample and save the values ​​at 64k samples/s everything works fine, but when I want to save samples at 128k, 256k or 512k I lose data. The SPI speed is at 24 Mhz and in the oscilloscope it doesn't need more than 1.5 microseconds to send the 3 bytes, saving the memory data takes less than 1 microsecond, so I don't understand why it doesn't work at 128k or 256k samples.
Measuring the instruction time // vspi->transfer(bytesy,3);// is 3 microseconds. is there a way to do it faster?
bytesy[] is a buffer of type byte just like bytesx[] the time to save the samples is optimal.
I appreciate your guidance on this


void Datosfaseign(int ciclos)
{
byte n=0;
while(n<ciclos)
{
InicioADCign();
attachInterrupt(digitalPinToInterrupt(15),fase, FALLING);
int i=0;
int k=0;
while(contador!=1);
while(contador==1)
{
byte bytesy[]={0,0,0};
while(digitalRead(DRDY)==HIGH);
vspi->transfer(bytesy,3); //This instruction is the one that takes approx 3 microseconds, how to do this faster?
bytesx[3*i]=bytesy[2];
bytesx[3*i+1]=bytesy[1];
bytesx[3*i+2]=bytesy[0];
i++;
}
detachInterrupt(digitalPinToInterrupt(15));
contador=0;
n++;
}
}

Who is online

Users browsing this forum: biakss and 73 guests