Menu

Application not starting after Bootloading (PIC16F887)

Amampondo
2014-02-04
2014-02-12
  • Amampondo

    Amampondo - 2014-02-04

    Hello.

    1st Topic:
    My application is compiled with HI-TECH v9.83 and runs well when flashed with PIKkit3.

    I flash the precompiled "tinybld16F887_int8MHz.hex" (8MHz, 115kBd) with PIKkit3.
    Then I use Tiny_Avr-Pic_Bootloader+ (v0.8.3) to load the application.
    Check device and loading application succeed BUT the application does not start.
    Where is my mistake? (/MCLR is high after bootloading, this is not the issue). Application and bootloader use identical CONFIG-Bits.

    Loading the application alters the first 4 Bytes (??):
    Before:
    0000 158A BSF 0xa, 0x3
    0001 160A BSF 0xa, 0x4
    0002 2FA0 GOTO 0x7a0
    0003 3FFF
    0003 3FFF

    After:
    0000 301F MOVLW 0x1f
    0001 008A MOVWF PCLATH
    0002 2FA0 GOTO 0x7a0
    0003 3FFF
    0004 Application begins

    2nd Topic:
    The attempt to load the full size application with 7367 Bytes (90%) into the controller ends up with

    Error: hex file too large, writing bootloader firmware!!!
    ERROR: problem in writing flash memory!!!

    Should it not be OK to load files as large as 8092 Bytes (8192-100 Bytes)?

     

    Last edit: Amampondo 2014-02-04
  • Dan

    Dan - 2014-02-04

    hi,Amampondo

    http://tinypicbootload.sourceforge.net/tested_compilers_pic.html
    and your
    Tiny_Avr-Pic_Bootloader+ (v0.8.3)\docs\Fctmt_Bootloader_PIC_AVR.xls

    1.Top four words will be replaced with a jump to the boot loader automatically.

    Before:
    0000 158A BSF 0xa, 0x3
    0001 160A BSF 0xa, 0x4
    0002 2FA0 GOTO 0x7a0
    0003 3FFF

    When it is this description, it will jump to infinity in the bootloader from the bootloader.
    goto 1800h+07A0h=1FA0h (This is bootloader start address)
    reset -> goto bootloader -> goto bootloasder

    ---------------->
    Before:
    0000:movlw xx
    0001:movwf PCLATH
    0002:goto user_Program
    0003:nop

    or.
    0000:claf PCLATH
    0001:bsf PCLATH,n
    0002:bsf PCLATH,m
    0003:goto user_Program

    2.Upper limit of the user program:1F9Fh-4h=1F9Bh
    (New firmware:1FAFh-4h=1FABh)

    3.I have updated the 16F887 firmware today.(bug fix)
    http://sourceforge.net/p/tinypicbootload/discussion/devices/thread/8f8f8058/#94fb

    2014.02.04.zip

     

    Last edit: Dan 2014-02-05
  • Amampondo

    Amampondo - 2014-02-05

    Hi Dan
    thanks for your fast effort.
    I used "Dan_tinybld16F882-883-884-886-887.asm" dating 04.02.2014.
    piccodes.ini is updated with $3A..$3C as written in the .asm file.
    Also, I changed IdTypePIC = 0x3C (line 6).

    Any chosen baud rate failed (9600, 19200, 115200) to synchronize with the GUI (v0.8.3).

    Selecting 115200 leads to an error: (big error in baudrate: 8%)
    Changing line 49 ...

    include "spbrgselect.inc"

    ...to the code of the orignal "tinybld16F887_int8MHz.asm" ...

    spbrg_value EQU 16

    suppresses the error but does not help, still no synchronization with the GUI.

     
  • Dan

    Dan - 2014-02-05

    Hi,Amampondo

    Please try this one.

     
  • Amampondo

    Amampondo - 2014-02-05

    Thanks Dan
    after changing line 6 again to (see below) I can bootload and application starts.
    IdTypePIC = 0x3C ; fails with 0x36

    More observations:
    - I cannot bootload a second time (the uC does reset a few times).
    - The short release of my application fits, the full release does not (90% of 8192 Bytes).

     

    Last edit: Amampondo 2014-02-05
  • Dan

    Dan - 2014-02-05

    Hi,Amampondo

    • I cannot bootload a second time (the uC does reset a few times).

    Please try the next thread.

    • The short release of my application fits, the full release does not (90% of 8192 Bytes).

    (1)It's Really?

    Please check the Hex file.

    Compiler or does not have added the extra code?

    (2)Please try to uncheck the "Check File".

     

    Last edit: Dan 2014-02-06
  • Dan

    Dan - 2014-02-06

    Hi,Amampondo

    PIC16F887 firmware of the updated were different.

    2014.02.04
    X Dan_tinybld16F887_int8MHz_9600bd_soft
    X Dan_tinybld16F882-883-884-886-887.asm

    2014.02.06
    O Dan_tinybld16F887_int8MHz_19200bd_84w_r2
    O Dan_tinybld16F882-883-884-886-887.asm

    or.

    2014.02.07(It's new,Hex code is same as 2014.02.06)
    O Dan_tinybld16F887_int8MHz_19200bd_84w_r3
    O Dan_tinybld16F882-883-884-886-887_rev1.asm

    $3C, B, 16F 886/887(84w), $4000, $100, 168, 32,

    http://sourceforge.net/p/tinypicbootload/discussion/devices/thread/8f8f8058/#59ac

    2014.02.07.zip

     

    Last edit: Dan 2014-02-07
  • Amampondo

    Amampondo - 2014-02-11

    Hi Dan
    I tested again: no synchronization between GUI and device.
    There is no successful speed setting "baud EQU ..."

    For verification I frequently step back to the bootloader which allowed synchronization. Problem at that time was that the application would not start.

     
  • Dan

    Dan - 2014-02-11

    I sync without any problem in my PIC16F887.

    tinybld16F887_int8MHz_02_05.asm
    $36, B, 16F 886/887, $4000, $100, default, 32,
    (Not $36, B, 16F 886/887, $4000, $100, default, default,)

    Do not sync in the configuration using the old firmware?

     
  • Amampondo

    Amampondo - 2014-02-11

    Using tinybld16F887_int8MHz_02_05.asm at 115200Bd along with

    $36, B, 16F 886/887, $4000, $100, default, 32,

    makes indeed a difference to both of the following ... !!!

    $36, B, 16F 886/887, $4000, $100, default, default,
    $3C, B, 16F 886/887(84w), $4000, $100, 168, 32,

    Now I can program and reprogram ==> Very good for my reduced & smaller application.
    (only at 115200, but that is OK. 19200 makes no synchronization).

    HOWEVER: I cannot program the full application
    7366 Bytes (90% of 8192 Bytes) fails
    6808 Bytes (83%) fails
    6366 Bytes is fine
    Check-File is OFF (and has always been OFF).

     

    Last edit: Amampondo 2014-02-11
  • Dan

    Dan - 2014-02-11

    Hi,Amampondo

    (only at 115200, but that is OK. 19200 makes no synchronization).
    HOWEVER: I cannot program the full application
    7366 Bytes (90% of 8192 Bytes) fails
    6808 Bytes (83%) fails
    6366 Bytes is fine
    Check-File is OFF (and has always been OFF).

    Clock or not crazy?

    More of 19200 is likely to be synchronized than 115200.

    Does your PIC16F887 generate a 8MHz properly?

     
  • Amampondo

    Amampondo - 2014-02-11

    Using Clockout-Option I get 2MHz.
    This is correct for internal 8MHz-RC-Oscillator.

     
  • Dan

    Dan - 2014-02-11

    Hi,Amampondo

    There is no problem in my environment.

    You may need to set the OSCTUNE?

    Attachment reference.

     
  • Amampondo

    Amampondo - 2014-02-12

    Hello Dan
    It is certain that 19200 is more likely to be synchronized than 115200. Since I prefer 115200 anyway, this is not my issue.

    The remaining issue is the limited file size of approx. 6400 Bytes in a 8192 Bytes device.

     

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.