View previous topic :: View next topic |
Author |
Message |
dan king
Joined: 22 Sep 2003 Posts: 119
|
18f2553 USB failure after low voltage operation |
Posted: Fri Mar 06, 2015 8:27 am |
|
|
I have code that makes use of the USB VCP for the 18f2553. The code has been working well for a project that drives a DC motor using PWM for speed control. The HW uses the UBW board purchased from Sparkfun. To debug I was developing the code with the pic powered from the USB port but got to a point where I finally untethered the USB connection and powered the pic from the same DC supply as the motor.
On the first standalone attempt I found that when the motor starts, the DC supply sagged severely but the PIC continued to function properly, or so I thought. After running for a little while I decided to make some further code changes on the PIC so I reconnected the USB connection to use the bootloader to update and suddenly realized the bootloader was no longer functional. After further investigation I found that the VCP was no longer functioning as well. It appears that the USB transceiver was damaged due to the low voltage event? I replicated the problem with a second UBW board. I used the NOLVP fuse so it doesn't appear to be a program memory problem.
Any insight on why this might be happening? The fuses listed are shown below:
Thanks,
Dan
CCS PCH C Compiler, Version 4.074, 44415
Code: | #include <18F2553.h>
#device ADC=12 //18f2553 has 12 bit adc (8 or 12)
#fuses CPUDIV1 //oscillator postscaler = PLL/2
#fuses HSPLL //HS crystal option with PLL
#fuses PLL6 //PLL postscaler div 6 for UBW ver 2.0 with 24Mhz crystal = 4Mhz to PLL input
//#fuses PLL5 //PLL postscaler div 5 for UBW ver 1.0
#fuses USBDIV
#fuses NOWDT //no wdt
#fuses NOPROTECT //no code protect
#fuses NOLVP //no Low voltage Programming
#fuses NOXINST //no extended instructions
#fuses vregen //usb voltage regulator enable
#fuses MCLR //enable external reset so bootloader can be started !!!
#fuses WRTB //disable write to boot block to protect bootloader
#fuses NOPBADEN //configure port B as digital I/O on reset
|
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri Mar 06, 2015 8:57 am |
|
|
Sounds like the PIC got zapped by the sagging power supply, not that uncommon.
When running PICs( any micro) from a 'motor' power supply it is very,very important to have proper 'decoupling' as well as EMI suppression on the motors.decoupling includes R-C-L in the right spots.
A 'sagging' power suppy means it doesn't have enough current capacity. general 'rule of electrons' for me is 5* the starting or stall current of ALL motors in the project.
IE 2 motors ,stall current 1 amp ....2*1*5=10 amps would be the spec for the PSU.
yes, overkill BUT reliablilty is more important than pinching pennies.
Jay |
|
|
dan king
Joined: 22 Sep 2003 Posts: 119
|
|
Posted: Fri Mar 06, 2015 9:02 am |
|
|
surprisingly the PIC is still running, just no USB.
The motor system is from a production design and does have RLC suppresion and decoupling. The supply sags because it was never intended to have electronics, battery operated without control.
this was setup for data measurement. I have modified the system so the sensitive electronics run off its own supply so no issues now but I still wanted to figure out why the USB transceiver died when not connected.
Thanks for your input |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Fri Mar 06, 2015 9:50 am |
|
|
Iit could have been airborne EMI or more likely came in through the power pins of the PIC. Within the die of the PIC, the USB subsection might be close to those pins. All a guess based on past experiences of 'magic smoke leaving a micro'. If the PIC has 2 sets of VDD,VSS you need to put caps on both sets, real close to PIC.
As for it still kinda working, well, in the early days I installed a 16C84 backwards, it got hot, I put in back in correctly and it RAN ! Tough little guys...
If you stop to think what is 'under the hood', inside the epoxy you kinda wonder HOW it does work...
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 06, 2015 10:03 am |
|
|
Quote: | I decided to make some further code changes |
And then it failed.
Put your original working code back in before assuming hardware failure. |
|
|
dan king
Joined: 22 Sep 2003 Posts: 119
|
|
Posted: Fri Mar 06, 2015 12:10 pm |
|
|
I was never able to load modifed code. When I decided to make the changes is when I found I could no longer access the USB port. I first thought the bootloader somehow got overwritten but then I realized that the VCP was gone too. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19550
|
|
Posted: Fri Mar 06, 2015 12:44 pm |
|
|
Minimum supply voltage for the chip is 4.2v.
A simple undervoltage shouldn't damage it, but a motor can easily introduce spikes onto the supply, and if for example the voltage oscillates, this could blow the USB regulator. Trapping the spikes cased by a motor, needs good design.
I think you have now found why all the 'old hands' here will harp on and on, about really careful decoupling and protection. The PIC's are quite rugged, but parts _will_ become damaged, if you do not treat them with care.
The one that would kill the USB regulator, is if there is more smoothing on Vusb, than on the Vdd rail, and the voltage on the Vdd rail dropped sharply, reverse biasing the USB regulator. This applies to all voltage regulators, and can kill any of them. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
Re: 18f2553 USB failure after low voltage operation |
Posted: Fri Mar 06, 2015 3:08 pm |
|
|
Quote: |
CCS PCH C Compiler, Version 4.074, 44415
|
This is often the pirated version (4.074) of CCS ... very old ( 7 years ago!!!) and very very buggy...
Btw, consider upgrading to at least 4.141 (if you want to stay in the v4 compiler) or get the v5.042
Just saying! _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
|