Arduino Zero Counter versus dedicated IC

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MikeSBlankenship
 
Posts: 56
Joined: Sat Nov 07, 2015 5:32 pm

Arduino Zero Counter versus dedicated IC

Post by MikeSBlankenship »

Hi,

I am building a time sensitive current meter that will be using an Integrator
and and a 32 bit counter. My question are the following :

I know the SAMd21 in the Arduino Zero has several 32 bit counters, does anyone know
the RESET ENABLE speed difference between using a dedicated counter like the SN74LV8154
versus the Arduino Zero? I can have the Zero do the RESET and ENABLE logic using Interrupts
or EVENTS.

The Basic idea is this :

1. RESET then ENABLE the counter as the current is put through Integrator (Counter counts up)
2. Output of the Integrator is fed into a precision Voltage Comparator that is set to 10.000 VOlts
3. When the comparator trips (at 10.000 Volts) it stops the counter and the value is put into a REGISTER.

I have tried to look around on how fast the INTERRUPT or EVENT takes to process the RESET ENABLE request.

Any help would be appreciated in pointing me in the correct direction.

Thanks

mike

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Arduino Zero Counter versus dedicated IC

Post by zener »

I think this is what you are getting at:

https://community.arm.com/docs/DOC-2607

If you scroll down a bit you will see "The latency count is listed in table 1, and is the exact number of cycles from the assertion of the interrupt request up to the cycle where the first instruction of the interrupt handler is ready to be exected, in a system with zero wait state memory systems:" For the M0+ it shows 15 cycles.

It sounds like you are making a ramp converter, which is how AD conversion was done before we had AD converters... I assume there is some reason you want to do it that way.

User avatar
MikeSBlankenship
 
Posts: 56
Joined: Sat Nov 07, 2015 5:32 pm

Re: Arduino Zero Counter versus dedicated IC

Post by MikeSBlankenship »

Zener,

Thanks for the reply.

This looks what I am looking for, If I am reading this correctly

1 / 40Mhz = 2.0833 e-8
2.0833 e-8 * 15 (clock cycles) = 312.5 nano sec to process the interrupt
Then what ever code I have to get the count and put it into a register.

I'm are trying to eliminate using an A/D, even though we have one on the SAMD21 (12bit)
also with this method we are hoping to get 5+ decades of range. The Integrator and comparator
will have a Vcc of 15V to ramp and ramp.

Thanks again

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino Zero Counter versus dedicated IC

Post by adafruit_support_mike »

You'll be better off using a dedicated crystal oscillator (temperature controlled or compensated if possible) and an external synchronous (all bits change at the same time) counter.

Give yourself at least 100mV above and below the limiting voltages you want to measure, and use comparators to capture the instant the ramp crosses the high and low limits. Getting a ramp to start or stop at a precise time is hard because you're asking the components to change what they're doing, and you have several interacting pieces throwing error terms into the mix. It's easier to start and stop a ramp if you don't have to care about the timing, then track its behavior once it's running smoothly.

Assuming you have a stable current source, the three major error terms in a ramp-based ADC are the stability of the clock, threshold drift in the comparator, and dielectric soakage in the capacitor.

A thermally compensated crystal oscillator should be stable to a few hundred parts per billion, and they aren't all that hard to find these days.

Dielectric soakage is a parasitic RC term within a capacitor.. if you short the terminals together then separate them, you can see voltage re-develop across the cap because of charge that didn't have enough time to equalize. For ramp generators, that creates nonlinearity in the ramp, and voltage offsets between consecutive ramps at clock tick N. Soakage is proportional to the voltage across the cap when it was discharged, so stopping a ramp at different points can create a large and hard to compensate error term.

Film capacitors tend to have less dielectric absorption than other kinds, with polypropylene and polyphenylene sulfide (PP and PPS) being the lowest (between 0.1% and 0.01% depending on who you listen to).

Threshold drift is an issue that requires temperature control or chopper amplifiers, which tend to be slow, or designing a system with built-in calibration. Using analog switches so you can catch the min, signal, and max voltage crossings with the same precision comparator automatically calibrates each reading. The exact number of counts from min to max might change from one day to the next, but you always know the min and max times for a given reading, and can scale the signal crossing appropriately.

There's a complete design and discussion of the kind of circuit you want in National Semiconductor App Note 260 by Jim Williams: http://www.textfiles.com/bitsavers/pdf/ ... N-0260.pdf

User avatar
MikeSBlankenship
 
Posts: 56
Joined: Sat Nov 07, 2015 5:32 pm

Re: Arduino Zero Counter versus dedicated IC

Post by MikeSBlankenship »

Hi Mike,
Interesting article by Jim Williams, doing some research from your post I found this :
http://www.linear.com/doclist/?au=Jim+Williams
Earliest article was in 1984, I didnt see the one you linked to, maybe Mr Williams
did not work for Linear Tech at that time.

I will be using the Adalogger M0 for initial testing, I'll put in a dedicated clock
and 32 bit counter on the board, but ... I will also have traces going to the M0
just for testing the differences.

I am working on the Kelvin circuitry now, just the SOURCE HI, and SOURCE LO.

Thanks

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino Zero Counter versus dedicated IC

Post by adafruit_support_mike »

MikeSBlankenship wrote:Earliest article was in 1984, I didnt see the one you linked to, maybe Mr Williams
did not work for Linear Tech at that time.
Yep.. at that point he was working for National Semiconductor, which was absorbed by Texas Instruments, where Jim's good friend and fellow design wizard Bob Pease worked.

I don't think they ever worked the same place at the same time, but they were never rivals.. their opponents were the laws of physics and the constraints of whatever project they were working on.

Everything either one of them wrote is worth reading, even if none of the techology even exists today (tunnel diodes, for instance). The parts were just there to demonstrate the ideas and techniques.

The best Jim Williams reference I know is maintained by his friend Kent Lundberg: http://readingjimwilliams.blogspot.com/

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”