PDA

View Full Version : PWM GENERATION OF 25nS - 70nS outputs



longpole001
- 16th October 2014, 02:56
Hi guys is it possable to generate PWM with output in 25ns - 70ns timing on 18F26k22 ?

richard
- 16th October 2014, 03:27
its not a question that can be answered unless you state the pwm period and the pwm resolution required along with fosc

PWM Period = PRx + 1  4  TOSC  (TMRx Prescale Value



Pulse Width = CCPRxL:CCPxCON<5:4>  T OSC  (TMRx Prescale Value)


I cant get the duty cycle formula to paste into this properly , its in the data sheet

longpole001
- 16th October 2014, 05:10
hI RICHARD ,

thinking 64mhz internal , with a 25ns - 70ns pulse , with a off time of about 30ns

output drive a high speed Mosfet driver chip

richard
- 16th October 2014, 05:58
@64Mhz every clock cycle is 15.6 nS you could in theory have 2bit pwm
70nS+30nS /15.6=5

longpole001
- 16th October 2014, 08:54
mmm have you ever tried to get a pwm at such a speed and it work reliably richard ?

richard
- 16th October 2014, 10:00
it even tricky on a 800mhz raspberry pi
http://www.raspberrypi.org/forums/viewtopic.php?f=72&t=67741
maybe
MAX9471/MAX9472 clock generator

pedja089
- 16th October 2014, 10:02
That is more RF circuitry than digital...
To get square wave at that speed you are talking about frequency components of tens of MHz, at least... You must use transmission lines, matched source and load to get it working.
And that isn't PWM because you have fixed off time. So it's variable frequency with constant off time. You can check out constant on time DC/DC for ideas, just invert output.
If I was doing that, I'll try create something like NE555 with LTC1394, fixed OFF time, and adjustable current source for charging on time capacitor...
You can find some ideas in Linear AN94 (http://cds.linear.com/docs/en/application-note/an94f.pdf) for delay circuit.
So use pic just to adjust charging current.
EDIT:
Just replace R1 with variable constant current
http://www.electronics-tutorials.ws/waveforms/tim47.gif
And build NE555 on steroids...
Then ON time depending linearly on C and current. Off depending on R2 and C.

longpole001
- 16th October 2014, 12:23
yes i have done a 555 at 100ns , and used the inverter and resister / cap arrangement to produce a 30ns time , with a about 200ns space between , other way i just use a powered xtl with buffer and programaable counter for speed changes in multipuls for the base xtl , but its not about how to make the pulse from other parts

i have used the 64mhz clockref out pin from these chips though an external buffer to clean up the waveform but i not sure if i can use that approch as an input for the hpwm and its control ?? and still get it to work

Acetronics2
- 16th October 2014, 15:35
yes i have done a 555 at 100ns ,

With a datasheet stating 3 MHz as a max frequ ??? ... and moreover with rise time OR fall time @ 100 ns ... ???

Hum, hum ...

Alain

longpole001
- 17th October 2014, 02:17
it was to trigger a laser pulse at 30 ns , and am looking at how i can do this from pic

richard
- 17th October 2014, 02:33
@64 MHz 1 clock = 15.6 ns , 1 instruction 62.4 ns . its not going to fly

longpole001
- 17th October 2014, 03:11
http://www.jensign.com/opto/ledlaserdrivers/index.html

using the hand drawn image - as test for laser driver

longpole001
- 17th October 2014, 04:07
ok thanks richard

HenrikOlsson
- 17th October 2014, 06:22
Hmmm, actually, in PWM mode the CCP module is run from TMR2 which is concatenated with the two bits from the internal clock divider (which is where the "extra" bits of resolution comes from) so each "dutycycle bit" represents one TOsc - not four. From the 18F25K22 datasheet;

PulseWidth = CCPRxL : CCPxCON<5:4> * TOsc * TMRxPrescaler value
So with a 64MHz oscillator it should be possible to generate 15.625ns pulses using the CCP module.

/Henrik.

longpole001
- 17th October 2014, 09:05
any code worth putting into the 18f67k22 i have on hand hendrick , i am assuming the simple commands wont cut it and the registers need to be setup to make use of it ?



define HPWM4_TIMER 2 ' HPWM4 TO USE TIMER 2

hpwm 4 ,xx ,xxx 'CPP4 Wduty , freq

richard
- 17th October 2014, 11:58
as I stated in post 4 for the range of pulses you specified the pwm resolution is very limited
0b000 = 0ns
0b001=15.6ns
0b010=31.2 ns
0b011=46.8 ns
0b100=62.4 ns
0b101= over range

and as pedja089 stated a fixed 30ns deadtime means hpwm will not cut it / the period reg will need to be changed with every change in pulse width to maintain the dead time

longpole001
- 17th October 2014, 23:06
ok ill give it try and see ,

richard
- 18th October 2014, 01:12
pulsewidth var byte ; 0 -5 max is 5

ccp1con=12; pwm mode active high

pr2= pulsewidth+2
ccpr1l=pulsewidth.2
ccp1con= 12+ ((pulsewidth&3)<<4) ;low bits and set the pwm


if you change the pulsewidth you must change pr2 and ccpr1l also
don't expect the output to propagate far without severe deformation
note that 74series gates have propagation delays of 90ns and 20ns rise/fall times ,74f is better at 8 and 3 . ecl would be better still


ps needless to say the tris bit for the output must be cleared

you will need a good cro to measure this 200mhz+ to get a good look

longpole001
- 18th October 2014, 22:58
ok thanks richard , i have 74f's on hand , and 200mhz cro

longpole001
- 16th November 2014, 00:06
has anyone used a standalone PWM chip interfaced back to a pic for this , i know the dsPIC33F support a high speed PWM unit , but that not any good when using PBP

Marv
- 26th November 2014, 19:15
Have you looked at the 16F1786, it has a 16bit PWM that can run at 64MHz

HenrikOlsson
- 27th November 2014, 06:08
Now that is one cool chip.
16bit PWM with a boatload of modes and complementary outputs, 12bit ADC with differential inputs, 8bit DAC, 2 opamps, 4 comparators + the all the usuall stuff - and IOC on all pins, individual pullups.
As far as I can see though, the max operating frequency is 32MHz.

I'll make sure to include a couple in my next Digikey order.

Thanks Marv!

longpole001
- 28th November 2014, 00:15
yes its 32mhz from what i can see.

Marv
- 1st December 2014, 14:03
Max operating frequency is 32MHz, but the PWM can operate at 64MHz.

From the data sheet:

24.2.5 PSMC TIME BASE CLOCK
SOURCES
There are three clock sources available to the module:
• Internal 64 MHz clock
• Fosc system clock
• External clock input pin

Demon
- 4th December 2014, 04:40
Now that is one cool chip.
16bit PWM with a boatload of modes and complementary outputs, 12bit ADC with differential inputs, 8bit DAC, 2 opamps, 4 comparators + the all the usuall stuff - and IOC on all pins, individual pullups.
As far as I can see though, the max operating frequency is 32MHz.

I'll make sure to include a couple in my next Digikey order.

Thanks Marv!

Interesting.

Am I right in believing that it is better to move towards 18F because 16F are an older generation and most likely to be retired "eventually"?

Robert