Hey TJF,

I used the CAP pin and I got low values of frequency, using just one ADC, 
and it varies.

<https://lh6.googleusercontent.com/-1kjRR9O8zlI/VJXf_zzNLMI/AAAAAAAAADY/UOMIBw16jiQ/s1600/1.JPG>

I think it is because of the printf() function as you refered once. How can 
I get the real frequency without using the printf() or an oscilloscope? And 
how can I get its minimum, average e maximum?

This is the code I used.

--------------------
#define P1 P9_14
#define P2 P9_42
int main(int argc, char **argv)
{
        pruIo *Io = pruio_new(PRUIO_DEF_ACTIVE, 0, 0, 0); //! create new 
driver structure

    if (Io->Errr) {
               printf("initialisation failed (%s)\n", Io->Errr);}

        if (pruio_cap_config(Io, P1, 2.)) { // configure input pin
          printf("failed setting input @P_IN (%s)\n", Io->Errr);}

        float f1,d1;

         if (pruio_config(Io, 1, 2 , 0, 4)) {
                       printf("config failed (%s)\n", Io->Errr);}

        if (pruio_gpio_setValue(Io, P1, 0x8F)) {
                   printf("failed setting P1 (%s)\n", Io->Errr);}

        while (1)
 {
                                double a= Io->Adc->Value[1];

                        if (a < 25000  )
                         {
                                pruio_gpio_config(Io, P1, 0x8F);

}
                        else
                        {
                                pruio_gpio_config(Io, P1, 0xF);

                        }
                  if (pruio_cap_Value(Io, P1, &f1, &d1)) { //    get 
current input
                        printf("failed reading input @P1 (%s)\n", 
Io->Errr); }

                        printf("\r    Frequency: %10f , Duty: %10f     ", 
f1, d1); // info

                }
  pruio_destroy(Io);
        return 0;
} // end of main

----------------------

Thank you for your attention.
BR,
Luciano.

Sexta-feira, 19 de Dezembro de 2014 14:22:13 UTC, TJF escreveu:
>
>
>
> Am Mittwoch, 17. Dezember 2014 21:24:46 UTC+1 schrieb luciano...@gmail.com
> :
>>
>> So, if I'm understandig it right, what I conclude is that with only one 
>> ADC working, the maximum sample rate we can get is around 93 kHz. 
>>
>
> That's wrong. The above snippet is a closed loop control. Its output 
> toggles at maximum 93 kHz. This means the controller runs at twice that 
> speed (186 kHz). This is 200 kHz ADC sampling rate plus some time to check 
> the value and switch the GPIO output.
>
> This additional time varies, depending on the load of the host CPU 
> (interrupts handling network, grafics, keyboard, mouse, ...), as you can 
> see in the differences between Minimum and Maximum values. If you're going 
> to layout a controller, dimension it for the Minimum frequency (in this 
> case 120 kHz = 2 * 60 kHz).
>  
> BR
>

-- 
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.

Reply via email to