Menu

bootloader for PIC16F18875

Requests
epy
2020-10-12
2020-10-13
  • epy

    epy - 2020-10-12

    I am using PIC16F18875for my project.Previously i was using pic16f886 and that i was using this bootloader. but bootloader is not availavle for PIC16F18875.
    i was trying to change the assembly code for p16f1455 to work for PIC16F18875 but didn't work for me.

    Has any one tried bootloader for PIC16F18875 controller or similar ?

     
  • Anobium

    Anobium - 2020-10-12

    I can provide one for you.

    I need some information.

    PIC16F18875
    1 FREQUENCY Any valid internal frequency. The fastest the better.
    2 BAUD RATE Select 19200 or 115200 BPS
    3 TIMERDELAY Specify startup delay, defaults to 1 second
    4 CONFIG S pecify valid config
    5 PPS RX and TX ports

     
    • epy

      epy - 2020-10-12

      1 FREQUENCY - Internal Clock 16Mhz
      2 BAUD RATE - 19200
      3 TIMERDELAY - 1 second
      4 CONFIG S
      __CONFIG _CONFIG1, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_OFF & _BORV_LO & _ZCD_OFF & _PPS1WAY_ON & _STVREN_ON
      __CONFIG _CONFIG2, _WDTCPS_WDTCPS_31 & _WDTE_OFF & _WDTCWS_WDTCWS_7 & _WDTCCS_SC
      __CONFIG _CONFIG3, _WRT_OFF & _SCANE_available & _LVP_OFF
      __CONFIG _CONFIG4, _CP_OFF & _CPD_OFF

      5 PPS RX and TX ports

       
      • Anobium

        Anobium - 2020-10-12

        You sure about PPS1WAY_ON?
        and RX and TX on TX > RC6 RC7 > RX ?

        So, PPS1WAY_OFF and TX > RC6 RC7 > RX.

        Rest of specification is as follows:

        TOOLVERSION .......... 1.06B
        
        
        
        IDTYPEPIC............  $AA [PICCODES.INI] 
        CHIP ................. 16F18875 / 40 PINS
        FREQUENCY ............ 16 Mhz
        OSCILLATOR SOURCE .... INTERNAL
        BAUD RATE ............ 19200 BPS ( CALCULATED 19200 BPS)
        PROGMEM WORDS ........ 8192
        RAM BYTES ............ 1024
        CHIPFAMILY ........... 15
        EEMEMORY BYTES ....... 256
        PPSCHIP .............. YES
        PPSCONFIGDEFINED ..... YES
        PPSTOOLPART .......... 16F18875
        CHIPARCHITECTURE ..... 1
        
        
        TIMERDELAY ........... 1 SECS
        
        
        CONFIG:
              CONFIG1, _FCMEN_ON & CLKOUTEN_OFF & _RSTOSC_HFINTPLL & _FEXTOSC_OFF
              CONFIG2, _STVREN_ON & _ZCD_ON & _BORV_LO & _BOREN_OFF & _LPBOREN_OFF & _MCLRE_ON
              CONFIG3, _WDTCCS_SC & _WDTCWS_WDTCWS_7 & _WDTE_OFF & _WDTCPS_WDTCPS_31
              CONFIG4, _LVP_OFF & _SCANE_NOT_AVAILABLE & _WRT_OFF
              CONFIG5, CPD_OFF & CP_OFF
        
        RC6PPS = 0X0010: ANSELC.7 = 0    'TX > RC6  RXPPS = 0X0017    'RC7 > RX
        
        MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
             0000 : XX-------------- ---------------- ---------------- ----------------
             1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
             1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX----
             8000 : -------XXXXX---- ---------------- ---------------- ----------------
             All other memory blocks unused.
             Program Memory Words Used:   103
             Program Memory Words Free:  8089
        
         

        Last edit: Anobium 2020-10-12
      • Anobium

        Anobium - 2020-10-12

        You sure about PPS1WAY_ON?
        and RX and TX on TX > RC6 RC7 > RX ?

        So, PPS1WAY_OFF and TX > RC6 RC7 > RX.

        Rest of specification is as follows:

        TOOLVERSION .......... 1.06B
        
        
        
        IDTYPEPIC............  $AA [PICCODES.INI] 
        CHIP ................. 16F18875 / 40 PINS
        FREQUENCY ............ 16 Mhz
        OSCILLATOR SOURCE .... INTERNAL
        BAUD RATE ............ 19200 BPS ( CALCULATED 19200 BPS)
        PROGMEM WORDS ........ 8192
        RAM BYTES ............ 1024
        CHIPFAMILY ........... 15
        EEMEMORY BYTES ....... 256
        PPSCHIP .............. YES
        PPSCONFIGDEFINED ..... YES
        PPSTOOLPART .......... 16F18875
        CHIPARCHITECTURE ..... 1
        
        
        TIMERDELAY ........... 1 SECS
        
        
        CONFIG:
              CONFIG1, _FCMEN_ON & CLKOUTEN_OFF & _RSTOSC_HFINTPLL & _FEXTOSC_OFF
              CONFIG2, _STVREN_ON & _ZCD_ON & _BORV_LO & _BOREN_OFF & _LPBOREN_OFF & _MCLRE_ON
              CONFIG3, _WDTCCS_SC & _WDTCWS_WDTCWS_7 & _WDTE_OFF & _WDTCPS_WDTCPS_31
              CONFIG4, _LVP_OFF & _SCANE_NOT_AVAILABLE & _WRT_OFF
              CONFIG5, CPD_OFF & CP_OFF
        
        RC6PPS = 0X0010: ANSELC.7 = 0    'TX > RC6  RXPPS = 0X0017    'RC7 > RX
        
        MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
             0000 : XX-------------- ---------------- ---------------- ----------------
             1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
             1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX----
             8000 : -------XXXXX---- ---------------- ---------------- ----------------
             All other memory blocks unused.
             Program Memory Words Used:   103
             Program Memory Words Free:  8089
        
         
  • Anobium

    Anobium - 2020-10-12

    Here is a sample for you.

    TOOLVERSION .......... 1.06B
    
    
    
    IDTYPEPIC............  $AA [PICCODES.INI] 
    CHIP ................. 16F18875 / 40 PINS
    FREQUENCY ............ 32 Mhz
    OSCILLATOR SOURCE .... INTERNAL
    BAUD RATE ............ 19200 BPS ( CALCULATED 19200 BPS)
    PROGMEM WORDS ........ 8192
    RAM BYTES ............ 1024
    CHIPFAMILY ........... 15
    EEMEMORY BYTES ....... 256
    PPSCHIP .............. YES
    PPSCONFIGDEFINED ..... YES
    PPSTOOLPART .......... 16F18875
    CHIPARCHITECTURE ..... 1
    
    
    TIMERDELAY ........... 3 SECS
    
    
    CONFIG:
          CONFIG1, _FCMEN_ON & CLKOUTEN_OFF & _RSTOSC_HFINT32 & _FEXTOSC_OFF
          CONFIG2, _MCLRE_OFF
          CONFIG3, _WDTE_OFF
          CONFIG4, _LVP_OFF & _WRT_OFF
          CONFIG5, CPD_OFF & CP_OFF
    
    RC6PPS = 0X0010: ANSELC.7 = 0    'TX > RC6  RXPPS = 0X0017    'RC7 > RX
    
    
    MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
         0000 : XX-------------- ---------------- ---------------- ----------------
         1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
         1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXX--
         8000 : -------XXXXX---- ---------------- ---------------- ----------------
         All other memory blocks unused.
         Program Memory Words Used:   105
         Program Memory Words Free:  8087
    

    This will required latest exe and ini file from the distribution.

     

    Last edit: Anobium 2020-10-12
  • epy

    epy - 2020-10-12

    I have tested the shared .hex file but not working. PIC is not responding.

     
    • Anobium

      Anobium - 2020-10-12

      Did you update you PC software? The old PICINFO.INI will not work with the new HEXs

       
  • epy

    epy - 2020-10-12

    yes. I am using updated software. and following is the info available in piccode.ini

    $AA, B, 16F 8Kw PROGMEM & 256b EE (Blk32), $4000, 256, default, 64,

     
  • Anobium

    Anobium - 2020-10-12

    Fair enough. :-)

    TOOLVERSION .......... 1.06B
    
    
    
    IDTYPEPIC............  $AA [PICCODES.INI] 
    CHIP ................. 16F18875 / 40 PINS
    FREQUENCY ............ 16 Mhz
    OSCILLATOR SOURCE .... INTERNAL
    BAUD RATE ............ 19200 BPS ( CALCULATED 19200 BPS)
    PROGMEM WORDS ........ 8192
    RAM BYTES ............ 1024
    CHIPFAMILY ........... 15
    EEMEMORY BYTES ....... 256
    PPSCHIP .............. YES
    PPSCONFIGDEFINED ..... YES
    PPSTOOLPART .......... 16F18875
    CHIPARCHITECTURE ..... 1
    
    
    TIMERDELAY ........... 1 SECS
    
    
    CONFIG:
          CONFIG1, _FCMEN_ON & CLKOUTEN_OFF & _RSTOSC_HFINTPLL & _FEXTOSC_OFF
          CONFIG2, _STVREN_ON & _ZCD_ON & _BORV_LO & _BOREN_OFF & _LPBOREN_OFF & _MCLRE_ON
          CONFIG3, _WDTCCS_SC & _WDTCWS_WDTCWS_7 & _WDTE_OFF & _WDTCPS_WDTCPS_31
          CONFIG4, _LVP_OFF & _SCANE_NOT_AVAILABLE & _WRT_OFF
          CONFIG5, CPD_OFF & CP_OFF
    
    RC6PPS = 0X0010: ANSELC.7 = 0    'TX > RC6  RXPPS = 0X0017    'RC7 > RX
    
    MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
         0000 : XX-------------- ---------------- ---------------- ----------------
         1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
         1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX----
         8000 : -------XXXXX---- ---------------- ---------------- ----------------
         All other memory blocks unused.
         Program Memory Words Used:   103
         Program Memory Words Free:  8089
    
     
  • Anobium

    Anobium - 2020-10-12

    I have tested on a 18855 which from the perspective of the bootloader is the same architecture. Works well.

    TOOLVERSION .......... 1.06B
    
    
    
    IDTYPEPIC............  $AA [PICCODES.INI] 
    CHIP ................. 16F18875 / 40 PINS
    FREQUENCY ............ 16 Mhz
    OSCILLATOR SOURCE .... INTERNAL
    BAUD RATE ............ 19200 BPS ( CALCULATED 19200 BPS)
    PROGMEM WORDS ........ 8192
    RAM BYTES ............ 1024
    CHIPFAMILY ........... 15
    EEMEMORY BYTES ....... 256
    PPSCHIP .............. YES
    PPSCONFIGDEFINED ..... YES
    PPSTOOLPART .......... 16F18875
    CHIPARCHITECTURE ..... 1
    
    
    TIMERDELAY ........... 1 SECS
    
    
    CONFIG:
          CONFIG1, _FCMEN_ON & CLKOUTEN_OFF & _RSTOSC_HFINTPLL & _FEXTOSC_OFF
          CONFIG2, _STVREN_ON & _ZCD_ON & _BORV_LO & _BOREN_OFF & _LPBOREN_OFF & _MCLRE_ON
          CONFIG3, _WDTCCS_SC & _WDTCWS_WDTCWS_7 & _WDTE_OFF & _WDTCPS_WDTCPS_31
          CONFIG4, _LVP_OFF & _SCANE_NOT_AVAILABLE & _WRT_OFF
          CONFIG5, CPD_OFF & CP_OFF
    
    RC6PPS = 0X0010: ANSELC.7 = 0    'TX > RC6  RXPPS = 0X0017    'RC7 > RX
    
    MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
         0000 : XX-------------- ---------------- ---------------- ----------------
         1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
         1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX----
         8000 : -------XXXXX---- ---------------- ---------------- ----------------
         All other memory blocks unused.
         Program Memory Words Used:   103
         Program Memory Words Free:  8089
    

    Checking device
    Open COM25 serial port at 19200 Baud Rate
       Device answer: 0xAA 0x42='B'
        byte OK, now check ID-code and Family
          idCode = $AA
          family = B
          description = 16F 8Kw PROGMEM & 256b EE
          flash mem = 16384 bytes
          EEPROM mem = 256 bytes
          Bootloader size = 200 bytes
          Transfer block size = 64 bytes
    Device detected:16F 8Kw PROGMEM & 256b EE
    Closed COM25 serial port
    TinyMultiBootLoader+ device check completed
    

    Progamminng:

    Checking device
    Open COM25 serial port at 19200 Baud Rate
       Device answer: 0xAA 0x42='B'
        byte OK, now check ID-code and Family
          idCode = $AA
          family = B
          description = 16F 8Kw PROGMEM & 256b EE
          flash mem = 16384 bytes
          EEPROM mem = 256 bytes
          Bootloader size = 200 bytes
          Transfer block size = 64 bytes
    Device detected:16F 8Kw PROGMEM & 256b EE
    Source HEX file opened: C:\temp\New1111111.hex
    Config removed from source
    Uploading PROGMEM
    Uploading program memory
    Upload was successful
    Closed COM25 serial port
    TinyMultiBootLoader+ completed
    
     
    👍
    1

    Last edit: Anobium 2020-10-12
  • epy

    epy - 2020-10-13

    Yes..It is working..Thank you vey much.
    Can you please share .asm file for my reference.

     
    • Anobium

      Anobium - 2020-10-13

      Great to hear.

      There is no ASM as such. The AutoGenerator takes the simple confiuguration paramters and produces the HEX. The report (shown above) is one of the outputs along with the HEX file.

      The process is very simple. We enter the chipname, choose the config etc. And, the HEX and report is produced a few seconds late.

      I have attached a two items. A screenshot and a PDF of a tempory file.

      The goal is to put this on the web, via a web interface. Creating Bootloaders does not need to hard. :-)

       
  • epy

    epy - 2020-10-13

    thats really awesome.
    I want to know about the address. How memory addresses are handled with this tool.
    and How are we setting the memory offeset?

    I am really impressed with this project.

     
    • Anobium

      Anobium - 2020-10-13

      The memory in terms of what? Not sure I understand the question to answer.

      But... the memory allocation is automatic. But, like this.

          Determine if SAF or HEF capable, if yes what is the required allocation of HEF/SAF, then,
          If the chip has EEPROM, then what is the chipwords size - this determines the IdTypePIC value for non HEF/SAF chips
          Then, set the IdTypePIC to the correct value for the selected chip
          Then, set the the start of the jump address to ( ChipWords - BOOTLOADERSIZE - HEFSAFMANAGED )
          Then, set the start of the BL to ( ChipWords - BOOTLOADERSIZE - HEFSAFMANAGED ) + ChipArchitecture [could be 4 or 8 ]
      

      Where is all this sourced from? Great Cow BASICs part database. Great Cow BASIC has exposed all the paramters we need to make this work.

      So, we do NO changes to the core tool. We change the parameters and it happens via the tool.

      :-)

       
      ❤️
      1
  • Anobium

    Anobium - 2020-10-13

    Oh.. and this is why you need the latest software version of TLB+.exe. - with HEF/SAF there any many, many variants of the same chips and the tool can select the correct IdTypePIC. I do not think a human can do it correctly.

    We are writing the 18F tool at the moment. We have the legacy 16f and the enhanced 16F tool completed.

     
    ❤️
    1

    Last edit: Anobium 2020-10-13

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.