[Open_electroporator] culture shock ADC and DMA

Nathan McCorkle nmz787 at gmail.com
Thu Aug 30 09:57:16 UTC 2018

On Tue, Aug 28, 2018 at 1:22 AM Nathan McCorkle <nmz787 at gmail.com> wrote:
> I guess I should be able to just read the values from the buffer we
> already provide, that's what I'll try next, but I will need to look
> into the DMA registers to try and find the sample # too, so I can pull
> out the last voltage reading.

That seems to have worked!

Here's the commit:

and here's the start of the control loop:

basically I wait until the timer has ticked at our chosen frequency (I
think this is working, but not totally sure).
then calculate the most recent value that the DMA wrote, then check if
it's a voltage reading (index%2==0  because the voltage and current
are stored one after another, starting with the voltage being the
first or 0th sample). If not, I just subtract 1 from the index and get
the most-recent voltage reading index.
then I copy the value from the buffer into a local variable.
then I check if that variable is above or below some threshold
(arbitrarily chose 300 for testing, with a lower bound at 285).

After I saw the one GPIO toggling... I enabled both GPIOs to turn off
in the control loop... and it looks like things are working at least
good enough to be usable... though some more improvement and
validation is needed (like maybe connecting with GDB and examining
some variables mid control-loop).



there's some wonkiness to it... but it's a first draft!

Aside from that:
I also fixing a blip on the PUSH GPIO that was causing an initial HV
spike for me, by turning off an early un-needed ADC/DMA read sequence
(not sure why it was causing a blip, I can test without the ADC
patching as I've done this week and see if it's something with the
control loop code):

even if I created this bug, the two lines shouldn't be needed in
general, I think... but I will check to see if this blip was also
happening before my recent changes this week,

Added ability  for the GUI to screenshot itself, using a command-line
tool called "shutter". Enabled the "num pulses" input box to start a
pulse, when ENTER is pressed... but only if the checkbox next to the
text box is checked.

More information about the open_electroporator mailing list