Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic 18f usb + pwm2

Status
Not open for further replies.

ARandomOWl

New Member
I am using a PIC 18F2458 with a modified version of the Microchip USb stack PICDEM demo. USB is working fine along with PWM on CCP1 to change the brightness of an LED using PC software. Ok, no problem.

But when I try to initialize the 2nd PWM channel (using OpenPWM2() in C18), USB stops working (windows reports an unidentified device). I have tried several things including stopping PWM1 first, changing CCP2 to multiplex with a different pin, messing with TMR2 settings, etc. but nothing has made a difference.

I have bypass caps on Vcc and Vusb and I'm using a 20MHz XTAL (using HSPLL and full speed USB). I found an old thread over at the Microchip forum but that didn't help.

Any ideas anyone?
 
Yes sorry, please forgive me for not providing it in the first place.

Schematic:
main.png

I wasn't sure which part of my code was the most important. I hope you don't mind, I have attached my whole main.c: View attachment main.txt
 
Feel free to try. Make sure you post in the right forum there.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top