[Open_electroporator] Timers, PWM, low-level MCU setup

Nathan McCorkle nmz787 at gmail.com
Thu Mar 9 19:09:47 UTC 2017


I still haven't received a shipping notice for my bio-supplies. Kermit
might beat me to really zapping something (and yes it should
definitely be capable of that out of the box... to the others
watching, this is about optimizing the zapper programming code, so it
is easier to use/adjust/quantify-waveforms)

:)


On Mon, Mar 6, 2017 at 4:56 PM, John Griessen <john at cibolo.com> wrote:
> If you connect them to the scope calibrator then adjust to square shape the overshoot might go away, but the low pulse is still odd.

Mmm, ok will check it out. I haven't been seeing that pulse lately...
so it could have been some glitch that I fixed somehow.

I found some C code for setting up one-pulse mode (which is really
just a case for n-pulse mode where n==1) and have converted this to
MicroPython stm.mem16 writes.
It includes all the GPIO and Timer bus enabling, Alternate Function
muxing, Timer master/slave and trigger setup, n-pulse setup, etc.
I basically have a very heavily commented Python file now, with each
register write having a nice big comment from the datasheet pages.
This would be the ultimate configuration, I think, as it would be
essentially free of the CPU pipeline... but I am not sure we have two
n-pulse capable timers on-board.

These Timers are complex little beasts, it's pretty neat how much
functionality they can provide when setup right, and it seems there
are several ways to accomplish this, each with different constraints.

I am still working to digest this, but it was a helpful exercise and
pointed out some more gotchas for how to set things up glitch-free (or
not).

I need to figure out the mapping from MicroPython pin-numbers (i.e.
JP25), to MCU-datasheet pin-numbers (PA0) to GPIO register-letter (I
guess that PA0 is in the GPIOA register), that one-pulse code to use
the correct pins (I just finished the code-conversion last night).


>>Then I got out my 40kV-rated 1 GOhm resistor, and clipped that to a
>>3rd oscilloscope channel, and found I could see the HV waveform
>
> Good.  Is it like the one I posted?
> Where the HV output builds then plateaus as the train of 8 pulse s goes through the the transformer?

There was some ramp-up, but it was quite fast, within 1-3 pulses after
the start (I can't remember and didn't save a screen capture).
If we wanted to get more programmability, I was reading about using a
timer-interrupt DMA to transfer a new PWM compare value from memory...
if we paired this with a slick GUI for users to draw their desired
waveform, I think we could then compile that to a series of compare
values and store to memory, then hit 'play' on the microcontroller
Timer magic!

Meanwhile I'm still digesting all the reading and hacking I've been doing.

>>So, John, how do I calculate the voltage division on the 1GOhm
>>resistor?
>
> 1/(1/R1+1/R2)=Total

Hmm, I still don't get it. Looking at voltage-divider schematics, it
seems like I've got a different setup. I've attached an image of what
I know. I haven't checked if the HV Contact 2 == GND


-Nathan

P.S. no need to respond to any of that until you get back to a big
keyboard, though maybe you could send a quick reply about the HV
oscilloscope probe calculations/situation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Drawing.jpeg
Type: image/jpeg
Size: 45226 bytes
Desc: not available
URL: <http://cibolo.us/pipermail/open_electroporator/attachments/20170309/1be01f0b/attachment-0001.jpeg>


More information about the open_electroporator mailing list