Hi Hans!
Am Mittwoch, 8. Mai 2019 22:26:04 UTC+2 schrieb Hans Leeuw:
>
> Oh, and the loop goes on. The problem is not there.
>
Yes, there's a break; statement missing at the end of the while loop.
Sorry, I cannot reproduce the problem. Using this code
// gcc -Wall -o hansOK hansOK.c -lpruio
#include "stdio.h"
#include "libpruio/pruio.h" // include header
#include <unistd.h>
int main(int argc, char **argv)
{
int i = 1, n;
char *emsg = "CTOR";
pruIo *io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0);
while (!io->Errr) {
if (pruio_adc_setStep(io, 7, 0, 1, 0, 0)) {emsg = "AIN-0"; i = 2; break
;} //Step 7, AIN-0
if (pruio_adc_setStep(io, 8, 1, 1, 0, 0)) {emsg = "AIN-1"; i = 2; break
;} //Step 8, AIN-1
if (pruio_adc_setStep(io, 9, 2, 1, 0, 0)) {emsg = "AIN-2"; i = 2; break
;} //Step 9, AIN-2
if (pruio_adc_setStep(io, 10, 3, 1, 0, 0)) {emsg = "AIN-3"; i = 2; break
;} //Step 10, AIN-3
if (pruio_adc_setStep(io, 11, 4, 1, 0, 0)) {emsg = "AIN-4"; i = 2; break
;} //Step 11, AIN-4
if (pruio_adc_setStep(io, 12, 5, 1, 0, 0)) {emsg = "AIN-5"; i = 2; break
;} //Step 12, AIN-5
if (pruio_adc_setStep(io, 13, 6, 1, 0, 0)) {emsg = "AIN-6"; i = 2; break
;} //Step 13, AIN-6
if (pruio_adc_setStep(io, 14, 7, 1, 0, 0)) {emsg = "AIN-7"; i = 2; break
;} //Step 14, AIN-7
// upload settings, prepare MM mode
if (pruio_config(io, 220500, 255<<7, 45352, 0)) {emsg = "config"; i =
3; break;}
//if (pruio_config(io, 16384, 255<<7, 45352, 0)) {emsg = "config"; i
= 3; break;}
// start measurement //Starts in rb_mode
if (pruio_rb_start(io)) {emsg = "rb_start"; i = 4
; break;}
printf("initialized, ESize = %X\n", io->ESize);
usleep(10000);
/* now current ADC samples are available for AIN-0 to AIN-7 in array
io->Adc->Value[] */
for(n = 0; n <= 12; n++) { // print some lines
for(i = 0; i < 8; i++) // all steps
printf(" %4X", io->Adc->Value[i + (8 * n)]); // output one channel
in hex
printf("\n"); // next line
}
i = 0; break;
}
/* we're done */
if (io->Errr) printf("%s failed (%s)\n", emsg, io->Errr);
pruio_destroy(io); /* destroy driver structure */
return i;
}
on Beaglebone Black, AIN-[0-6] open, but AIN-7 connected on board to 1V65,
I get
$ ./hansOK
initialized, ESize = 40000
F50 ED5 EC6 B6A 83F 845 8EA F24
F4E F13 ECD D08 A58 941 948 F2F
F5D F23 EE5 DF1 BEA A8C A09 F28
F56 F33 F0F E72 CE9 BB1 AFF F2F
F63 F34 F1A EB8 D9D CA7 BEA F25
F52 F2F F2D EE0 E06 D50 CB3 F2F
F5E F2D F2C EF1 E57 DCF D4F F25
F4B F2C F35 EFB E75 E11 DBF F2E
F55 F2D F2A EFA E95 E4B E0E F25
F4D F2A F2F F05 EA0 E68 E3D F33
F57 F25 F26 EFC EAD E8A E6A F28
F47 F22 F2A EFF EB0 E8B E75 F2F
F54 F27 F24 EF8 EB3 E9D E8B F2A
$ sudo rmmod uio_pruss
$ sudo modprobe uio_pruss extram_pool_sz=0x800000
$ ./hansOK
initialized, ESize = 800000
F43 ED3 EC0 B64 842 839 8D3 F2F
F50 F03 EC9 D11 A62 941 930 F2A
F57 F2B EE6 DEC BDE A8B A07 F32
F58 F22 F01 E71 CEF BB5 AF6 F28
F5A F31 F1B EB2 D95 CA7 BEF F31
F58 F28 F23 EDF E11 D52 CAE F25
F51 F2F F32 EED E47 DC6 D51 F32
F54 F2A F30 EFB E7B E15 DB6 F2B
F4F F2D F30 EFC E89 E4A E10 F35
F56 F21 F26 EFF EA9 E71 E3E F24
F4B F28 F2B F00 EAC E82 E67 F37
F52 F20 F25 EFD EBA E94 E74 F2A
F49 F2A F2A EF7 EAE E98 E89 F33
So here it works with standard (16384 samples) or maximum ERam (220500
samples) configuration on kernel
4.14.69-ti-r76
Regards
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/235b92d2-f2ac-4b46-9697-377df4f445f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.