Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4817

General • Re: Need Guidance for RP2040 (PICO)

$
0
0
I aim for the signals measured by the 16 ADCs (across 4 PICO units, each with 4 ADC channels) to be below 0.8 V, as the trigger is set to the falling edge. At a lower frequency of 30 Hz, I observed voltages of 0.804 V and 0.811 V. However, as I increase the frequency, the voltage continues to rise, as detailed in the previously shared PDF file.
It's still not clear to me what you have, how this trigger and sine-wave relates to a falling edge, how this 0.8V comes into play, but, if you are reading what you expect at low frequencies but not higher it suggests to me it is a time delay between the PicoMite detecting a trigger and reading the ADC.

PicoMite Basic is an interpreter. If it's interpreting source code, tokenised code, even bytecode, it may be much slower than expected.

When the frequency is low the wave period is long enough that it probably hasn't risen above the trigger level when ADC is read -

Code:

                  ____                            ____            __---    ---__                  __---    ---__Sine Wave --              --__          __--              --__          __--                              ---____---                      ---____---                              :       :                       :       :                              :       :                       :       :Trigger   ____________________|_______:_______________________|_______:_____                                      :                               :Read ADC  ____________________________|_______________________________|_____                              | Delay |                       | Delay |
When the frequency is higher the wave period is shorter so the wave may have risen above the trigger level when ADC is read -

Code:

                       __                __                __                    _--  --_          _--  --_          _--  --_          _-Sine Wave _       _-        -_      _-:       -_      _-:       -_      _-           --__--             --__--  :         --__--  :         --__--                              :       :         :       :                              :       :         :       :Trigger   ____________________|_______:_________|_______:___________________                                      :                 :Read ADC  ____________________________|_________________|___________________                              | Delay |         | Delay |
At even higher frequencies it is possible delays may be so long it's not even reading ADC within the wave which triggered a read of ADC.

As suggested; present a pulse on a GPIO pin then you can see what's shown above on a scope. That should allow you to see exactly when ADC is being read, what the delay is between the trigger and the ADC read.
I plan to utilize this setup later for data acquisition from equipment where precision is paramount, and any deviation could compromise the results.
I don't know how deterministic PicoMite Basic is. If it doesn't have hard interrupts which are immediately responded to, merely notes the interrupt and schedules the interrupt handler at the end of the command line being executed, there could be indeterminate delays.

That might even explain any delays which are being seen. Generating a pulse when ADC is read should reveal whether the delay from trigger is consistent or not.

Statistics: Posted by hippy — Sat Aug 03, 2024 3:50 pm



Viewing all articles
Browse latest Browse all 4817

Trending Articles