Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic18f4550 very strange problem

Status
Not open for further replies.

devil6600

Full Member level 5
Joined
Nov 15, 2008
Messages
250
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,298
Activity points
2,931
Hi

I am facing very strange issue while using pic18f4550. Sometime back I made a simple homemade prototype board for experimentation with USB. This design worked, so in the same design I added few components and sent it for pcb fabrication. When I got the completed PCB I installed all the components(xtal, mclr resistor, etc) and pic18f4550. On programming the pic and then powering up the board it worked, but it was almost 10times slow, because of this usb communication fails. After few tests I determined that external oscillator (20Mhz) is not working or pic is not detecting external oscillator and running on internal oscillator. Then I changed the oscillator, it didn't worked. I changed the pic to new one it didn't worked.

I am using mcp1703 3V LDO as power source to the pic

I've checked the following:
1. Crystal and cap connections to PIC and Gnd.
2. Gnd and +3V connections on PIC.
3. MCLR is being pulled up by a 2.2K to +3V
4. Crystal is correct type. Tried one from an older working board.
5. Three board all have the same problem

you can view the pcb board and schematic here:**broken link removed**(look right side of the board for pic18f4550)
**broken link removed**

Thanks
 

thanks BigDog for your reply.
i have two different boards with me, one which i made earlier (homemade board) and another which i got from pcb fab. for testing purpose i have created a simple hex file with the following code in basic and uploaded to both the boards:

config bits:
Code:
        NOLIST
    ifdef PM_USED
        LIST
        "Error: PM does not support this device.  Use MPASM."
        NOLIST
    else
        LIST
        LIST p = 18F4550, r = dec, w = -311, w = -230, f = inhx32
        INCLUDE "P18F4550.INC"	; MPASM  Header
        __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
        __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
        __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
        __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
        __CONFIG    _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
        NOLIST
    endif
        LIST
EEPROM_START	EQU	0F00000h
BLOCK_SIZE	EQU	32
code:
Code:
DEFINE OSC 48          
DEFINE LOADER_USED 1
adcon1 = 15

USBBufferSizeMax   con 8  ' maximum buffer size
USBBufferSizeTX    con 8  ' input 
USBBufferSizeRX    con 8  ' output

' the USB buffer...
USBBuffer        Var Byte[USBBufferSizeMax] 
USBBufferCount   Var Byte 

' ************************************************************
' * main program loop - remember, you must keep the USB      *
' * connection alive with a call to USBService every couple  *
' * of milliseconds or so...                                 *
' ************************************************************
usbinit ' initialise USB...
ProgramStart:
   gosub DoUSBIn
   gosub DoUSBOut
   if USBBuffer[0] = 02 then
    high PORTA.0
   Else
    Low PORTA.0
   endif
   goto ProgramStart  

' ************************************************************
' * receive data from the USB bus                            *
' ************************************************************
DoUSBIn:
   USBBufferCount = USBBufferSizeRX              ' RX buffer size
   USBService                                    ' keep connection alive
   USBIn 1, USBBuffer, USBBufferCount, DoUSBIn   ' read data, if available
   return
    
' ************************************************************
' * wait for USB interface to attach                         *
' ************************************************************
DoUSBOut:
   USBBufferCount = USBBufferSizeTX              ' TX buffer size
   USBService                                    ' keep connection alive
   USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
   return

on usb connection my homemade board enumerates properly but the pcb fab board fails.
 

According to your original posting and code you are using a PIC18F4550 which has a minimum operating voltage of 4.2V in all oscillator modes.

Reference PIC18F2455/2550/4455/4550 Data Sheet, pg. 369, Footnote 2.

The stated minimums apply for the PIC18LF products in this device family. PIC18F products in this device family are rated for 4.2V minimum in all oscillator modes.

Beside the above issue,

Reference PIC18F2455/2550/4455/4550 Data Sheet, pg 170, Section 17.2.2.8 Internal Regulator:

The regulator can be enabled or disabled through the
VREGEN Configuration bit. When enabled, the voltage
is visible on pin VUSB whenever the USBEN bit is also
set. When the regulator is disabled (VREGEN = 0), a
3.3V source must be provided through the VUSB pin for
the internal transceiver.

Note 1: Do not enable the internal regulator if an
external regulator is connected to VUSB.
2: VDD must be equal to or greater than
VUSB at all times, even with the regulator
disabled.

According to the statement in highlighted in red, Vdd >= Vusb at all times. Therefore, even if you switch to PIC18LF version you could run the PIC at 3V, but without the USB functioning.

Then there is the issue of the oscillator frequency at lower voltage, which the maximum operational frequency of a LF drops dramatically as the operating voltage is lowered.

BigDog
 
thanks for pointing it out i'll remember these points.
now i have removed the ldo and shorted power line, so usb vdd (5v) is directly connected to 18f4550. i made a quick program and uploaded it to both the pic (homemade board and new board). here is the program:
Code:
DEFINE OSC 48
adcon1 = 15
OSCCON = %01110000

led var porta.0

test:
high led
pause 100
low led
pause 100
goto test
this program should blink led 5 times a second.
on connecting power i am getting different results, homemade pic board blinks led 5 times a second where as the new board pic blinks led once in a second.
 

While I'm not familiar with BASIC for PICs, my first question would be, are both boards configured to use the internal oscillator?

And are both now supplying the PIC 5V?

BigDog
 
Last edited:

There are a few things that need to be looked at.
First check if the capacitor at VUSB is properly connected, and that you are getting a reading at the pin.Get rid of the LDO, if possibly remove it from the board.
If you used SMD devices in the proto board and the circuit is the same, then something is wrong with the board.
Either a design error, a non connected plane or connection are a short circuit.
Same thing happened to me once and upon close examination of the PCBs I found out that there was short circuit on the board, around 6mil and that was the source of all problem. I would recommend to first eliminate possibilities of design flaws mentioned above and then check the board with a magnifying glass under light to rule out short circuit.
 

BigDog its completely logical to think about error in the configuration bits for oscillator, but i am using the same hex file for both the pics (i.e. board from pcb fab house and my homemade board). on my homemade board the code works exactly as expected but on the other board its working very slow.

adibr i have already removed ldo and checked for short and continuity, everything seems to be 100% ok
 

The PIC 18F4550 can't work fine with your 3V supply...

check with USB powered mode. the USB will deliver 5V. if its working, then the problem was with your power supply
 

i got it working on another board. there is some unknown problem in the previous board.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top