Community
cancel
Showing results for 
Search instead for 
Did you mean: 
DNg3
Beginner
900 Views

How fast can I sample to GPIO's? Can I write the results to RAM via DMA?

I want to do some medium-speed data recording and processing (~10MHz). Can I use the Joule to capture from a fast parallel ADC to memory with DMA?

0 Kudos
4 Replies
FGold
New Contributor II
37 Views

What is the architecture?

Most ADCs are SPI or I2C.

The performance depends on the sw and hw architecture as well as the joule mraa capabilities, or custom drivers. As well as the OS architecture, compiler optimization, idle percentage, ISR priority settings, ...

Scenario 1:

If you you connect the ADC EOC (End Of Conversion) pin to a Tuchuck J12/J13 ISR GPIO input pin on the Joule. The ISR could attempt to transfer each conversion, but with a 25MBit SPI Clock , a 10MHz sample rate is inadequate. If the ADC has an internal buffer, and the ADC generates an interrupt when the buffer is 3/4 full, multiple transfers can occur withing the ISR.

Scenario2:

ADC parallel bus output, the joule GPIO is not grouped as a contiguous byte or word as far as I am aware. If the ADC generates an interrupt on EOC, the ADC_ISR GPIO input pin, will trigger the ISR handler, and a parallel read (or multiple bit reads) can be performed to save/buffer the ADC value.

DNg3
Beginner
37 Views

Definitely scenario 2. Do i have DMA access? I want to record a few seconds of data at 10+MHz, and i dont want an OS messing up my timing

Do you know the maximum speed i can read a GPIO? I don't suppose i can read it at up to the processor speed...

FGold
New Contributor II
37 Views

Here is some metrics for GPIO writes using nodejs and c++. Have not tested GPIO performance, as of yet with various languages (python).

you may want to look at:

Ubuntu Core, sudo classic, sudo nodejs gpioTest.js // note: these results of 10.6us were the same for a C++ executable looping on write 0, write 1

period is ~10.6us, such that a single write requires ~5.3us

sudo nodejs gpioTest.js

MRAA Version: v1.5.1

var m = require('mraa'); //require mraa

console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console

var myPin= new m.Gpio(2);

myPin.dir(m.DIR_OUT); //set the gpio direction to output

var pinState= true; //Boolean to hold the state of the pin

while(1)

{

myPin.write(ledState?1:0);

pinState= !pinState; //invert the pin

}

or:

using -

while(1)

{

myPin.write(1);

myPin.write(0);

}

is typically the same ~10.6us (notice the short period high which occasional hits: ~15us)

idata
Community Manager
37 Views

Hi Dnhkng,

 

 

Did you check Floydg information? (Thanks by the way Floydg)

 

 

Do you still need help in this case?

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
Reply