Menu

Can't get it to work on a 18F45k22

Szabi
2016-05-22
2016-05-22
  • Szabi

    Szabi - 2016-05-22

    Hi There!

    I would like to ask for a litle help to get the bootloader working on a 18F45k22.
    Communicatoin with the bootloader seems to be O.K., but I'm unable to uploade my hex.

    I'm using MPLAB X IDE v3.30 and mpasm v5.67 compiller for the firmware, with "build absolute mode" thicked.
    I modified "Dan_tinybld18F23K22-43K22-24K22-44K22-25K22-45K22-26K22-46K22_int16MHz_19200_r4.asm" as follows:

    ;#include "p18f23k22.inc"
    #include "p18f45k22.inc"
    ;IdTypePIC = 0x61       ; Please refer to the table below, must exists in "piccodes.ini"    
    IdTypePIC = 0x64
    ;#define max_flash  0x2000  ; in WORDS, not bytes!!! (= 'max flash memory' from "piccodes.ini" divided by 2), Please refer to the table below
    #define max_flash  0x8000
    #define SELECTEUSART 1      ; EUSART(1/2), Please refer to the table below
    
    #define EEPROMSIZE 256      ; Size of EEPROM (256/1024), Please refer to the table below
    
    xtal    EQU     16000000    ; you may also want to change: _HS_OSC _XT_OSC
    baud    EQU     19200       ; standard TinyBld baud rates: 115200 or 19200
    

    After successfull compillation I uploaded it to the PIC and connection with "Tiny Multi Bootloader+ v.0.11.1" succedded without problems
    "
    Check Device...
    Open COM3 serial port at 19200bd
    Hardware RTS reseting Device
    Found: 18F w/32KB flash & 256B EEPROM
    Close COM3 serial port
    "

    I created a little test code with MPLAB X IDE v3.30 and XC8 v1.35 compiller, really nothing special.

    #include "mcc_generated_files/mcc.h"
    
    /*
                             Main application
     */
    void main(void)
    {
        // Initialize the device
        SYSTEM_Initialize();
    
        TRISD = 0x00;
        ANSELD = 0x00;
    
        TRISE = 0x00;
        ANSELE = 0x00;
    
        while (1)
        {
            // Add your application code
    
            LATD = 0xff;   
            //LATE = 0xff; 
            for (int i = 0; i < 40; i++) {
                __delay_ms(25);
            }
    
             LATD = 0x00;
            //LATE = 0x00;
            for (int i = 0; i < 40; i++) {
                __delay_ms(25);
            }        
        }
    }
    

    The resuplting tiny HEX file looks as follows:

    :04000000D2EF3FF00C
    :107FA4000001D5EF3FF0956ABD0E8C6E8C68026AB5
    :107FB400036A21D8E82EFED7012EFCD700D0024A4E
    :107FC400032A03BEF6D7035003E1640E025CF1E317
    :107FD4008C6A046A056A0FD8E82EFED7012EFCD7F6
    :107FE40000D0044A052A05BEF6D70550DFE1640E29
    :0C7FF400045CDCE2F0D71A0E016EF80C01
    :020000040020DA
    :08000000FFFFFFFFFFFFFFFF00
    :020000040030CA
    :0E000000FF231F3CFFBF85FF0FC00FE00F4026
    :00000001FF
    

    by trying to upload it with the bootloader I'm getting the follwing error:

    Check Device...
    Open COM3 serial port at 19200bd
    Hardware RTS reseting Device
    Found: 18F w/32KB flash & 256B EEPROM
    Open HEX file: \vmware-host\Shared Folders\myuser\MPLABXProjects\quickstart xc8.X\dist\default\production\quickstart_xc8.X.production.hex
    Error: hex file too large, writing bootloader firmware!!!
    ERROR: problem in writing flash memory!!!
    Close COM3 serial port

    Many thanks in advance!

     
  • edorul

    edorul - 2016-05-22

    Hello,
    Can you try the hack explained in the "Tested Compilers: Microchip PIC" web page, section "XC8", from the "TinyMultiBootloader+" web site:
    http://tinypicbootload.sourceforge.net/
    Best regards,
    Edorul

     
    • Szabi

      Szabi - 2016-05-22

      Hi!

      It looks like the workaround does the trick, thanks!
      Sorry but I missed this part because it is not included in the latest documentation included in Tiny Multi Bootloader+ (v0.11.0).zip

      Something I forgot to mention before is another modificaion I did commented the following line because it is no such cinfiguration bit hence it was not compiling.
      ; config P2BMX = PORTB5 ;P2B is on RB5

      Are there any plans for an upgrade?

      Thanks!

       
      • edorul

        edorul - 2016-05-22

        Thanks for the feedback!

        No, there is no update planned.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.