Menu

Bootloader for PIC16F18855

2016-08-22
2017-02-19
1 2 > >> (Page 1 of 2)
  • Mark Osborne

    Mark Osborne - 2016-08-22

    Hi,
    I'm trying to design a bootloader for the PIC16F18855,

    I'm using MPLAB X IDE, but the reference design uses the earlier MPLAB IDE 8.91.

    If I use the PIC16F1827 as a reference, How do I first customize this for PIC16F18855 and then port it to MPLAB X IDE.

    Thank you for your help

    Mark

     
  • Dan

    Dan - 2016-08-22

    Hi,Mark

    ①PIC16F18855 uses the PPS and NVMCON.
    It is better to modify the source of PIC16F183XX.

    ②In PIC16F18555 Note that NVMCON exists in the bank 16.

     

    Last edit: Dan 2016-08-23
  • Dan

    Dan - 2016-08-22

    Hi,Mark

    This is beta version.
    As you want.

    Correct I found a bug.
    ->beta3.asm

    piccodes.ini.txt --> piccodes.ini

     

    Last edit: Dan 2016-08-23
  • Anobium

    Anobium - 2016-08-23

    Here is my attempt. Not tested. I would like someone to test.

     
    • Mark Osborne

      Mark Osborne - 2016-08-24

      Hi Dan,
      When testing Beta3.asm, I believe line 128 & 227 should be bank 29. Still not got the UART comms working.

      One question, How does the boot exit work?
      if the device is erased then you load the bootloader, but you Don't have an Application code loaded.

      Will the boot loader be continuely looped?

       
      • Dan

        Dan - 2016-08-24

        Hi,Mark

        The meaning of the bank 29 I do not know

        It does not have a valid register is in the bank 29.

        If the application does not exist boot loader will loop infinitely.

         
        • Anobium

          Anobium - 2016-08-25

          @Dan. You looking at the correct datasheet for the 18855?

           
    • Mark Osborne

      Mark Osborne - 2016-08-24

      Hi Anobium,
      When testing 16f18855.asm, I believe line 14 & 15 should be 0x17 and 0x16. I'm Still working on the UART comms.

      Mark

       
      • Anobium

        Anobium - 2016-08-24

        I was trying to get Xpress Board operating. RC1 is RX and RC0 is TX.

        The 16f18855.asm has lines 14 & 15 as 0x17 and 0x16 so I am puzzled to what you mean.

         
  • Mark Osborne

    Mark Osborne - 2016-08-23

    Hi Thank you both,
    I'm testing both of these versions, at the moment in both cases I'm checking for device, and I'm getting ' No Device Detected'

    Checking my setup i've modified the firmware.ini to include the 16F18855 internal clock, and tx rx pins etc.
    At the moment I'm using manual reset holding MRST low with a jumper.

    I'm using MPLAB X IDE and under Project properties mpasm (global Options) I've ticked Build in absolute mode.

    In my hardware I don't have the option of using RTS. My setup is an embedded setup, where I have the UART of an embedded PC routing directly to the UART of the PIC, i.e. there is no MAX232.

    Regards,
    Mark

     
  • Anobium

    Anobium - 2016-08-25

    My latest attempt.

    This is BETA3.asm plus the correction to BANK 29. i am use c.0 and c.1 for TX and RX.

    Result - no response. No response to the 'send: C1' command.

    I am confident of test rig - is not a bunch of cables. :-)

     
    • Mark Osborne

      Mark Osborne - 2016-08-25

      This is what I'm experiencing also, i.e. No response to the 'send C1 command. I'm using RC6 and RC7 for TX and RX.
      I've been trying to prove the PPS is setup correctly.
      I'm move familar with coding in C, but
      Is line 124 correct,
      movwf RA0PPS+txPPS; shouldn't it be something like [movwf RC6PPS] for my case.

       
      • Anobium

        Anobium - 2016-08-25

        RA0PPS+txPPS is an index from RA0 to the decimal of the port you selected. I think this is ok as RA0PPS should be 0.

         
    • Anobium

      Anobium - 2016-08-25

      This is my test program. This works. This tests the PPS, and the serial connectivity.

          #chip 16F18855,32
          #config mclr_on
      
          'Set the PPS of the PWM and the RS232 ports.
          UNLOCKPPS
            RXPPS  = 17 'Pin RC1 source is an input for RX
            RC0PPS = 16 'Pin RC0 source is TX/CK
          LOCKPPS
      
          #define USART_BAUD_RATE 19200
          #define USART_TX_BLOCKING
          #define USART_BLOCKING
      
          dir porta.0 out
      
          wait 500 ms
      
          HSerPrint "Welcome"
          HSerPrintCRLF 2
      
          do
              'wait for char from UART
              HSerReceive InChar
              'send back char to UART
              HSerSend InChar
              'Set Current state to the NOT the current status
              porta.0 = !porta.0
      
          loop
      

      I get the following show on the terminal when I enter AAAAAAABCD.

      Welcome
      
      AAAAAAABCD
      

      This is the test for overall solution I am using. Into this config I am trying to use the TBL+ hex.

      The ASM is attached.

       
  • Dan

    Dan - 2016-08-26

    Hi,
    This is a New beta.

     
    • Anobium

      Anobium - 2016-08-27

      No response. The insight I have - C6 is NOT high. I would have expected that to be high.

      Also, I had to edit to remove & _BORV_HIGH

      I have compiled using the code unchanged. I have moved my test to be the same C6 and C7 ports are the asm. I adapted my 'blinkled' to ensure comms were all correct - they verified as operation.

      I am using v0.11.0 plus the INI above and beta4.asm.

       
  • Dan

    Dan - 2016-08-28

    Hi,Anobium
    Thank you for your report.

    The 02_Blink.asm was rewritten to reference.
    Does this will work?

     

    Last edit: Dan 2016-08-28
  • Anobium

    Anobium - 2016-08-28

    Beta6.asm is operational. Well done - good job.

    I did not test beta5.asm.

    Initial tests are completed.

    1. v.0.11.0 responds to Check Device
    2. 02_Blink.asm operates as expected.
    3. 17 Show I2C Devices to Serial Terminal (same ports as TLB) operates as expected.

    It will take many hours to run all the tests. I will complete asap.

    Questions:

    1. What is the correct config we should be using in the TBL+ asm?
    2. What is the correct config we should be using in the user source program?
    3. What others changes do we need to make to the TBL+ source?
     

    Last edit: Anobium 2016-08-28
    • Anobium

      Anobium - 2016-08-28

      Test results. Thought I would share...

      The beta6.asm works correctly on the Microchip Xpress Board (this operates via an 18F USB driver).

      I ran three four programs. All operate as expected.

      1. LED on
      2. Blink LED
      3. Blink LED using Int0 as the timeout source
      4. Temperature sensors using I2C2 bus, EMC1001 and serial output.

      [EDITED] Tested more demos. ADC, timer0, ints, serial, i2C, pwm, ccp - all look good.

       

      Last edit: Anobium 2016-08-28
  • Dan

    Dan - 2016-08-28

    Hi,Anobium
    Thank you for your report.

    In the current state of the host program, it does not support the re-setting of the config.

    Do you cooperate the assembler source in order to generalize?
    (Specific error location)

    ①test beta5 (Setting of ansel is different)
    If it ok
    ②test beta51 (Setting of config is different)

     

    Last edit: Dan 2016-08-28
    • Anobium

      Anobium - 2016-08-28

      What has happened to beta6?

      I am meant to be using beta51?

      I am confused which version I should be testing.

       
      • Anobium

        Anobium - 2016-08-28

        Just did quick test on beta51.asm.

        Works as expected. Not fully tested but a complex piece of HEX was tested and all was ok.

         
  • Dan

    Dan - 2016-08-28

    Hi,Anobium
    Thank you for your report.

    By beta51 has been activated, it was found to cause operating failure of 16F18855.
    Thank you for your cooperation.

    Contents are almost the same, but I attach a formal revision.
    Please use this one.

    Re-setting CONFIG is technically possible, but it is expected to size up than 100 words.
    And correspond, if there is hope.

     
    • Anobium

      Anobium - 2016-08-29

      You need to remove BORVHIGH. This is causing compiler errors.

      I see futher code changes. Retest needed?

       
  • Dan

    Dan - 2016-08-29

    Excuse me.
    According to the p16lf18855.inc, _BORV_HI is the correct description.

    I attach a modified version.

    Additional verification experiment is considered unnecessary.
    Your offer Thank you very much.

     
1 2 > >> (Page 1 of 2)

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.