PIC Programming Upload Error

Discussion in 'The Projects Forum' started by SteveGalvin, Oct 4, 2011.

  1. SteveGalvin

    Thread Starter New Member

    Oct 4, 2011
    4
    0
    Hello

    Firstly my apologies if this has already been discussed many times, but I am a complete newbie at this.

    I need to upload a PIC hex file into a 12F675 chip. I have a Vellman PIC Programmer and Experiment board that I have uploaded various example programs to a 16F627 chip and they all upload OK.

    However when I upload the hex file to the chip the upload starts OK and runs through until I get a 'Write Error at 03FF' - 'Write 3480' - 'Read 0000'

    Does anyone have any ideas as to what is going wrong. I can send the
    readback file if that will help.

    Many thanks
    Steve
     
  2. vrainom

    Member

    Sep 8, 2011
    109
    19
    3ff is the end of the flash program memory so it must mean the program is bigger than the available memory in the pic
     
  3. SteveGalvin

    Thread Starter New Member

    Oct 4, 2011
    4
    0
    Thanks vrainom I really appreciate your help. :)

    I am a iittle confused as the program has been tested and uploaded to this chip so it should be small enough to fit.

    The program was not written by me http://www.fancon.cz/slave-flash-trigger/slave-flash-en.html

    The code below is the program for the circuit.

    Many thanks Steve
    :020000040000FA
    :02000000462890
    :08000800A0000308A10083120F
    :100010000B190D280C182E280028CD30810022083D
    :100020001E029F1403191A28031C1B28A20A23026C
    :10003000031C2414A20AA203A4182328A50A031946
    :10004000A60A0319A414A4192828AC030319A4159B
    :100050000B1121088300A00E200E0900CE308F0066
    :10006000A41A3728851C4128241AA41624122419FE
    :100070003F280130A702031CA802031C24150C1002
    :1000800029282416A90A0319A90337288B139021BC
    :100090009F218512AA018230AB00851C4A28AA0B39
    :1000A0004D28AB0B4D2883169614831205088B152B
    :1000B00063008312AA014130AB00AA0B5D28AB0B91
    :1000C0005D28851800288316FF23900083122416CC
    :1000D000A412A413A90190219F21B221C021CF21F4
    :1000E000BD2124137921A41F1622A41BDC21193061
    :1000F000290203182417241B0515A41E7728A9011B
    :10010000A412241B0E29A41F88280028DC21002803
    :100110007921B101B2010130A300A901A412241375
    :10012000A41724155030A7004630A8002411A415A8
    :10013000FF30AC00A411A41D9B28A414A501A601A6
    :100140002D3084002410A412241A71282419862822
    :10015000241CA328A4142508B3002608B400A50174
    :10016000A601A410A4156430AC00A4110008B500C9
    :10017000840A0008B6003402031DC0283508330283
    :10018000031CCD283308AA003408AB003508AA02A6
    :100190003608031C360AAB02D7283508AA003608F1
    :1001A000AB003308AA023408031C340AAB02031064
    :1001B000B60CB50C2B083602031DE0282A083502C0
    :1001C0000318E4282D308400031CE728840A000863
    :1001D000B500840A000884033504031D06290514AC
    :1001E0000515A415FF30AC00A411A41DF5280510B9
    :1001F0002410A4145F30A500F030A600A410A41CA5
    :10020000FF280511241C9128FF219128A41D0629EF
    :100210002410A4189D28241C0929AA280630A3000C
    :10022000A901A4122417A41324155830A7000230E2
    :10023000A8002411A415FF30AC00A411A41D1E2990
    :10024000A414A501A601AD01AE012410241A332A7D
    :1002500024198628241C2629A4142D08AF002E0852
    :10026000B0002508AD002608AE00A501A601A41027
    :10027000A4156430AC00A411A41D3C292410A418BA
    :100280004429241C3F292C292F0830040319542900
    :100290002D08AA002E08AB002F08AD003008AE00D4
    :1002A0002A08AF002B08B0008B1383160030AA0079
    :1002B0002D3084002A089B0000089A001C15553038
    :1002C0009D00AA309D009C149C1864291A081C14D7
    :1002D0001A06031D0028840AAA0A04302A02031DF4
    :1002E0005A2983128C138B17A901A41629222922BB
    :1002F0007128831600309B001C141A08AD000130D1
    :100300009B001C141A08AE0002309B001C141A0833
    :10031000AF0003309B001C141A08B00083120800C1
    :1003200083128B0190019F010730990083168C0185
    :10033000810199019F0183128B018C0108008312B6
    :100340008B1185018316960195019514811305166D
    :100350008514851585120511051083128516051162
    :100360000510080083160C139F151F1683129F1388
    :100370001F131F159F151F1408000B178B1708005C
    :1003800090019016101683160C1083120C108E011B
    :10039000CE308F0083160C148312101408008316BD
    :1003A0008116811583128B120B11CD3081008316BB
    :1003B000811283128B160800AA012A08AB00E029DB
    :1003C000E1290511AB0FDF29AB00AB09E729E829CB
    :1003D0000515AB0FE629AA0FDD29AA012A08AB00F3
    :1003E000F129F2290515AB0FF029AB00AB09F8296B
    :1003F000F9290511AB0FF729AA0FEE2908001430CF
    :10040000AA000515A4148E30A500FD30A600A41086
    :10041000A41C082A0511A4148E30A500FD30A600E6
    :10042000A410A41C112AAA0B012A080020222D08BE
    :100430002E04031D20222F083004031D2022080053
    :10044000A4147730A500EC30A600A4100515A41C58
    :10045000272AA4147730A500EC30A600A4100511BB
    :10046000A41C302A08000511A4147730A500EC3034
    :10047000A600A410A41C3A2A05140515A415FF30E3
    :10048000AC00A411A41D422A05110510292229221D
    :020490007128D1
    :0207FE00803445
    :084000000400040001000100AE
    :02400E00843FED
    :00000001FF
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I disassembled it and there is an instruction at 3FF.
    <ed>I tried to recompile the code without the line at 3FF, and it was also complaining about the lines at 0x2000, whereas the EEPROM on the PIC12F675 starts at 0x2100, so I changed that too. If you copy the bit that looks like a hex file and save it with a .HEX extension it should burn to the chip, I've no idea if it will work, probably not but maybe worth a try.

    Code ( (Unknown Language)):
    1. :020000040000FA
    2. :100000004628A0000308A10083120B190D280C1824
    3. :100010002E280028CD30810022081E029F140319CB
    4. :100020001A28031C1B28A20A2302031C2414A20A58
    5. :10003000A203A4182328A50A0319A60A0319A414C5
    6. :10004000A4192828AC030319A4150B112108830057
    7. :10005000A00E200E0900CE308F00A41A3728851C70
    8. :100060004128241AA416241224193F280130A7027B
    9. :10007000031CA802031C24150C1029282416A90A05
    10. :100080000319A90337288B1390219F218512AA01F8
    11. :100090008230AB00851C4A28AA0B4D28AB0B4D289B
    12. :1000A00083169614831205088B1563008312AA0128
    13. :1000B0004130AB00AA0B5D28AB0B5D2885180028EA
    14. :1000C0008316FF23900083122416A412A413A901FF
    15. :1000D00090219F21B221C021CF21BD21241379215C
    16. :1000E000A41F1622A41BDC2119302902031824178F
    17. :1000F000241B0515A41E7728A901A412241B0E2970
    18. :10010000A41F88280028DC2100287921B101B20130
    19. :100110000130A300A901A4122413A4172415503000
    20. :10012000A7004630A8002411A415FF30AC00A4118C
    21. :10013000A41D9B28A414A501A6012D308400241021
    22. :10014000A412241A712824198628241CA328A41474
    23. :100150002508B3002608B400A501A601A410A41523
    24. :100160006430AC00A4110008B500840A0008B60091
    25. :100170003402031DC02835083302031CCD28330880
    26. :10018000AA003408AB003508AA023608031C360A58
    27. :10019000AB02D7283508AA003608AB003308AA02FC
    28. :1001A0003408031C340AAB020310B60CB50C2B0840
    29. :1001B0003602031DE0282A0835020318E4282D30F2
    30. :1001C0008400031CE728840A0008B500840A00089C
    31. :1001D00084033504031D062905140515A415FF30F5
    32. :1001E000AC00A411A41DF52805102410A4145F3040
    33. :1001F000A500F030A600A410A41CFF280511241CA3
    34. :100200009128FF219128A41D06292410A4189D28B7
    35. :10021000241C0929AA280630A300A901A412241726
    36. :10022000A41324155830A7000230A8002411A415E7
    37. :10023000FF30AC00A411A41D1E29A414A501A60121
    38. :10024000AD01AE012410241A332A24198628241C57
    39. :100250002629A4142D08AF002E08B0002508AD00F3
    40. :100260002608AE00A501A601A410A4156430AC00B8
    41. :10027000A411A41D3C292410A4184429241C3F299E
    42. :100280002C292F083004031954292D08AA002E0800
    43. :10029000AB002F08AD003008AE002A08AF002B08D5
    44. :1002A000B0008B1383160030AA002D3084002A087A
    45. :1002B0009B0000089A001C1555309D00AA309D0037
    46. :1002C0009C149C1864291A081C141A06031D002883
    47. :1002D000840AAA0A04302A02031D5A2983128C13A5
    48. :1002E0008B17A901A4162922292271288316003010
    49. :1002F0009B001C141A08AD0001309B001C141A0846
    50. :10030000AE0002309B001C141A08AF0003309B00A3
    51. :100310001C141A08B0008312080083128B0190018C
    52. :100320009F010730990083168C01810199019F017B
    53. :1003300083128B018C01080083128B1185018316B7
    54. :10034000960195019514811305168514851585125E
    55. :100350000511051083128516051105100800831676
    56. :100360000C139F151F1683129F131F131F159F1524
    57. :100370001F1408000B178B17080090019016101619
    58. :1003800083160C1083120C108E01CE308F00831652
    59. :100390000C14831210140800831681168115831221
    60. :1003A0008B120B11CD3081008316811283128B16B4
    61. :1003B0000800AA012A08AB00E029E1290511AB0FCA
    62. :1003C000DF29AB00AB09E729E8290515AB0FE629C2
    63. :1003D000AA0FDD29AA012A08AB00F129F229051587
    64. :1003E000AB0FF029AB00AB09F829F9290511AB0FC8
    65. :1003F000F729AA0FEE2908001430AA000515A41445
    66. :100400008E30A500FD30A600A410A41C082A0511FA
    67. :10041000A4148E30A500FD30A600A410A41C112A3F
    68. :10042000AA0B012A080020222D082E04031D2022D9
    69. :100430002F083004031D20220800A4147730A500E3
    70. :10044000EC30A600A4100515A41C272AA4147730AC
    71. :10045000A500EC30A600A4100511A41C302A080049
    72. :100460000511A4147730A500EC30A600A410A41C3C
    73. :100470003A2A05140515A415FF30AC00A411A41DDB
    74. :0C048000422A05110510292229227128AA
    75. :1042000004000400010001000000000000003F0065
    76. :02421000840028
    77. :00000001FF
    </ed>

    Code ( (Unknown Language)):
    1. gpdasm -p PIC12F675 dis
    2. 000000:  2846  goto    0x46
    3. 000004:  00a0  movwf    0x20
    4. 000005:  0803  movf    0x3, w
    5. 000006:  00a1  movwf    0x21
    6. 000007:  1283  bcf    0x3, 0x5
    7. 000008:  190b  btfsc    0xb, 0x2
    8. 000009:  280d  goto    0xd
    9. 00000a:  180c  btfsc    0xc, 0
    10. 00000b:  282e  goto    0x2e
    11. 00000c:  2800  goto    0
    12. 00000d:  30cd  movlw    0xcd
    13. ...
    14. ...
    15. section removed because of post size limit
    16. ...
    17. ...
    18. 0001d3:  128b  bcf    0xb, 0x5
    19. 0001d4:  110b  bcf    0xb, 0x2
    20. 0001d5:  30cd  movlw    0xcd
    21. 0001d6:  0081  movwf    0x1
    22. 0001d7:  1683  bsf    0x3, 0x5
    23. 0001d8:  1281  bcf    0x1, 0x5
    24. 0001d9:  1283  bcf    0x3, 0x5
    25. 0001da:  168b  bsf    0xb, 0x5
    26. 0001db:  0008  return
    27. 0001dc:  01aa  clrf    0x2a
    28. 0001dd:  082a  movf    0x2a, w
    29. 0001de:  00ab  movwf    0x2b
    30. 0001df:  29e0  goto    0x1e0
    31. 0001e0:  29e1  goto    0x1e1
    32. 0001e1:  1105  bcf    0x5, 0x2
    33. 0001e2:  0fab  incfsz    0x2b, f
    34. 0001e3:  29df  goto    0x1df
    35. 0001e4:  00ab  movwf    0x2b
    36. 0001e5:  09ab  comf    0x2b, f
    37. 0001e6:  29e7  goto    0x1e7
    38. 0001e7:  29e8  goto    0x1e8
    39. 0001e8:  1505  bsf    0x5, 0x2
    40. 0001e9:  0fab  incfsz    0x2b, f
    41. 0001ea:  29e6  goto    0x1e6
    42. 0001eb:  0faa  incfsz    0x2a, f
    43. 0001ec:  29dd  goto    0x1dd
    44. 0001ed:  01aa  clrf    0x2a
    45. 0001ee:  082a  movf    0x2a, w
    46. 0001ef:  00ab  movwf    0x2b
    47. 0001f0:  29f1  goto    0x1f1
    48. 0001f1:  29f2  goto    0x1f2
    49. 0001f2:  1505  bsf    0x5, 0x2
    50. 0001f3:  0fab  incfsz    0x2b, f
    51. 0001f4:  29f0  goto    0x1f0
    52. 0001f5:  00ab  movwf    0x2b
    53. 0001f6:  09ab  comf    0x2b, f
    54. 0001f7:  29f8  goto    0x1f8
    55. 0001f8:  29f9  goto    0x1f9
    56. 0001f9:  1105  bcf    0x5, 0x2
    57. 0001fa:  0fab  incfsz    0x2b, f
    58. 0001fb:  29f7  goto    0x1f7
    59. 0001fc:  0faa  incfsz    0x2a, f
    60. 0001fd:  29ee  goto    0x1ee
    61. 0001fe:  0008  return
    62. 0001ff:  3014  movlw    0x14
    63. 000200:  00aa  movwf    0x2a
    64. 000201:  1505  bsf    0x5, 0x2
    65. 000202:  14a4  bsf    0x24, 0x1
    66. 000203:  308e  movlw    0x8e
    67. 000204:  00a5  movwf    0x25
    68. 000205:  30fd  movlw    0xfd
    69. 000206:  00a6  movwf    0x26
    70. 000207:  10a4  bcf    0x24, 0x1
    71. 000208:  1ca4  btfss    0x24, 0x1
    72. 000209:  2a08  goto    0x208
    73. 00020a:  1105  bcf    0x5, 0x2
    74. 00020b:  14a4  bsf    0x24, 0x1
    75. 00020c:  308e  movlw    0x8e
    76. 00020d:  00a5  movwf    0x25
    77. 00020e:  30fd  movlw    0xfd
    78. 00020f:  00a6  movwf    0x26
    79. 000210:  10a4  bcf    0x24, 0x1
    80. 000211:  1ca4  btfss    0x24, 0x1
    81. 000212:  2a11  goto    0x211
    82. 000213:  0baa  decfsz    0x2a, f
    83. 000214:  2a01  goto    0x201
    84. 000215:  0008  return
    85. 000216:  2220  call    0x220
    86. 000217:  082d  movf    0x2d, w
    87. 000218:  042e  iorwf    0x2e, w
    88. 000219:  1d03  btfss    0x3, 0x2
    89. 00021a:  2220  call    0x220
    90. 00021b:  082f  movf    0x2f, w
    91. 00021c:  0430  iorwf    0x30, w
    92. 00021d:  1d03  btfss    0x3, 0x2
    93. 00021e:  2220  call    0x220
    94. 00021f:  0008  return
    95. 000220:  14a4  bsf    0x24, 0x1
    96. 000221:  3077  movlw    0x77
    97. 000222:  00a5  movwf    0x25
    98. 000223:  30ec  movlw    0xec
    99. 000224:  00a6  movwf    0x26
    100. 000225:  10a4  bcf    0x24, 0x1
    101. 000226:  1505  bsf    0x5, 0x2
    102. 000227:  1ca4  btfss    0x24, 0x1
    103. 000228:  2a27  goto    0x227
    104. 000229:  14a4  bsf    0x24, 0x1
    105. 00022a:  3077  movlw    0x77
    106. 00022b:  00a5  movwf    0x25
    107. 00022c:  30ec  movlw    0xec
    108. 00022d:  00a6  movwf    0x26
    109. 00022e:  10a4  bcf    0x24, 0x1
    110. 00022f:  1105  bcf    0x5, 0x2
    111. 000230:  1ca4  btfss    0x24, 0x1
    112. 000231:  2a30  goto    0x230
    113. 000232:  0008  return
    114. 000233:  1105  bcf    0x5, 0x2
    115. 000234:  14a4  bsf    0x24, 0x1
    116. 000235:  3077  movlw    0x77
    117. 000236:  00a5  movwf    0x25
    118. 000237:  30ec  movlw    0xec
    119. 000238:  00a6  movwf    0x26
    120. 000239:  10a4  bcf    0x24, 0x1
    121. 00023a:  1ca4  btfss    0x24, 0x1
    122. 00023b:  2a3a  goto    0x23a
    123. 00023c:  1405  bsf    0x5, 0
    124. 00023d:  1505  bsf    0x5, 0x2
    125. 00023e:  15a4  bsf    0x24, 0x3
    126. 00023f:  30ff  movlw    0xff
    127. 000240:  00ac  movwf    0x2c
    128. 000241:  11a4  bcf    0x24, 0x3
    129. 000242:  1da4  btfss    0x24, 0x3
    130. 000243:  2a42  goto    0x242
    131. 000244:  1105  bcf    0x5, 0x2
    132. 000245:  1005  bcf    0x5, 0
    133. 000246:  2229  call    0x229
    134. 000247:  2229  call    0x229
    135. 000248:  2871  goto    0x71
    136. [B]0003ff:  3480  retlw    0x80[/B]
    137. 002000:  0004  dw    0x4  ;unknown opcode
    138. 002001:  0004  dw    0x4  ;unknown opcode
    139. 002002:  0001  dw    0x1  ;unknown opcode
    140. 002003:  0001  dw    0x1  ;unknown opcode
    141. 002007:  3f84  addlw    0x84
    142.  
     
    Last edited: Oct 5, 2011
  5. SteveGalvin

    Thread Starter New Member

    Oct 4, 2011
    4
    0
    Thanks markd77, what I found out was that I did not erease the bulk code and data before I wrote the program to the chip. I assumed that the checkbox which said 'erase before write' would do that.

    I will give it a try and see what happens!

    Many thanks for your help

    Steve
     
  6. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    On the 12F675, Address 0x3FF is the last word in the flash memory and has been used by Microchip to store a certain, chip specific calibration value, which if you chose to use it, can set the internal oscillator frequency of the PIC to within one or a few percents of the stated clock frequency.

    So unless you know what this value is for the chip in hand and have make a copy of it, chances are you are going to overwritten it with a meaningless value. I think the Vellman Programmer is just over protective in this respect and does not allow the value to be lost.

    I have removed this particular part in your HEX code so you can program it to the 12F675. Rename the text filename to 675.hex after download.
     
    SteveGalvin likes this.
  7. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I made a couple of edits to my post, just letting you know in case you didn't scroll down.
     
    SteveGalvin likes this.
Loading...