EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: eecook on September 02, 2014, 05:49:24 pm

Title: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: eecook on September 02, 2014, 05:49:24 pm
Hi all,

I've been strugglin with this search for a couple of days now, but I cannot find anything on the 2USD price range (@500-1000 units).

I'm trying to find a MCU with the following specs:
Operating Ambient Temp: +105C
A/D channels: 5+ (12 bit resolution)
Timer: 1+ 16bit single-shot timers with external reset. (this feature make prices go to hell)

I found that I can meet this requirements with a TMS320F28027 from TI or a SAM4 from Atmel, but both of them are beyond my target price range.

Can anybody recommend a micro?

Cheers.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: nctnico on September 02, 2014, 06:48:35 pm
Did you look at the Psoc devices from Cypress? The programmable logic block may save your bacon.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: mazurov on September 02, 2014, 06:58:04 pm
Take a look at PIC24xxKM, seems to have everything you require.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: Artraze on September 02, 2014, 07:06:54 pm
The STM32F0 series would work, but unfortunately the industrial temp range is usually non-stock so unfortunately sourcing them in quantities <1500 may be an issue.

Have you looked at Freescale's Kinetis line?  I haven't done too much with them so I don't know if their timers would fit the bill, but they're good, cheap and should meet all your other requirements.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: miguelvp on September 02, 2014, 07:56:52 pm
Did you look at the Psoc devices from Cypress? The programmable logic block may save your bacon.

PSoC 3 and 5LP are not offered in 105 C

PSoC 4 only 3 chips meet the 105 C but has a single ADC not 5 of them, but meets the 16 bit timer since it has 4 timer/counters and it seems they can be configured as a single shot:

Edit: the single 12 bit SAR ADC actually uses 8 channels, page 5 of the 4200 datasheet, but that's for the 85 C chip not for the automotive ones but the datasheets for those ones are not available.
http://www.cypress.com/?docID=46322 (http://www.cypress.com/?docID=46322)

Quote
Timer/Counter/PWM Block
The Timer/Counter/PWM block consists of four 16-bit counters
with user-programmable period length. There is a Capture
register to record the count value at the time of an event (which
may be an I/O event), a period register which is used to either
stop or auto-reload the counter when its count is equal to the
period register, and compare registers to generate compare
value signals which are used as PWM duty cycle outputs. The
block also provides true and complementary outputs with
programmable offset between them to allow use as deadband
programmable complementary PWM outputs. It also has a Kill
input to force outputs to a predetermined state; for example, this
is used in motor drive systems when an overcurrent state is
indicated and the PWMs driving the FETs need to be shut off
immediately with no time for software intervention.

This is the parametric search:
http://www.cypress.com/?id=4976&addcols=181&parametric=html&filter_181=105#parametric (http://www.cypress.com/?id=4976&addcols=181&parametric=html&filter_181=105#parametric)

The 3 results don't yield to datasheet information nor price, so you gotta contact them for details, but just one ADC for what it seems.

Edit: PSoC 1 do offer 105 C chips and can do up to two ADCs with up to 14 bits resolution and digitally configurable timers up to 32 bits.

Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: dannyf on September 02, 2014, 08:02:51 pm
Quote
Timer: 1+ 16bit single-shot timers with external reset. (this feature make prices go to hell)

Unless you meant something specially, the above features can be easily programmed into and implemented on pretty much any mcu/timer.

The reason they aren't offered on many mcu is likely that they can be so easily programmed.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: eecook on September 02, 2014, 08:32:06 pm
Quote
Timer: 1+ 16bit single-shot timers with external reset. (this feature make prices go to hell)

Unless you meant something specially, the above features can be easily programmed into and implemented on pretty much any mcu/timer.

The reason they aren't offered on many mcu is likely that they can be so easily programmed.

Thanx Danny. I know it's easy to program such a function, but for this application it won't work. The MCU is intended to control a PSU working at 250Khz with very stringent control requirements. To perform the control adequately there's an event detection implemented with analog circuitry and from the moment the event is detected, to the moment the timer is re-triggered no more than 50ns can take place. I think that leaves the software option out.

Cheers!
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: dannyf on September 02, 2014, 09:55:32 pm
Quote
250Khz ... 50ns

With that kind of requirement, you will likely end up with a hardware solution (logic gates or fpga).

A software solution (aka mcu) is unlikely to work here.

Having said that, if you need 50ns reaction time in a 250Khz power supply, you may want to rethink your approach.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: nctnico on September 03, 2014, 01:11:53 am
That sounds like a current protection to me. In one of my designs I used a JK flipflop with reset which drives the enable of the MOSFET driver. The flipflop gets set by every rising edge of the PWM pulse and reset when the current limit hits. This effectively limits the PWM duty cycle during short circuit.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: Artraze on September 03, 2014, 04:15:14 am
I would be curious to hear a bit more about the application.  It seems that you want event -> reset to be <50ns, but you haven't said what happens after that.  It sounds rather like you'd then have the counter count up to a 9-16bit value and then... ?

It sounds to me like you don't really need an external reset one shot timer.  Here are a couple software possibilities:

Because microcontrollers can handle interrupts with quite deterministic timing, you can just characterize the delay...  Does it really matter that you reset in <50ns if you're just gong to count to 10ms?  Simply determine the interrupt latency and subtract that from your target count and you're all set.

You could almost certainly also just using normal input capture.  Simply have the timer run constantly, and use input capture with an interrupt.  When the interrupt fires, take the captured value, add your delay (modulo 16-bits), set that in a compare register, and then enable the compare interrupt.  It's basically the same as a reset, but uses the captured value as a offset.  Not as convenient, but it would work.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: eecook on September 03, 2014, 05:48:55 pm
Quote
250Khz ... 50ns

With that kind of requirement, you will likely end up with a hardware solution (logic gates or fpga).

A software solution (aka mcu) is unlikely to work here.

Having said that, if you need 50ns reaction time in a 250Khz power supply, you may want to rethink your approach.

What do you mean? (see comment below)

That sounds like a current protection to me. In one of my designs I used a JK flipflop with reset which drives the enable of the MOSFET driver. The flipflop gets set by every rising edge of the PWM pulse and reset when the current limit hits. This effectively limits the PWM duty cycle during short circuit.

It is not for a current protection.

I would be curious to hear a bit more about the application.  It seems that you want event -> reset to be <50ns, but you haven't said what happens after that.  It sounds rather like you'd then have the counter count up to a 9-16bit value and then... ?

It sounds to me like you don't really need an external reset one shot timer.  Here are a couple software possibilities:

Because microcontrollers can handle interrupts with quite deterministic timing, you can just characterize the delay...  Does it really matter that you reset in <50ns if you're just gong to count to 10ms?  Simply determine the interrupt latency and subtract that from your target count and you're all set.

You could almost certainly also just using normal input capture.  Simply have the timer run constantly, and use input capture with an interrupt.  When the interrupt fires, take the captured value, add your delay (modulo 16-bits), set that in a compare register, and then enable the compare interrupt.  It's basically the same as a reset, but uses the captured value as a offset.  Not as convenient, but it would work.

That would be a dissaster!  :)


It is a regular flyback operating in boundary-mode at 250Khz. When the boundary condition is met, there's gonna be ringing on the secondary due to the diode's capacitance and any parasitic capacitance. This voltage will be reflected on the primary side, and substracted from the DC bus you get the voltage the mosfet is blocking. To mimimize losses, the mosfet has to switch on when Vds hits a minimum.  This ringing has a period of 500ns roughly, so I am considering 10 times less than that is a reasonable amount of time from event to control action.
The timer is there to drive the mosfet on, right after the boundary condition is met, since the duty cycle is very low due to the boundary-mode operation, I need high resolution on the driving pulse.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: f5r5e5d on September 03, 2014, 09:26:59 pm
if it does mostly the same thing each cycle can you calculate, set next cycle switch time based on previous cycle measurement, switch times?

may still have internal cycle current limiting that doesn't hit peak efficiency but does well enough to not kill the parts
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: Maxlor on September 03, 2014, 11:06:36 pm
While I'm not sure I've understood what you want to do 100%, I think a cheap PIC16F1782 8bit MCU should work. It is well under your price limit, there is an -E variant that works up to 125°C, it has 11 12-bit ADC channels, and a 16 bit timer.

For the timer, there's no dedicated external reset, but there is external gate control which includes a pulse mode. So you could set up the timer in software, with an external pin as gate that starts the timer. On timeout, the MCU software would then reset the gate (for pulse mode) and counter value (thus making it singleshot) and of course do the actual action you want to have done on timeout.

Or maybe I misunderstood and you want the timer period to be that fast? Won't work then I guess.
Title: Re: MCU w/ single-shot 16-bit timer w/ external reset?
Post by: eecook on September 05, 2014, 01:16:37 pm
The STM32F0 series would work, but unfortunately the industrial temp range is usually non-stock so unfortunately sourcing them in quantities <1500 may be an issue.

Have you looked at Freescale's Kinetis line?  I haven't done too much with them so I don't know if their timers would fit the bill, but they're good, cheap and should meet all your other requirements.

It seems like the MKL04Z32VLF4 from Freescale does everything I need and is only 1.53USD @ 100 units in Digikey.  I'm making a sample request :). Thanx for the suggestion.