Hey TJF,
I've got it compiled and working. I can't yet test if the adc keeps up
since I the function generator we've ordered got out of stock.... However I
changed my code a bit so it would close the files and the whole program has
a end statement. It's currently 1 channel at ~220 kS/s. I haven't pushed it
further because I don't know what will happen. With my understanding of the
PRU I guess the PRU can't break anything on the BBB while doing that, but I
don't know so I don't want to push my luck.
#include "unistd.h"
#include "stdio.h"
#include "../c_wrapper/pruio.h"
//! The main function.
int main(int argc, char **argv)
{
FILE* oFile;
uint8 bDiv = 4, bStep;
uint32 bSize = 1e6;
uint32 bsSize = bSize/bDiv;
uint8 cycles = 2;
char fName[12];
int i = 0;
pruIo *io = pruio_new(PRUIO_DEF_ACTIVE, 0x98, 0, 1); //! create new
driver structure
pruio_adc_setStep(io, 9, 4, 0, 0, 0); // step 9 for AIN-4
if (pruio_config(io, bSize, 1 << 9, 4545, 0)){ // '1 << 9' -> step 9,
'6285' ns -> 159.1 kHz
printf("config failed (%s)\n", io->Errr);}
else{
pruio_rb_start(io);
sleep(1);
for(i=0; i<cycles; i++){
sprintf(fName, "output.%u",i);
oFile = fopen(fName,"wb");
while(bStep<bDiv){
while(io->DRam[0] < (bStep+1) * bsSize && io->DRam[0] > bStep *
bsSize){
sleep(1);
}
printf("writing samples %u-%u\n",bStep*bsSize, (bStep+1)*bsSize);
fwrite(io->Adc->Value, sizeof(uint16), 16000, oFile);
bStep++;
}
bStep=0;
fclose(oFile);
}
}
pruio_destroy(io);
return 0;
}
Greetings,
Nils Kohrs
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.