USB function generator

USB function generator

Postby DarioG » Fri Nov 10, 2017 8:32 pm

Am just posting the Full Code for an USB function generator based upon a
PIC24EP512GU810 (possibly a dsPIC33EP512MU810 should work pin-to-pin compatible).
Features 5..35000000Hz as Square Wave, with frequency approximation as close as possible (of course, not so perfect above 1MHz :) ), and I am going to go down to 0.1Hz using some further trick;
Same range for Rectangulare Wave, with duty-cycle selectable in 0.1% steps (same, and more, approximation rules apply);
0.1 .. 250KHz Sine, Triangle, Sawtooth Wave - generated with 16levels synthesis (8 at frequencies above 100KHz);
White Noise; and Pink in the to-do list (i.e. do something in software or add a low-pass filter at the output :) )

Schematic is basically "nothing" i.e. just decoupling capacitors, USB connector at its pins, a few debugging leds, a PWM output - and an I2C EEprom that we used to store waveform so that the device can run stand alone with the programmed wave (the EEprom was already there since we created this PCB for a CAN interface).
Output can be amplified using a large-bandwidth OpAmp such AD8007: USB interface already has an "Amplitude" parameter, unused at the moment.

One possible, simple improvement would be using an 8bit DAC (more is useless, due to IRQ overhead) in place of PWM.

have fun!
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby DarioG » Fri Nov 10, 2017 8:33 pm

usb_gen_funz1.jpg
usb_gen_funz1.jpg (47.64 KiB) Viewed 552 times
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby DarioG » Fri Nov 10, 2017 8:34 pm

usb_gen_funz2.jpg
usb_gen_funz2.jpg (28.83 KiB) Viewed 552 times
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby DarioG » Fri Nov 10, 2017 8:35 pm

firmware:
Attachments
USB_gen_funz.zip
(215.79 KiB) Downloaded 33 times
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby DarioG » Fri Nov 10, 2017 8:39 pm

and VB 2010 project (so far)
Attachments
USBGeneratoreFunzioni.zip
(109.34 KiB) Downloaded 29 times
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby DarioG » Sun Nov 12, 2017 2:51 pm

Updated code that uses DMA - and reaches up to 2MHz/16levels sine/triangle/sawtooth waves!
Attachments
USB_gen_funz.zip
(221.86 KiB) Downloaded 34 times
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products

Re: USB function generator

Postby ChollyMo » Mon Nov 13, 2017 4:08 am

How are you finding the VB Cinzia ? I used to use and love it, but I never could find a straight forward way to get it after version 6.0. I was just recommended to Visual Studio 2017 , C Sharp. Since I haven't used Basic in a decade and dabble with PICs in C, it seemed to make the most sense.
ChollyMo
 
Posts: 4
Joined: Mon Nov 13, 2017 3:39 am

Re: USB function generator

Postby DarioG » Mon Nov 13, 2017 3:29 pm

I basically used only 2010, in the latest times (old 90s versions too but they were something different :) )

With VB2010 I prepare those simple software for connecting USB boards.
All we are praying / is an earthquake in Chandler
User avatar
DarioG
Verified identity
 
Posts: 34
Joined: Thu May 29, 2014 8:42 am
PIC experience: Professional 5+ years with MCHP products


Return to PIC24

Who is online

Users browsing this forum: No registered users and 1 guest