#1362 PIC16: VUSB problem


I can't activate the VUSB (pin 14) on a PIC18F2455 compiling my project with SDCC release 2.7.0 and gputils 0.13.4.

sdcc -v produces:
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.0 #4
818 (May 31 2007) (MINGW32)

gplink -v produces:
gplink-0.13.4 alpha

I wrote a small source file that does nothing but activate VUSB (with the instruction UCONbits.USBEN = 1;).
The VUSB pin voltage is some millivolt over zero but not 3.3 V, the expected value.

The strange thing is that compiling the same project with SDCC 2.5.6 it works well, I get the 3.3 V out of the pin 14.
sdcc -v produces:
SDCC : pic16/pic14 2.5.6 #4161 (May 10 2006) (MSVC)
gplink is the same.

I'm uploading the file Makefile_main with the makefile I used to build the project at the top and the source file main.c at the bottom.
I used Microsoft nmake to build the project.
Anyway in that file there are the compiling options I used.

Best regards.


  • mirkobo

    mirkobo - 2007-08-11

    Makefile + main.c

  • xander

    xander - 2007-08-13

    Logged In: YES
    Originator: NO

    I've encountered this problem. There is a simple workaround. Recompile the libraries using the 2455 (or 4550, ...) as the default processor.

    IIRC, the default libraries don't allocate the right address range for the 2455's SFRs (the default PIC 18, the 242 family, has fewer SFRs).


  • mirkobo

    mirkobo - 2007-08-14

    Logged In: YES
    Originator: YES

    I've recompiled the libraries using the 2455 as the default processor and now I get 3.3 V on pin 14 (VUSB).
    Thank you very muxh Xander.

  • xander

    xander - 2007-10-24

    Logged In: YES
    Originator: NO

    Try rebuilding the libraries using 2455 (or 4550, ...) as the default processor. Do not use the libraries in the standard install of sdcc. The 2455 family has SFR's out of the range of what is in stock libraries (which I believe are 242 based).


  • Maarten Brock

    Maarten Brock - 2011-09-18
    • summary: VUSB problem --> PIC16: VUSB problem
  • Philipp Klaus Krause

    • Category: --> PIC16

Log in to post a comment.