Announcement

Collapse
No announcement yet.

Help 18f26k22 and icd no work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tony876
    replied
    Hi Guys,

    I've tried to follow this thread and get a final working UMCloader.exe config files. .ini and .asm .. But nothing is working for me.

    Is there anyway one of you can post or attach both files that are tested to UMCBootload for the 18f26k22 chip? Any oscillator, my board has 20mhz resonator.

    I'm pulling my hair out here. lol

    Thanks,

    Tony

    Leave a comment:


  • FRAN2000
    replied
    Hello

    That's no problem icd.

    Unless in your program, modify the configuration of the USART port or write on pins communication.

    Regards

    Fran

    Leave a comment:


  • richard
    replied
    Richard, What's unreliable? The ICD or the Boot Loader? I have used the MCLoader ever since MicroEngineering stopped supporting there's. I have never had a problem with it. 100% every time...
    both
    icd for me now works for a couple of minutes then stalls, after stoping and rerunning icd then works for another couple of minutes .
    its probably my pc , i was just having another look at icd since the upgrade to win10 with w7 it was totally hopeless . I live in hope

    MCLoader is fine for some chips but 16f1825 is totally eluding me

    Leave a comment:


  • DavidP
    replied
    Glad you got it working Fran..

    Leave a comment:


  • FRAN2000
    replied
    Solved

    All it is working.

    The boot loader, icd and serial communication. okay

    I almost gave up, but has failed me.

    The solution:

    When you change your micro is usually small changes but when you go from the 16 to the 18 series changes are greater.
    These micros have many more features more than 16 series.

    The problem was communication settings for this micro you have to define it well if it does not work.

    for example:

    communication with an external 20MHz oscillator

    DEFINE HSER_RCSTA 90h 'Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h 'Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1 'Clear overflow Automatically
    DEFINE HSER_SPBRG 259 '19200 Baud @ SPBRGH = 0
    BAUDCON.3 = 1 'Enable 16-bit baudrate generator

    !! It does not work well.


    But also it works well: :-)

    DEFINE HSER_RCSTA 90h 'Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h 'Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1 'Clear overflow Automatically
    DEFINE HSER_SPBRG 259 '19200 Baud @ SPBRGH = 0
    TXSTA1.2 = 1
    BAUDCON1.3 = 1

    The boot loader worked for me, but not because icd communication misconfigured being sent to the pc characters are illegible.

    For this micro must pay attention to set up the communication form
    18_ICD_PBPX correct in the file regarding .bas including ports hSer Number 1 or Number 2.

    Well, that's all.
    Thank you for your assistance and time spent.

    a greeting
    Fran

    Leave a comment:


  • DavidP
    replied
    Richard, What's unreliable? The ICD or the Boot Loader? I have used the MCLoader ever since MicroEngineering stopped supporting there's. I have never had a problem with it. 100% every time...

    Leave a comment:


  • FRAN2000
    replied
    Hello

    OK thank you for your time.

    If I get you informed.

    Leave a comment:


  • richard
    replied
    Originally posted by FRAN2000 View Post

    it works for you?
    SOMETIMES , its pretty unreliable . I'm going back to the pickit2 and no icd , no bootloader it's not worth the effort.

    good luck with your efforts , if you find a good method let me know

    richard

    Leave a comment:


  • FRAN2000
    replied
    hello

    I programmed, the resulting file to build the boot loader with UMC as you described and does not work.

    If you give the information button, or gives you the version of the loader

    it works for you?
    Last edited by FRAN2000; 07-05-2016, 12:59 AM.

    Leave a comment:


  • richard
    replied
    Originally posted by FRAN2000 View Post
    And in the file umc_loader.asm must also match the settings
    THE ASM file is created by the "umcbuild.exe" using the config.ini there is nothing to be gained by editing it

    Leave a comment:


  • FRAN2000
    replied
    Hello

    And in the file umc_loader.asm must also match the settings


    I modified or not.





    ;*****************************************************************************
    ;* Name : umc_loader.asm *
    ;* Author : David John Barker *
    ;* Date : 04/08/2011 *
    ;* Version : 1.0 - Initial release *
    ;* : BETA CHANGES *
    ;* : 26-08-2011 - check for TXSTA1 rather than TXSTA *
    ;* : 26-08-2011 - added SPBRG_ and SPBRGH_ *
    ;* : 17-08-2011 - check for EEPGD *
    ;* - added #ifdef ENABLE_EEPROM_READ *
    ;* : 10-08-2011 - BAUDCON_, BRG16 *
    ;* : - TXSTA_, TRMT *
    ;* : 15-08-2011 - clrf TBLPTRU *
    ;* Notes : Parts of this code based around the Tiny Bootloader *
    ;* : [email protected] *
    ;* : http://www.etc.ugal.ro/cchiculita/so...bootloader.htm *
    ;*****************************************************************************
    radix DEC ; default radix is DECIMAL

    ;=============================================================================
    ; USER CONFIGURATION SECTION
    ;=============================================================================
    processor 18F26K22
    #define DEVICE_CLOCK 20000000 <---------------------------------------------------------------------64000000?
    #define BAUDRATE 19200 <---------------------------------------------------------------------115200?

    ; insert any device specific information inside here - for example, some
    ; devices (such as the 18F1220) the USART pins default to analog and so must be
    ; set to digital for comms to work - insert any device configuration data here...
    UserConfig macro
    ANSELC=0
    endm

    ; set your configuration fuses here - this will change
    ; from device to device... HS
    config OSC = HS <--------------------------------------------------------------INTIO67??
    config OSCS = OFF
    config PWRT = ON
    config BOR = ON
    config BORV = 20
    config WDT = OFF
    config LVP = OFF
    config DEBUG = OFF

    ; it's not recommended you change these options unless you know what you
    ; are doing...
    #define DEFAULT_BAUDRATE 19200 ; initial startup baudrate (default is 19200)
    #define USE_BRGH 1 ; high baudrate select (default is ON)
    #define USE_BRGH16 0 ; 16 bit SPBRG support (default is OFF)

    ; import the device information file - you may need to add devices
    ; to this file...
    #include devices.inc
    ;=============================================================================
    ; END USER CONFIGURATION SECTION
    ;=============================================================================

    ; BRG16 BRGH USARTMODE FORMULA
    ; 0 0 8 Bit (OSC / BAUDRATE / 64) - 1
    #if (USE_BRGH16 == 0) && (USE_BRGH == 0)
    #define MULT 64
    #define TXSTA_VALUE 0x20
    #endif

    ; BRG16 BRGH USARTMODE FORMULA
    ; 0 1 8 Bit (OSC / BAUDRATE / 16) - 1
    #if (USE_BRGH16 == 0) && (USE_BRGH == 1)
    #define MULT 16
    #define TXSTA_VALUE 0x24
    #endif

    ; BRG16 BRGH USARTMODE FORMULA
    ; 1 0 16 Bit (OSC / BAUDRATE / 4) - 1
    #if (USE_BRGH16 == 1) && (USE_BRGH == 0)
    #define MULT 4
    #define TXSTA_VALUE 0x20
    #endif

    ; BRG16 BRGH USARTMODE FORMULA
    ; 1 1 16 Bit (OSC / BAUDRATE / 4) - 1
    #if (USE_BRGH16 == 1) && (USE_BRGH == 1)
    #define MULT 4
    #define TXSTA_VALUE 0x24
    #endif

    ; formula is (OSC / BAUDRATE / MULT) - 1. However, we need to round the result
    ; so that the SPBRG value is correct
    #define MULT_DIV_2 MULT / 2
    #define DEFAULT_SPBRG_VALUE ((DEVICE_CLOCK / DEFAULT_BAUDRATE + MULT_DIV_2) / MULT - 1)
    #define USER_SPBRG_VALUE ((DEVICE_CLOCK / BAUDRATE + MULT_DIV_2) / MULT - 1)
    #define PIR_ PIR1
    #define RCIF_ RCIF
    #define TXIF_ TXIF

    ; alias USART registers - names will change if the device
    ; has more than one USART...
    #ifdef TXSTA1 ; (26-08-2011)
    #define TXSTA_ TXSTA1
    #define RCSTA_ RCSTA1
    #define SPBRG_ SPBRG1
    #define SPBRGH_ SPBRGH1
    #define TXREG_ TXREG1
    #define RCREG_ RCREG1
    #define BAUDCON_ BAUDCON1
    #else
    #define TXSTA_ TXSTA
    #define RCSTA_ RCSTA
    #define SPBRG_ SPBRG
    #define SPBRGH_ SPBRGH
    #define TXREG_ TXREG
    #define RCREG_ RCREG
    #define BAUDCON_ BAUDCON
    #endif

    ; set the minimum loader size...
    #define LOADER_SIZE_MIN 384
    #define LOADER_SIZE LOADER_SIZE_MIN

    ; if the loader size is not an integer multiple of the erase block size, we
    ; need to set the loader size so it falls on an erase block boundary. For example
    ; EraseBlock == 64, LoaderSize := 384 (6 * 64) - no change needed
    ; EraseBlock == 128, LoaderSize := 384 (3 * 128) - change needed
    ; EraseBlock == 1024, LoaderSize := 1024 (1 * 1024) - change needed
    #if DEVICE_BLOCK_ERASE > 0 ; if zero, then ignore
    #if LOADER_SIZE % DEVICE_BLOCK_ERASE > 0 ; if modulus not zero, we need a new loader size
    #undefine LOADER_SIZE
    #define LOADER_SIZE DEVICE_BLOCK_ERASE * (LOADER_SIZE_MIN / DEVICE_BLOCK_ERASE + 1)
    #endif
    #endif

    ; now create the loader and user code origin...
    #define ORG_LOADER DEVICE_ROM - LOADER_SIZE
    #define ORG_LOADER_USER ORG_LOADER - 8

    ; loader commands - these are bit field identifiers
    ; data input values are shown in comments
    #define CMD_EEPROM_READ 0x00 ; 0x01
    #define CMD_EEPROM_WRITE 0x01 ; 0x02
    #define CMD_ROM_ERASE 0x02 ; 0x04
    #define CMD_ROM_READ 0x03 ; 0x08
    #define CMD_ROM_WRITE 0x04 ; 0x10
    #define CMD_BAUDRATE 0x05 ; 0x20

    ; addition information and commands...
    #define FIRMWARE_VERSION 0x10
    #define LOADER_CONNECT 0x80
    #define LOADER_ACK LOADER_CONNECT
    #define LOADER_GO 0x81
    #define LOADER_ERROR_CRC 0x8A
    #define LOADER_ERROR_VERIFY 0x8B

    ; EEPROM and flash control (EECON1)
    #ifdef EEPGD
    #define ROM_ERASE 0x94 ; EEPGD = 1, FREE = 1, WREN = 1
    #else
    #define ROM_ERASE 0x14 ; FREE = 1, WREN = 1
    #endif

    .
    .
    ....


    .
    .
    .
    .

    .
    .
    ................

    It is very big to put....

    Leave a comment:


  • richard
    replied
    Works for me , bootloader config must match program config and the actual hardware

    config.ini

    Code:
    ; optional path information - default output folder is 
    ; user documents -> umcbuild... 
    [PATH] 
    Output=C:\MYBOOTLOADER
    ; source code files... 
    [TEMPLATE] 
    PIC16=..\src\16F\umc_loader.asm 
    PIC18=..\src\18F\umc_loader.asm 
    [USART] 
    BAUDRATE=115200 BRGH=1 BRG16=1 
    ; device name and OSC... 
    [MCU] 
    Device=18F26K22 
    OSC=64000000 
    ; device configuration settings... 
    [CONFIG] 
    config FOSC = INTIO67
    config PLLCFG = ON
    config PRICLKEN = ON ; Primary clock Enabled 
    config FCMEN = OFF ; Fail-Safe Clock Disabled 
    config IESO = OFF ; Oscillator Switchover Disabled 
    config PWRTEN = ON ; Powerup Timer Enabled 
    config HFOFST = OFF ; HFINTOSC delayed until oscillator stable 
    config BOREN = ON ; Brown Out Detector Enabled 
    config BORV = 250 ; VBOR set to 2.50 V nominal 
    config WDTEN = ON ; WDT Enabled; SWDTEN bit has no effect 
    config WDTPS = 512 ; WDT = 1:512 = 2048 ms 
    config CCP2MX = PORTB3 ; CCP2 i/o is multiplexed with RB3 (not RC1) 
    config CCP3MX = PORTB5 ; P3A/CCP3 i/o is multiplexed with RB5 (not RC6) 
    config T3CMX = PORTB5 ; T3CKI is on RB5 (not RC0) 
    config P2BMX = PORTC0 ; ECCP2 P2B is on RC0 (not RB5) 
    config PBADEN = OFF ; PORTB<5:0> pins configured as digital i/o (not analog) 
    config MCLRE = INTMCLR 
    config STVREN = ON ; Stack Overflow Reset Enabled 
    config XINST = OFF ; Extended Instructions Disabled 
    config LVP = OFF ; Low-Voltage-Programming Disabled 
    config CP0 = OFF ;Code Protect 00800-03FFF 
    config CP1 = OFF ;Code Protect 04000-07FFF 
    config CP2 = OFF ;Code Protect 08000-0BFFF 
    config CP3 = OFF ;Code Protect 0C000-0FFFF 
    config CPB = OFF ;Code Protect Boot 
    config CPD = OFF ;Data EE Read Protect 
    config WRT0 = OFF ;Table Write Protect 00800-03FFF 
    config WRT1 = OFF ;Table Write Protect 04000-07FFF 
    config WRT2 = OFF ;Table Write Protect 08000-0BFFF 
    config WRT3 = OFF ;Table Write Protect 0C000-0FFFF 
    config WRTC = OFF ;Config. Write Protect 
    config WRTB = OFF ;Table Write Protect Boot 
    config WRTD = OFF ;Data EE Write Protect 
    config EBTR0 = OFF ;Table Read Protect 00800-03FFF 
    config EBTR1 = OFF ;Table Read Protect 04000-07FFF 
    config EBTR2 = OFF ;Table Read Protect 08000-0BFFF 
    config EBTR3 = OFF ;Table Read Protect 0C000-0FFFF 
    config EBTRB = OFF ;Table Read Protect Boot 
    ; place startup code in here... 
    [USERCODE] 
    movlb 0x0F ; MANDATORY: BSR set to SFR bank 
    movlw b'00000000' 
    movwf ANSELC ; MANDATORY: analog off on port C 
    movlw 0x70 
    movwf OSCCON
    bsf   OSCTUNE,6

    Leave a comment:


  • FRAN2000
    replied
    Hello

    Hello, are two files involved in creating boot:

    1 umcbuild.ini
    2 umc_loader.asm


    It would stay like that.

    It is right?



    1 umcbuild.ini ------------------------------------------

    [USART]
    BAUDRATE=19200
    BRGH=1
    BRG16=1

    ; device name and OSC...
    [MCU]
    Device=18F26K22
    OSC=20000000


    ; device configuration settings...
    [CONFIG]
    config FOSC = HSHP ; HS oscillator (high power > 16 MHz)
    config PLLCFG = OFF ; 4xPLL Disabled (direct oscillator)
    config PRICLKEN = ON ; Primary clock Enabled
    config FCMEN = OFF ; Fail-Safe Clock Disabled
    config IESO = OFF ; Oscillator Switchover Disabled
    config PWRTEN = ON ; Powerup Timer Enabled
    config HFOFST = OFF ; HFINTOSC delayed until oscillator stable
    config BOREN = ON ; Brown Out Detector Enabled
    config BORV = 250 ; VBOR set to 2.50 V nominal
    config WDTEN = ON ; WDT Enabled; SWDTEN bit has no effect
    config WDTPS = 512 ; WDT = 1:512 = 2048 ms
    config CCP2MX = PORTB3 ; CCP2 i/o is multiplexed with RB3 (not RC1)
    config CCP3MX = PORTB5 ; P3A/CCP3 i/o is multiplexed with RB5 (not RC6)
    config T3CMX = PORTB5 ; T3CKI is on RB5 (not RC0)
    config P2BMX = PORTC0 ; ECCP2 P2B is on RC0 (not RB5)
    config PBADEN = OFF ; PORTB<5:0> pins configured as digital i/o (not analog)
    config MCLRE = INTMCLR
    config STVREN = ON ; Stack Overflow Reset Enabled
    config XINST = OFF ; Extended Instructions Disabled
    config LVP = OFF ; Low-Voltage-Programming Disabled
    config CP0 = OFF ;Code Protect 00800-03FFF
    config CP1 = OFF ;Code Protect 04000-07FFF
    config CP2 = OFF ;Code Protect 08000-0BFFF
    config CP3 = OFF ;Code Protect 0C000-0FFFF
    config CPB = OFF ;Code Protect Boot
    config CPD = OFF ;Data EE Read Protect
    config WRT0 = OFF ;Table Write Protect 00800-03FFF
    config WRT1 = OFF ;Table Write Protect 04000-07FFF
    config WRT2 = OFF ;Table Write Protect 08000-0BFFF
    config WRT3 = OFF ;Table Write Protect 0C000-0FFFF
    config WRTC = OFF ;Config. Write Protect
    config WRTB = OFF ;Table Write Protect Boot
    config WRTD = OFF ;Data EE Write Protect
    config EBTR0 = OFF ;Table Read Protect 00800-03FFF
    config EBTR1 = OFF ;Table Read Protect 04000-07FFF
    config EBTR2 = OFF ;Table Read Protect 08000-0BFFF
    config EBTR3 = OFF ;Table Read Protect 0C000-0FFFF
    config EBTRB = OFF ;Table Read Protect Boot

    ; place startup code in here...
    [USERCODE]
    movlb 0x0F ; MANDATORY: BSR set to SFR bank
    movlw b'00000000'
    movwf ANSELC ; MANDATORY: analog off on port C
    movlw 0x70
    movwf OSCCON
    bsf OSCTUNE,6







    2 umc_loader.asm ------------------------------------------------------------------------------------------------

    This is attached in zip
    Attached Files

    Leave a comment:


  • richard
    replied
    if this is your bootloader ini file then there are some conflicts and unnecessary stuff and some stuff missing like
    osccon=0x70 etc

    [USERCODE]
    movlb 0x0F ; MANDATORY: BSR set to SFR bank
    movlw b'00000000'
    movwf ANSELC ; MANDATORY: analog off on port C
    movlw 0x70
    movwf OSCCON
    bsf OSCTUNE,6

    Code:
    ; optional path information - default output folder is 
    ; user documents -> umcbuild... 
    [PATH] 
    Output=$app\firmware 
    ; source code files... 
    [TEMPLATE] 
    PIC16=..\src\16F\umc_loader.asm 
    PIC18=..\src\18F\umc_loader.asm 
    [USART] BAUDRATE=19200 BRGH=1 BRG16=1 
    ; device name and OSC... 
    [MCU] Device=18F26K22[COLOR="#FF0000"] OSC=20000000 [/COLOR]; device configuration settings... 
    [CONFIG] 
    config FOSC = HSHP ; HS oscillator (high power > 16 MHz) 
    config [COLOR="#FF0000"]PLLCFG = OFF ; 4xPLL Disabled (direct oscillator)[/COLOR] 
    config PRICLKEN = ON ; Primary clock Enabled 
    config FCMEN = OFF ; Fail-Safe Clock Disabled 
    config IESO = OFF ; Oscillator Switchover Disabled 
    config PWRTEN = ON ; Powerup Timer Enabled 
    config HFOFST = OFF ; HFINTOSC delayed until oscillator stable 
    config BOREN = ON ; Brown Out Detector Enabled 
    config BORV = 250 ; VBOR set to 2.50 V nominal 
    config WDTEN = ON ; WDT Enabled; SWDTEN bit has no effect 
    config WDTPS = 512 ; WDT = 1:512 = 2048 ms 
    config CCP2MX = PORTB3 ; CCP2 i/o is multiplexed with RB3 (not RC1) 
    config CCP3MX = PORTB5 ; P3A/CCP3 i/o is multiplexed with RB5 (not RC6) 
    config T3CMX = PORTB5 ; T3CKI is on RB5 (not RC0) 
    config P2BMX = PORTC0 ; ECCP2 P2B is on RC0 (not RB5) 
    config PBADEN = OFF ; PORTB<5:0> pins configured as digital i/o (not analog) 
    config MCLRE = INTMCLR config STVREN = ON ; Stack Overflow Reset Enabled 
    config XINST = OFF ; Extended Instructions Disabled 
    config LVP = OFF ; Low-Voltage-Programming Disabled 
    config CP0 = OFF ;Code Protect 00800-03FFF 
    config CP1 = OFF ;Code Protect 04000-07FFF 
    config CP2 = OFF ;Code Protect 08000-0BFFF 
    config CP3 = OFF ;Code Protect 0C000-0FFFF 
    config CPB = OFF ;Code Protect Boot 
    config CPD = OFF ;Data EE Read Protect 
    config WRT0 = OFF ;Table Write Protect 00800-03FFF 
    config WRT1 = OFF ;Table Write Protect 04000-07FFF 
    config WRT2 = OFF ;Table Write Protect 08000-0BFFF 
    config WRT3 = OFF ;Table Write Protect 0C000-0FFFF 
    config WRTC = OFF ;Config. Write Protect 
    config WRTB = OFF ;Table Write Protect Boot 
    config WRTD = OFF ;Data EE Write Protect 
    config EBTR0 = OFF ;Table Read Protect 00800-03FFF 
    config EBTR1 = OFF ;Table Read Protect 04000-07FFF 
    config EBTR2 = OFF ;Table Read Protect 08000-0BFFF 
    config EBTR3 = OFF ;Table Read Protect 0C000-0FFFF 
    config EBTRB = OFF ;Table Read Protect Boot 
    ; place startup code in here... 
    [USERCODE] 
    movlb 0x0F ; MANDATORY: BSR set to SFR bank 
    movlw b'00000000' 
    movwf ANSELC ; MANDATORY: analog off on port C 
    [COLOR="#FFFF00"][/COLOR][COLOR="#FF0000"]movlw b'00000000' 
    movwf ADCON0 ; not necessary, but adc off [/COLOR]
    [COLOR="#FF0000"]movlw b'10111111' 
    movwf TRISC ; not necessary, but tx pin RC6 as output[/COLOR]
    Last edited by richard; 07-04-2016, 06:00 AM.

    Leave a comment:


  • FRAN2000
    replied
    the configuration file take it from
    *
    http://www.mecanique-web.co.uk/downl.../build-config/

    It is a problem of boot loader'll have to contact mecanique,
    program the device but then the icd not start.
    Last edited by FRAN2000; 07-04-2016, 04:38 AM.

    Leave a comment:

Working...
X