Hey TFJ, I did this way and I would be glad of you helped me in this question. I have installed Libpruio0.0.2, and I wrote a simple code just to read the ADC value (Value[1]) from the output port P9_14 to see it commute.(I don't need all that libraries, but they are there for further algorithms). In the circuit I added a voltage divider with two 10k resistors, to get about 1,7V to not cross 1,8V.
----------------------- /* Test ADC max sample rate Libpruio 0.0.2 Compile by: gcc -Wall -o ReadADC ReadADC.c /usr/local/lib/freebasic/fbrt0.o -lpruio -L"/usr/local/lib/freebasic/" -lfb -lpthread -lprussdrv -ltermcap -lsupc++ */ #define _GNU_SOURCE 1 #include "stdio.h" #include <termios.h> #include <unistd.h> #include <errno.h> #include <sys/types.h> #include <sys/time.h> #include "../c_wrapper/pruio_c_wrapper.h" #include "../c_wrapper/pruio_pins.h" #include <stdlib.h> #include <stdbool.h> #include <time.h> #define P1 P9_14 int main(int argc, char **argv) { PruIo *io = pruio_new(0, 0x98, 0 ,1); pruio_config(io, 0, 0x1FE, 0, 4, 0); if (io->Errr) { printf("initialisation failed (%s)\n", io->Errr);} if (pruio_gpio_set(io, P1, PRUIO_OUT1, PRUIO_LOCK_CHECK)) { printf("failed setting P1 (%s)\n", io->Errr);} if (pruio_config(io, 0, 0x1FE, 0, 4, 0)) { printf("config failed (%s)\n", io->Errr);} while (1) { if (io->Value[1] < 25000 ) { pruio_gpio_out(io, P1, 1); printf(" %6d ", io->Value[1]); printf("\n"); } else { pruio_gpio_out(io, P1, 0); printf(" %6d ", io->Value[1]); printf("\n"); } } pruio_destroy(io); return 0; } // end of main --------------------- The thing is that I'm only getting about 10kHz. It is normal to just get this sample rate? <https://lh3.googleusercontent.com/-uO0ixAS_O6Y/VIbijDNYsYI/AAAAAAAAACE/W42721NvvEU/s1600/20141209_111337.jpg> Thanks in advance. Luciano. Terça-feira, 4 de Novembro de 2014 16:57:48 UTC, TJF escreveu: > > Hello jleb! > > Sorry for the late answer. I did some testing, meanwhile, and it seems > that you're right. The ADC subsystem is clocked by CLK_M_OSC directly at 24 > MHz. (First, I thought there's an additionaly pre-scaler in the PRCM.) > > Find attached a libpruio measurement from four channels, connected to a > PWM output by different voltage dividers. The PWM frequency and the > sampling rate are configured that way that a complete period plus two > pixels get shown in the window. The result is as expected, and even if I > increase the frequencies, all looks good up to a sampling rate of 200 kHz. > > -- 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 beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.