Menu

Quickstart guide

edorul
2013-04-23
2014-01-24
  • edorul

    edorul - 2013-04-23

    Hello,

    For those who want to try "Tiny PIC Bootloader +" but don't know where to start, there is now a "Quickstart guide" in the web site: http://tinypicbootload.sourceforge.net/quickstart.html

    Best regards,
    Edorul

     
  • Piki

    Piki - 2013-12-02

    Hi! I'm try to use Tiny PIC Bootloader+, I have been reading the Quickstart guide and I made the steps but the Tiny PIC Bootloader says:
    "Check Device...
    Open COM4 serial port at 9600bd
    Software reseting Device
    Error: No Device Detected!!!
    Verify: - COM number
    - baud rate
    - if Device was reseted less than 1sec ago
    (do you need to check "RST Reset"?)
    - if TinyBootloader firmware is correctly
    programmed into Device
    Close COM4 serial port"
    In the bootloader program:
    I check the device and Baud rate
    I conected the MCLR pin to RST of the DB9 like can see in the http://tinypicbootload.sourceforge.net/hardware_connection.html page, so anyidea, what could be my problem?

     
    • Sunish Issac

      Sunish Issac - 2013-12-03

      Try disabling RTS reset and do a manual reset. A delay is required after
      RTS reset for the timings to be right which is disabled in the current
      version of PC software.

      Sunish

      On Tue, Dec 3, 2013 at 4:34 AM, Cristy piki4@users.sf.net wrote:

      Hi! I'm try to use Tiny PIC Bootloader+, I have been reading the
      Quickstart guide and I made the steps but the Tiny PIC Bootloader says:
      "Check Device...
      Open COM4 serial port at 9600bd
      Software reseting Device
      Error: No Device Detected!!!
      Verify: - COM number
      - baud rate
      - if Device was reseted less than 1sec ago
      (do you need to check "RST Reset"?)
      - if TinyBootloader firmware is correctly
      programmed into Device
      Close COM4 serial port"
      In the bootloader program:
      I check the device and Baud rate
      I conected the MCLR pin to RST of the DB9 like can see in the
      http://tinypicbootload.sourceforge.net/hardware_connection.html page, so
      anyidea, what could be my problem?


      Quickstart guidehttps://sourceforge.net/p/tinypicbootload/discussion/help/thread/c91d75e5/?limit=25#674e

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/tinypicbootload/discussion/help/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Piki

        Piki - 2013-12-04

        Hi!, I used other bootloader to my PIc and works, The Tiny PIC Bootloader recongnizes my PIC, now the problem is the program says "Error: Hex file for PIC16F, PIC family mismatch." and both programs are to PIC182620 , I don't understand what's wrong?...

         
        • Sunish Issac

          Sunish Issac - 2013-12-05

          Which compiler are you using ? Are the pragmas right ?

           
  • Dan

    Dan - 2013-12-05

    Hi,Cristy,

    "Error: Hex file for PIC18F, PIC family mismatch."
    appears because there is a bug in the "check file" procedure in TinyBootloader+

    http://sourceforge.net/p/tinypicbootload/discussion/help/thread/709981f3/

     
  • Piki

    Piki - 2013-12-05

    Sunish Issac.- I used Mplab IDE with MPASMWIN, and I don't know what do you mean with: Are the pragmas right ? sorry .

    Dan .- Hi!, I have troubles when I press "write device", when I press "Check device" all is good, but when I want to write so I have problems, It's the same that you say?

     
    • edorul

      edorul - 2013-12-12

      Hello Cristy,

      Yes it's the same Dan told you about.
      Sorry for the inconvenience but it won't be fixed quickly :-(
      So for the moment, just uncheck "check file" in "transfert options".

      Best regards,
      Edorul

       
  • Piki

    Piki - 2013-12-05

    This is the process:

    Check Device...
    Open COM4 serial port at 19200bd
    Software reseting Device
    Device answer: 0x4F 0x4B='K'
    byte OK, now check ID-code and Family...
    idCode = $4F
    family = C
    description = 18F 2620/4620/4680
    flash mem = 65536 bytes
    EEPROM mem = 1024 bytes
    Bootloader size = 200 bytes
    Transfert block size = 64 bytes
    Found: 18F 2620/4620/4680
    Open HEX file: C:\Proyecto_bootloader\main.hex
    Checking hex file:
    Hex file end line
    Comment in file: ;PIC18F2620
    Comment in file: ;CRC=AE24 CREATED="05-dic-13 10:33"
    HEX sumary: INX32M,
    PIC16F + cfg,
    total=598 bytes.
    Error: Hex file for PIC16F, PIC family mismatch.
    Close COM4 serial port

     
  • Piki

    Piki - 2013-12-05

    I download the v0.8.1 version and works !! :)

    Thanks!! :D

     
    • edorul

      edorul - 2013-12-12

      Hi again !

      It won't be OK for all PIC devices... you can still have a "PIC family mismatch" error.
      As said before, just uncheck "check file" in "transfert options".

      Best regards,
      Edorul

       

      Last edit: edorul 2013-12-12
  • Piki

    Piki - 2013-12-06

    Hi!, One question.. I need to add something in the code to program?, I mean, it's necesary jump to a direction of memory in PIC?

     
  • Dan

    Dan - 2013-12-07

    Hi,Cristy

    ++ Constraints on source program created in PIC18F ++

    1.With or without interrupt use, describes the instruction 'goto' four words beginning.

    2.You can not describe the relative jump instruction in four words beginning.(rcall,bra)

    3.Maximum program size = max_flash_size - bootloader_size

    source Example

    [good]
    0000:call AAA
    0002:goto INIT

    [good]
    0000:goto INIT

    [NG]
    0000:rcall AAA
    0001:rcall BBB
    0002:goto INIT

    [NG]
    0000:call AAA
    0002:bra INIT

    [NG]
    0000:bra INIT

    Reference:
    Tiny_Avr-Pic_Bootloader+ (v0.8.1)/docs/Fctmt_Bootloader_PIC_AVR.xls

     

    Last edit: Dan 2013-12-07
    • edorul

      edorul - 2013-12-12

      Hello Dan !

      Thanks for this answer!!! I'll put it in this web page:
      http://tinypicbootload.sourceforge.net/tested_compilers_pic.html

      Best regards,
      Edorul

       
  • Piki

    Piki - 2014-01-23

    Hi again! :) Finally I can programm my pic, but it doesn't work like should it.. Somebody can help me please! somebody had the same problem ?

     
  • Dan

    Dan - 2014-01-23

    Hi,Piki

    After compiling the source of you,
    Please describe the first four words of assembler code.

     
    • Piki

      Piki - 2014-01-23

      This is the bootloader that I had used...
      radix DEC
      LIST P=18F4620 ; change also: Configure->SelectDevice from Mplab
      xtal EQU 32000000 ; you may want to change: _XT_OSC_1H _HS_OSC_1H _HSPLL_OSC_1H
      ;baud EQU .16 ; for 115200
      ;baud EQU .34 ; for 57600
      ;baud EQU .52 ; for 38400
      ;baud EQU .103 ; for 19200

      baud EQU .207 ;for 9600
      ; The above 3 lines can be changed and buid a bootloader for the desired frequency (and PIC type)

      ;********************************************************************
      ;   Tiny Bootloader     18F series      Size=100words
      ;   claudiu.chiculita@ugal.ro
      ;   http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
      ;********************************************************************
      
      #include "../icdpictypes.inc"   ;takes care of: #include "p18fxxx.inc",  max_flash, IdTypePIC
      
      #define first_address max_flash-200     ;100 words
      CONFIG OSC      = INTIO67
      CONFIG FCMEN    = OFF
      CONFIG IESO     = OFF
      CONFIG PWRT     = ON
      CONFIG WDT      = OFF
      CONFIG WDTPS    = 32
      CONFIG MCLRE    = ON
      CONFIG PBADEN   = OFF
      CONFIG CCP2MX   = PORTBE
      CONFIG STVREN   = OFF
      CONFIG LVP      = OFF
      CONFIG XINST    = OFF
      CONFIG DEBUG    = OFF
      CONFIG CP0      = OFF
      CONFIG CP1      = OFF
      CONFIG CP2      = OFF
      CONFIG CP3      = OFF
      CONFIG CPB      = OFF
      CONFIG CPD      = OFF
      CONFIG WRT0     = OFF
      CONFIG WRT1     = OFF
      CONFIG WRT2     = OFF
      CONFIG WRT3     = OFF
      CONFIG WRTB     = OFF
      CONFIG WRTC     = OFF
      CONFIG WRTD     = OFF
      CONFIG EBTR0    = OFF
      CONFIG EBTR1    = OFF
      CONFIG EBTR2    = OFF
      CONFIG EBTR3    = OFF
      CONFIG EBTRB    = OFF
      

      ;----------------------------- PROGRAM ---------------------------------
      cblock 0
      crc
      i
      cnt1
      cnt2
      cnt3
      counter_hi
      counter_lo
      flag
      endc
      cblock 10
      buffer:64
      endc

      SendL macro car
      movlw car
      movwf TXREG
      endm

      ;0000000000000000000000000 RESET 00000000000000000000000000

      ORG     0x0000
      GOTO    IntrareBootloader
      

      ;view with TabSize=4
      ;&&&&&&&&&&&&&&&&&&&&&&& START &&&&&&&&&&&&&&&&&&&&&&
      ;---------------------- Bootloader ----------------------
      ;PC_flash: C1h U H L x ... <64 bytes> ... crc
      ;PC_eeprom: C1h 40h EEADR EEDATA 0 crc
      ;PC_cfg C1h U OR 80h H L 1 byte crc
      ;PIC_response: type K

      ORG first_address       ;space to deposit first 4 instr. of user prog.
      nop
      nop
      nop
      nop
      
      ORG first_address+8
      

      IntrareBootloader
      ;switch internal oscillator to 8MHz
      setf OSCCON
      ;init serial port
      movlw b'00100100'
      movwf TXSTA
      movlw b'10010000'
      movwf RCSTA
      bsf BAUDCON, BRG16
      movlw baud
      movwf SPBRG
      ;wait for computer
      rcall Receive
      sublw 0xC1 ;Expect C1h
      bnz way_to_exit
      SendL IdTypePIC ;send PIC type

      MainLoop
      SendL 'K' ; "-Everything OK, ready and waiting."

      mainl
      clrf crc
      rcall Receive ;Upper
      movwf TBLPTRU
      movwf flag ;(for EEPROM and CFG cases)
      rcall Receive ;Hi
      movwf TBLPTRH
      movwf EEADR ;(for EEPROM case)
      rcall Receive ;Lo
      movwf TBLPTRL
      movwf EEDATA ;(for EEPROM case)

      rcall Receive           ;count
      movwf i
      incf i
      lfsr FSR0, (buffer-1)
      

      rcvoct ;read 64+1 bytes
      movwf TABLAT ;prepare for cfg; => store byte before crc
      rcall Receive
      movwf PREINC0
      decfsz i
      bra rcvoct

      tstfsz crc              ;check crc
      bra ziieroare
      btfss flag,6        ;is EEPROM data?
      bra noeeprom
      movlw b'00000100'   ;Setup eeprom
      rcall Write
      bra waitwre
      

      noeeprom
      btfss flag,7 ;is CFG data?
      bra noconfig
      tblwt ;write TABLAT(byte before crc) to TBLPTR**
      movlw b'11000100' ;Setup cfg
      rcall Write
      bra waitwre

      noconfig
      ;write
      eraseloop
      movlw b'10010100' ; Setup erase
      rcall Write
      TBLRD*- ; point to adr-1

      writebigloop
      movlw 8 ; 8groups
      movwf counter_hi
      lfsr FSR0,buffer

      writesloop
      movlw 8 ; 8bytes = 4instr
      movwf counter_lo

      writebyte
      movf POSTINC0,w ; put 1 byte
      movwf TABLAT
      tblwt+*
      decfsz counter_lo
      bra writebyte

      movlw   b'10000100'     ; Setup writes
      rcall Write
      decfsz counter_hi
      bra writesloop
      

      waitwre
      ;btfsc EECON1,WR ;for eeprom writes (wait to finish write)
      ;bra waitwre ;no need: round trip time with PC bigger than 4ms

      bcf EECON1,WREN         ;disable writes
      bra MainLoop
      

      ziieroare ;CRC failed
      SendL 'N'
      bra mainl

      ;* procedures *****

      Write
      movwf EECON1
      movlw 0x55
      movwf EECON2
      movlw 0xAA
      movwf EECON2
      bsf EECON1,WR ;WRITE
      nop
      ;nop
      return

      Receive
      movlw xtal/2000000+1 ; for 20MHz => 11 => 1second delay
      movwf cnt1

      rpt2
      clrf cnt2

      rpt3
      clrf cnt3

      rptc
      btfss PIR1,RCIF ;test RX
      bra notrcv
      movf RCREG,w ;return read data in W
      addwf crc,f ;compute crc
      return

      notrcv
      decfsz cnt3
      bra rptc
      decfsz cnt2
      bra rpt3
      decfsz cnt1
      bra rpt2
      ;timeout:

      way_to_exit
      bcf RCSTA, SPEN ; deactivate UART
      bra first_address
      ;*********
      ; After reset
      ; Do not expect the memory to be zero,
      ; Do not expect registers to be initialised like in catalog.

              END
      
       
    • Piki

      Piki - 2014-01-23

      And my code that I want to program is C not assembler.. What I can do?

       
      • Dan

        Dan - 2014-01-24

        hi,Piki

        I have written your firmware.
        Transfer format of the EEPROM has changed in Tiny AVR / PIC Bootloader +.

        Please perform the source change based on tinybld18F2620-4620-4680.asm that is attached to the Tiny AVR / PIC Bootloader +

         
        • Piki

          Piki - 2014-01-24

          Hi Dan!, I've tried with tinybld18F2620-4620-4680.asm in the Tiny_Avr-Pic_Bootloader+ (v0.8.3) and the software doesn't recognize my PIC and with the previous bootloader yes.

           
  • Davide Spazian

    Davide Spazian - 2014-01-23

    Dears,
    I'm trying to get the bootloader running in UART mode for a PIC32MX795F512L. I need to make some modifications on the original code, because I'm using the UART1 instead of UART2, and I would prefer a baud rate of 38400 / 57600 instead of the faster 115200. So I opened up the project, make some change, for example lighting up my LED, and all the communication setting I need, recompiled it with success and downloaded it. no way, it seems the bootloader is not starting, the board seems to be dead. Any tips?

    Davide

     
  • Davide Spazian

    Davide Spazian - 2014-01-23

    Never mind, I got it working.

     

Log in to post a comment.