18F4550 programming failed using PICkit4 while verifying "User ID memory"


+ Reply to Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Question 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Any idea what it's crying about?

    Name:  18F4550 verify failed.jpg
Views: 16575
Size:  107.9 KB

    I had to slow the programming speed to SLOW or else I'd get speeding errors.

    Program, configuration and EEdata memory seem to verify just fine. It looks like it failed at "User ID memory" - whatever that is.

    This was programmed 15 years ago; no idea what's on that memory location.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Out of curiosity, did you try the PIC to see if it actually programmed? Usually the "User ID Failed" shows up before it even tries to program. Just asking.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    So I tried with a brand new 18F4550, same error:

    Name:  18F4550 verify failed new.jpg
Views: 16264
Size:  104.9 KB

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Quote Originally Posted by mpgmike View Post
    Out of curiosity, did you try the PIC to see if it actually programmed? Usually the "User ID Failed" shows up before it even tries to program. Just asking.
    It says "programming/verify" complete though?

    Gotta go feed the dogs. Gonna try with just a blinky program (this is an old program that worked way back when).

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Aug 2011
    Posts
    412

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    I don't think it's complaining about the UserID area, it's just a poorly arranged display making it look that way.
    The UserID is located at 0x200000-0x200007 in that part.

    It looks to me that it's complaining about location 0xcc0, which is in program memory.
    Try doing an erase and then a blank check.

    There's a later toolpack for the 18F devices... maybe try updating it?

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Got a new pack, same problem.

    Name:  18F4550 new pack failed.jpg
Views: 14350
Size:  98.4 KB


    It already says ERASIN SUCCESSFUL midway down the pic.

    Not sure what to try next. I don't get why I can program a 16F877 without problems.

    Gonna gut my program and try to BLINKY, see if that makes a difference.

    Robert

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Gutted all the USB and interrupt stuff, added just a basic blinky, and it worked.

    Name:  18F4550 blinky worked.jpg
Views: 12190
Size:  332.5 KB

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    This is the complete program that failed.

    Same OSC speed, same CONFIGs, gutted everything except ALLDIGITAL and ADCON1.

    Code:
    '***************************************************************************
    '*  Name     : KK 18F4550 C152.pbp                                         *
    '*  Author   : Robert Hedan                                                *
    '*  Date     : Apr 7 2023                                                  *
    '*  Version  : 1.0                                                         *
    '*  Notes    : MICROSOFT FLIGHT SIMULATOR 2023                             *
    '*               Cessna 152 control panel (Asobo)                          *
    '*  Hardware : PIC 18F4550, 20mhz crystal                                  *
    '*           : Lab X1 Experimental Board                                   *
    '*               Oscillator Jumpers A = 1-2                                *
    '*                                  B = 1-2                                *
    '*                                  C = 2-3                                *
    '*           : PICkit4 Programmer v?                                       *
    '*  Software : PIC Basic Pro v3.0.8.4                                      *
    '*           : MicroCode Studio Plus v5.0.0.5                              *
    '*           : MPASM v5.62                                                *
    '*  PIC mods : plastic USB connector hot-glued onto top of PIC             *
    '*           : leads soldered directly to top of PIC pins                  *
    '*           : two 0.1uF ceramic caps in parallel across VUSB and VSS      *
    '*           : USB VDD is NOT connected                                    *
    '*           : USB GND is wired to PIC                                     *
    '*           : D- wired to C4 (pin 23)                                     *
    '*           : D+ wired to C5 (pin 24)                                     *
    '***************************************************************************
    
    #CONFIG
        CONFIG    PLLDIV=5, CPUDIV=OSC1_PLL2, USBDIV=2, FOSC=HSPLL_HS
        CONFIG    PWRT=OFF, BOR=ON, BORV=1, VREGEN=ON, WDT=OFF
        CONFIG    CCP2MX=ON, PBADEN=OFF, LPT1OSC=OFF, MCLRE=ON
        CONFIG    STVREN=ON, LVP=OFF, ICPRT=OFF, XINST=OFF
    #ENDCONFIG
    
    DEFINE OSC 48
    
    ;================================== USB NOTES ==================================
    ; If you get an ERROR saying these registers are undefined?
    ;       Uncomment the corresponding line in DT_HID260:
    ;   UIE                VAR BYTE EXT  ; for PBP versions prior to 2.50
    ;   UEIE               VAR BYTE EXT
    ;   UIR                VAR BYTE EXT
    ;       - DT
    ;-------------------------------------------------------------------------------
    ; Before you put the PIC to sleep, you'll need to put the USB module in suspend
    ; mode UCON.1, which can only be done reliably when unplugged.
    ; 
    ; This disables the USB voltage regulator and stops the clock to the SIE, which
    ; will give the lowest current consumption.
    ; 
    ; The USB routines are not setup to handle a resume.
    ; So your best bet it probably to connect the +5V from the USB cable to one of
    ; the INT pins with a pull-down resistor.
    ;
    ; When the cable gets plugged in, it will generate an interrupt, at which point
    ; you would execute an @ RESET to reset the processor and initialize the USB again.
    ;   - DT
    ;-------------------------------------------------------------------------------
    ; Enable bits (IE), Interrupt Flags (IF) or Priority bits (IP).
    ; Don't "mess" with them. That includes GIE and PEIE or GIEL.
    ;   - DT
    ;-------------------------------------------------------------------------------
    ; Put the Interrupt definitions before the HID stuff.
    ;   - DT
    ;-------------------------------------------------------------------------------
    ; Both USB_INSIZE and USB_OUTSIZE can only be 8,16,32 or 64.
    ; If you want to send 10-bytes per report, it needs to be 16.
    ;   - DT
    ;-------------------------------------------------------------------------------
    ; Each USB status LED is optional, comment them if not used.
    ; They can be assigned to any pin, and no further action is required. 
    ;   - DT
    ;===============================================================================
    
    ;--- Setup all digital pins-----------------------------------------------------
    
    INCLUDE "ALLDIGITAL.pbp"        ; Set all pins as digital
    
    ;--- Initialize ----------------------------------------------------------------
        ADCON1 = %00001111     ; A/D Control
    '       Bit 7,  0 = n/a
    '       Bit 6,  0 = n/a
    '       Bit 5,  Vref- Source
    '               0 = VSS
    '               1 = Vref- (AN2)
    '       Bit 4,  Vref+ Source
    '               0 = VSS
    '               1 = Vref+ (AN3)
    '       Bit 3-0 1111 = All digital
    '               1110 = All digital, AN0 analog
    '               1101 = All digital, AN0 & AN1 analog
    
        INTCON2 = %00000000
    '       Bit 7, 0 = enabled, Pull-up resistors
    '       Bit 6, 0 = falling edge, B0 interrupt
    '       Bit 5, 0 = falling edge, B1 interrupt
    '       Bit 4, 0 = falling edge, B2 interrupt
    '       Bit 3, 0 = n/a
    '       Bit 2, 0 = low priority, TMR0 interrupt
    '       Bit 1, 0 = n/a
    '       Bit 0, 0 = low priority, Port B on-change
    
    ;--- Setup Interrupts ----------------------------------------------------------
    
    INCLUDE "DT_INTS-18.bas"        ; Base Interrupt System
    
    ASM
    INT_LIST  macro    ; IntSource,     Label,   Type, ResetFlag?
            INT_Handler   USB_Handler
        endm
        INT_CREATE               ; Creates the interrupt processor
    endasm
    
    ;--- Setup USB -----------------------------------------------------------------
    INCLUDE "DT_HID260.pbp"
    
    DEFINE USB_VENDORID    6017
    DEFINE USB_PRODUCTID   2000
    DEFINE USB_VERSION     1
    DEFINE USB_VENDORNAME  "USBDemon1"
    DEFINE USB_PRODUCTNAME "LabX1 Simple"
    DEFINE USB_SERIAL      "001"
    DEFINE USB_INSIZE      16   ;  IN report is PIC to PC (8, 16, 32, or 64)
    DEFINE USB_OUTSIZE     8    ; OUT report is PC to PIC
    DEFINE USB_POLLIN      1    ; Polling times in mS, MIN=1 MAX=10
    DEFINE USB_POLLOUT     10
    
    DEFINE USB_LEDPOLARITY 1       ; LED ON State [0 or 1]  (default = 1)
    DEFINE USB_PLUGGEDLED  PORTD,0 ; LED indicates USB is connected
    DEFINE USB_TXLED       PORTD,1 ;  "      "     data being sent to PC
    DEFINE USB_RXLED       PORTD,2 ;  "      "     data being received from PC
    
    ' Using only 4 bit bus to control LCD
    DEFINE  LCD_DREG      PORTD         ' Set LCD data port
    DEFINE  LCD_DBIT      4             ' Set starting data bit
    DEFINE  LCD_RSREG     PORTE         ' Set LCD register select port
    DEFINE  LCD_RSBIT     0             ' Set LCD register select bit
    DEFINE  LCD_EREG      PORTE         ' Set LCD enable port
    DEFINE  LCD_EBIT      1             ' Set LCD enable bit
    DEFINE  LCD_BITS      4             ' Set LCD bus size
    DEFINE  LCD_LINES     2             ' Set number of lines on LCD
    DEFINE  LCD_COMMANDUS 1000          ' Set command delay time in microseconds
    DEFINE  LCD_DATAUS    50            ' Set data delay time in microseconds
    
        TRISA = %00000000
        TRISB = %00000000
        TRISC = %00000000
        TRISD = %00000000
        TRISE = %00000000
    
    LoopCount       var byte
    UsbReceivedData var byte
    
        GOTO ProgramStart
    
    HandleRX:
        UsbReceivedData = 1             ' Set USB data received flag
    RETURN
    
    ProgramStart:
        FOR LoopCount = 1 TO 8          ' clear USB receive buffer
            USBRXBuffer[LoopCount] = 0
        NEXT LoopCount
    
        PAUSE 1500                      ' wait for PIC and LCD to stabilize
        LCDOUT  $FE,1,"LabX1 18F4550 USB"
        
    ProgramMain:
        IF NOT Plugged THEN             ' check if USB is plugged
            LCDOUT  $FE,$C0,"USB not plugged...  "
            WHILE NOT Plugged:WEND      ' wait until USB is plugged
            LCDOUT  $FE,$C0,"                    "
        ENDIF
    
    @       ON_USBRX_GOSUB  _HandleRX   ; check if USB data is received
    
        IF UsbReceivedData = 1 THEN
    
    REM     Do want you want with data received from USB in this IF statement
    
            LCDOUT  $FE,$C0, _          ' display USB data received
                bin8 USBRXBuffer[0], ":", bin8 USBRXBuffer[1]
    
            ARRAYWRITE USBTXBuffer, _   ' echo USB data back to PC
                [BIN8 USBRXBuffer[0], BIN8 USBRXBuffer[1]]
            IF TX_READY THEN GOSUB DoUSBOut
    
            UsbReceivedData = 0         ' Reset USB data received flag
        ENDIF
    
    REM     Your main process goes here:
    REM         - check input buttons.
    REM         - turn LEDs ON/OFF.
    REM         - communicate with other PICs.
    REM         - send USB data to PC.
    
        GOTO ProgramMain                ' main loop
    END
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    I've narrowed it down to USB logic. I probably have something out of date.

    The LCD and blinky on lower bits of Port D work fine.

    Code:
    #CONFIG
        CONFIG    PLLDIV=5, CPUDIV=OSC1_PLL2, USBDIV=2, FOSC=HSPLL_HS
        CONFIG    PWRT=OFF, BOR=ON, BORV=1, VREGEN=ON, WDT=OFF
        CONFIG    CCP2MX=ON, PBADEN=OFF, LPT1OSC=OFF, MCLRE=ON
        CONFIG    STVREN=ON, LVP=OFF, ICPRT=OFF, XINST=OFF
    #ENDCONFIG
    
    DEFINE OSC 48
    
    INCLUDE "ALLDIGITAL.pbp"        ; Set all pins as digital
        ADCON1 = %00001111     ; A/D Control
        INTCON2 = %00000000
    
    ' Using only 4 bit bus to control LCD
    DEFINE  LCD_DREG      PORTD         ' Set LCD data port
    DEFINE  LCD_DBIT      4             ' Set starting data bit
    DEFINE  LCD_RSREG     PORTE         ' Set LCD register select port
    DEFINE  LCD_RSBIT     0             ' Set LCD register select bit
    DEFINE  LCD_EREG      PORTE         ' Set LCD enable port
    DEFINE  LCD_EBIT      1             ' Set LCD enable bit
    DEFINE  LCD_BITS      4             ' Set LCD bus size
    DEFINE  LCD_LINES     2             ' Set number of lines on LCD
    DEFINE  LCD_COMMANDUS 1000          ' Set command delay time in microseconds
    DEFINE  LCD_DATAUS    50            ' Set data delay time in microseconds
    
        TRISA = %00000000
        TRISB = %00000000
        TRISC = %00000000
        TRISD = %00000000
        TRISE = %00000000
    
    ProgramStart:
    
        PAUSE 1500
        LCDOUT  $FE,1,"LabX1 18F4550 USB"
        
    ProgramMain:
    
            PORTD = %00001010
            PAUSE   500      
            PORTD = %00000101
            PAUSE   500      
    
        GOTO ProgramMain
    END

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Is there an option on PickIt 4 to erase the chip before write?

    When I had such messages the above solved the problem.

    Ioannis

  11. #11
    Join Date
    Aug 2011
    Posts
    412

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    If you look at the messages, when it fails the program end addr is 0xcbf.
    It's then not seeing the next addr 0xcc0 as erased... there's still something there.

    I think there's a setting to specify the full range and not let the PK4 pick it.

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Since I had never paid attention to a command line when I was using my old serial and later USB programmers, I had no clue what I should "verify", so, I verified everything.

    Name:  PK4 verification.png
Views: 13882
Size:  8.7 KB

    Turns out it doesn't like when I verify ID Memory and Configuration Memory.

    This is my new command line for the PICkit 4:

    Code:
    -TPPK4 -P$target-device$ -F$hex-filename$ -E -M -OAS0 -OB -OL -OV -YP -YE
    Note that I "might" be verifying the Programming and EEData areas a 2nd time for nothing. But hey, I paid for it so I'm using it.

    Name:  PK4 program and verify.png
Views: 13925
Size:  29.2 KB

    Robert
    "One happy camper"

    P.S.: Here's a copy&paste of the command line parameters available (no idea if you can attach a PDF)

    The complete version of Readme for IPECMD.htm can be found in your MPLABX/version number/docs folder.

    Command line parameters.pdf
    Last edited by Demon; - 26th April 2023 at 23:11.

  13. #13
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Quote Originally Posted by tumbleweed View Post
    If you look at the messages, when it fails the program end addr is 0xcbf.
    It's then not seeing the next addr 0xcc0 as erased... there's still something there.

    I think there's a setting to specify the full range and not let the PK4 pick it.

    I had the -E option, so no idea why it didn't want to erase the entire darned thing. It's off by default.

    Robert
    :shrug:
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Programming speed, turns out it doesn't mind running at max speed for this particular PIC:

    Code:
    -TPPK4 -P$target-device$ -F$hex-filename$ -E -M -OAS2 -OB -OL -OV -YP -YE
    This runs just fine.

    Robert

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    I still have one bug; 18F4550 programmed by my PK4 run Blinky at 1/2 speed compared to my U2 USB programmer.

    - leads on my PK4 are just over 6 inches, with gold pins so they connect directly beside the pin.
    - flat cable on my U2 is nearly 3 inches long, and PGC/PGD wires on the breadboard are nearly 3 inches.

    I can't find any spec that says EXACTLY what the max length is for the PK4 leads....?

    Robert


    EDIT: The only reference to lead lengths for the PK4 has a 8pin 6in cable:
    https://www.microchip.com/en-us/deve...-tool/AC102015
    Last edited by Demon; - 13th May 2023 at 20:20.

  16. #16
    Join Date
    Aug 2011
    Posts
    412

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    FWIW, I use a 6" cable with the PK4 all the time. Cables can cause issues, but I don't think that's your problem here.

    I still have one bug; 18F4550 programmed by my PK4 run Blinky at 1/2 speed compared to my U2 USB programmer.
    Try programming it with the PK4 and then verifying it with the U2, or vice-versa.

    Pay particular attention to CONFIG1L. Unless one of them is changing it (????), I don't see how that is.
    Are you overriding the CONFIG settings in the hex file with one of them?

  17. #17
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    Quote Originally Posted by tumbleweed View Post
    FWIW, I use a 6" cable with the PK4 all the time. Cables can cause issues, but I don't think that's your problem here.


    Try programming it with the PK4 and then verifying it with the U2, or vice-versa.

    Pay particular attention to CONFIG1L. Unless one of them is changing it (????), I don't see how that is.
    Are you overriding the CONFIG settings in the hex file with one of them?

    Yeah, I was about to make a new cable, but that cable from Microchip is as long as mine, and they have one even longer.


    Good idea about the swapping verify, gonna try tomorrow if wifey lets me in the house. I'm gonna lose a dog in that grass.


    I'm not changing anything. The only variable I can think of is the options on the command lines. I'm gonna take screen shots of all the U2 settings, then compare that against the PK4.


    Going to bed, just finished an "exposé" on HIDmaker FS2 (just comments and observations really), but I tried to be as open an truthful. gonna post about it on a USB thread.

    Robert

  18. #18
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    The U2 Programmer has a header button that allows you to set your CONFIG settings. Since your PICkit4 and U2 Programmers yield different Clock speeds, the U2 may be using a different default CONFIG setting than the PICkit4. If you don't specifically define your CONFIGs, you are leaving it up to software to make decisions for you.

  19. #19
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,599

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    This is what my U2 does.

    Erase:
    Name:  U2 1 Erase.png
Views: 13785
Size:  28.1 KB

    Program:
    Name:  U2 2 Program.png
Views: 13816
Size:  28.2 KB

    Verify:
    Name:  U2 3 Verify.png
Views: 13746
Size:  23.7 KB


    These are the settings I have for the PK4:
    Code:
    -TPPK4 -P$target-device$ -F$hex-filename$ -E -M -OAS2 -OB -OL -OV -W -YP -YE
    E = Erase Flash Device (there are no options)
    M = Program entire device (does not include calibration, same like U2)
    OAS2 = Maximum programming speed
    OB = Batch mode operation (so the window stays open to check out the results)
    OL = Release from RESET NOT SURE ABOUT THIS GUY!
    OV = Verify device ID before program in batch mode
    W = Power target from tool
    YE = Verify EEPROM
    YP = Verify Program memory (U2 verifies Code, Calibration, Data, User ID and Configuration)

    If anything, the U2 should be waaaaay slower, it verifies more, and the PK4 is supposed to be running at max speed and it's plugged in a SS USB port.

    Weird...

    Robert
    Last edited by Demon; - 16th May 2023 at 04:02.

  20. #20
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Re: 18F4550 programming failed using PICkit4 while verifying "User ID memory"

    You are not selecting "Erase User ID" but have selected "Program User ID". The Programming process only clears bits. If you have bits in your programmed User ID that are set, but that bit is already cleared, programming a 1 will not over-write a 0.

Similar Threads

  1. Replies: 0
    Last Post: - 14th November 2013, 03:32
  2. "Program Memory Error" with MPLAB IDE (PBP)
    By aggie007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th November 2007, 19:27
  3. Replies: 1
    Last Post: - 23rd December 2006, 13:29
  4. Help with 16F873 "Out of Memory" problem.
    By Archilochus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st December 2004, 20:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts