Menu

Error writing address

Csanyi Pal
2010-04-05
2019-10-24
  • Csanyi Pal

    Csanyi Pal - 2010-04-05

    Hello,

    I'm trying to program a PIC16F877A with OpenProgrammer on Debian GNU/Linux
    Lenny on the commandline with the command:
    op -d 16F877A -w Terv_CsP3_0_1_LedFenyeKikapcsResOptoLezarva.hex

    but get errors:
    Programmer detected
    Firmware version 0.6.1
    Hardware ID: 0.0.1 (18F2550)

    Regulator up and running after T=96 ms VPP=12.6V

    Terv_CsP3_0_1_LedFenyeKikapcsResOptoLezarva.hex :

    Code memory:

    0000: 1683 1303 3006 009F 301F 0085 3000 0088 1283 1303 3000 0088 1C05 0D88
    1C85 0C88
    0010: 201A 1905 1408 1D05 1008 1985 1488 1D85 1088 280C 3019 0080 3019 0081
    300A 0082
    0020: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0B82 2820 0B81 281E
    0B80 281C
    0030: 0008 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF
    FFFF FFFF
    2000: FFFF FFFF FFFF FFFF FFFF FFFF FFFF 3F79

    DevID: 0x0E28
    16F877A rev8
    Configuration word: 0x3F79
    Erasing ... completed
    Writing code ... 1%
    Error writing address 30: written 0008, read 0B82

    Error writing address 31: written 3FFF, read 2820

    Error writing address 32: written 3FFF, read 0B81

    Error writing address 33: written 3FFF, read 281E

    Error writing address 34: written 3FFF, read 0B80

    Error writing address 35: written 3FFF, read 281C
    completed, 45 errors
    Writing CONFIG area ... completed, 0 errors

    End (1.25 s) 45 errors

    The assembly program follows:

                            ;Szerzo: Csanyi Pal <csanyipal@gmail.com>
                            ;Verzioszam: v 0.0.1
                            ;Datum: 2010. aprilis 05.
                            ;Ismerteto:
                            ;PIC16F877A erzekel ket nyomogombot, 
                            ;es ket TCST1030-as optikai reskaput
    
        LIST P=16F877A
        #INCLUDE "P16F877A.INC"
        __CONFIG _XT_OSC&_CP_OFF&_WDT_OFF&_LVP_OFF
    
        ORG     0           ;a PIC memoriajaban a program a 
                            ;0-ik cimtol kezdve lesz betoltve
    
        CBLOCK  0x20        ;helyfoglalas a valtozoknak a memoriaban
                T1          ;keslelteteshez
                T2          ;keslelteteshez
                T3          ;keslelteteshez
                ORK         ;optikai reskapukhoz
        ENDC
    
    START
        BANKSEL ADCON1      ;switching to BANK1
        MOVLW   0x06        ;to set ADCON1 bit's 3-0 (PCFG <3:0> 011x
        MOVWF   ADCON1      ;configure ADCON1 eight bit's (AN7-AN0) to be digital I/O
        MOVLW   B'00011111'
        MOVWF   TRISA       ;PORTA as input
        MOVLW   B'00000000'
        MOVWF   TRISD       ;PORTD as output
    
        BANKSEL PORTD       ;switching to BANK0
    
        MOVLW   B'00000000' ;switch off the LEDs
        MOVWF   PORTD
    
    MAIN
        BTFSS   PORTA,0     ;Kovetkezo sor vegrehajtasa, ha lenyomva S1 kapcsolo
        RLF     PORTD,F     ;Balra forgatja a biteket (F most egyenlo a PORTD-vel)
        BTFSS   PORTA,1     ;Kovetkezo sor vegrehajtasa, ha lenyomva S2 kapcsolo
        RRF     PORTD,F     ;Jobbra forgatja a biteket
        CALL    KESLELTETO  ;hivjuk a lassito alprogramot
    
                            ;detecting RA2 bit of PORTA
                            ;--------------------------
        BTFSC   PORTA,2     ;skip the next command if the
                            ;Optical Slotted Switch connected to RA2 pin
                            ;(PORTA) with Collector of the PhotoTransistor
                            ;give to us logical 0, because the slot is
                            ;open
        BSF     PORTD,0     ;switch on the 0. LED of PORTD
        BTFSS   PORTA,2     ;skip the next command if the
                            ;Optical Slotted Switch connected to RA2 pin
                            ;(PORTA) with Collector of the PhotoTransistor
                            ;give to us logical 1, because the slot is
                            ;blocked
        BCF     PORTD,0     ;switch off the 0. LED of PORTD
    
                            ;detecting RA3 bit of PORTA
                            ;--------------------------
        BTFSC   PORTA,3     ;skip the next command if the
                            ;Optical Slotted Switch connected to RA3 pin
                            ;(PORTA) with Collector of the PhotoTransistor
                            ;give to us logical 0, because the slot is
                            ;open
        BSF     PORTD,1     ;switch on the 1. LED of PORTD
        BTFSS   PORTA,3     ;skip the next command if the
                            ;Optical Slotted Switch connected to RA3 pin
                            ;(PORTA) with Collector of the PhotoTransistor
                            ;give to us logical 1, because the slot is
                            ;blocked
        BCF     PORTD,1     ;switch off the 1. LED of PORTD
    
        GOTO    MAIN
    
                            ;alprogramok
    KESLELTETO              ;KESLELTETO alprogram cimkeje
        MOVLW   d'25'
        MOVWF   T1          ;T1-be kerul a 25
    KESK
        MOVLW   d'25'
        MOVWF   T2          ;T2-be kerul a 25
    KESK1
        MOVLW   d'10'
        MOVWF   T3          ;T3-ba kerul a 10
    KESK2
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        DECFSZ  T3,f        ;Csokkenti a T3-at, addig, amig nem nulla
        GOTO    KESK2       ;visszaugrik a DEL2-re, vagyis a sok NOP-ra
        DECFSZ  T2,f        ;Ha T3 mar nulla, akkor ugyanez eljatszodik a T2-vel
        GOTO    KESK1
        DECFSZ  T1,f        ;Majd a T1-el is
        GOTO    KESK
        RETURN              ;Visszater a KESLELTETO szubrutinbol
    
    END
    

    Why get I these errors?

    Any advices will appreciated!

    --
    Regards,
    Paul Chany

     
  • Alberto Maccioni

    You should provide the write log in order to see exactly what's going on.

    Alberto

     
  • Csanyi Pal

    Csanyi Pal - 2010-04-11

    OK Alberto, it works now.
    I have used 'op' version 0.6.2 and there I had not must to install 'op' with
    'make' and 'make install' on GNU/Linux systems.
    But with 'op' versions 0.7.0 and 0.7.2 I must to install 'op' with 'make' and
    'make install' commands.
    So I have now installed 'op' version 0.7.2 in my /usr/local/ directory and can
    to use with above mentioned code successfully. :)

    --
    Best regards!
    Paul Chany

     
  • Csanyi Pal

    Csanyi Pal - 2010-04-11

    I want to say that when I tried with 'op' version 0.7.2 to write HEX file to
    the PIC16F877A, and get above mentioned errors, then I used this op version
    without have had run 'make' and 'make install' commands. I used 'op' just from
    the unpacked directory of 'op'.

    --
    Best regards,
    Paul Chany

     
  • Alberto Maccioni

    So you were in fact using v0.6.2, which was probably first in your search
    path.

    Alberto

     
  • Csanyi Pal

    Csanyi Pal - 2010-04-12

    So you were in fact using v0.6.2, which was probably first in your search
    path.

    The op v0.6.2 has no Makefile so I was running it from it's directory, but
    first have setuo the PATH environment variable to point to that directory.
    The op v0.7.2 has Makefile so one must to install it with 'make' and as root
    with 'make install' but I didn't install it just try to use from it's
    directory. Naturally, I changed the PATH variable again to point to v0.7.2
    directory. So then I get errors.
    But now, I did 'make' and as root 'make install', remove from the PATH the
    previous item that was pointing to the directory of op v0.7.2. As we know, the
    PATH include the /usr/local/bin that is OK for op v0.7.2. So I can now run op
    from any directory, and without any errors. :)

     
  • Stanislavs

    Stanislavs - 2012-03-17

    Buon Giorno Alberto,

    I get the similar errors when tried to program my 16F676 chip:

    DevID: 0x10E0
    16F676 rev0
    Erasing ... completed
    Writing code ...
    Error writing address 28A: written 3FFF, read 292B

    Error writing address 28B: written 3FFF, read 30C8

    Error writing address 28C: written 3FFF, read 00B3

    Error writing address 28D: written 3FFF, read 20AA

    Error writing address 28E: written 3FFF, read 2A33

    Error writing address 28F: written 3FFF, read 0063

    Error writing address 3DB: written 3FFF, read 34A8
    completed, 43 errors
    Writing CONFIG area ... completed, 0 errors
    Writing EEPROM ... completed, 0 errors

    End (4.70 s) 43 errors

    Can I ignore those errors or they might have any unwanted impact on the way my
    circuit works?

    Kind regards,

    Stacey

     
  • Alberto Maccioni

    It depends from your program, usually having instructions in place of empty
    space does no harm.
    But without a log file I cannot say more.

    BR
    Alberto

     
  • Ionut Ghizdavet

    Ionut Ghizdavet - 2013-02-12

    Hi,
    I have built this programmer and I receive similar writing errors when I use it from Fedora 17 Linux with both op and opgui version 0.8.0:

    DevID: 0x0E28
    16F877A rev8
    Configuration word: 0x3F7A
    Erasing ... completed
    Writing code ... 21%
    Error writing address 6AE: written 2E1D, read 2EA5

    Error writing address 6AF: written 3FFF, read 120A

    Error writing address 6B0: written 3FFF, read 118A

    Error writing address 6B1: written 3FFF, read 0BA0

    Error writing address 6B2: written 3FFF, read 2EA3

    Error writing address 6B3: written 3FFF, read 0000
    completed, 45 errors
    Writing CONFIG area ... completed, 0 errors

    End (5.16 s) 45 errors

    I have tested the programmer with Windows 7 and is running OK, so is not a hardware fault.

    Kind regards,
    Ionut

     
  • Alberto Maccioni

    Hello,
    can you send me the log file and the hex you're trying to write?

     
  • Alberto Maccioni

    Sorry, the log is not complete; the part shown seems normal.

     
  • Anonymous

    Anonymous - 2019-10-21

    Hi Alberto,
    sorry I did not check the previous uploaded file. Here you go with a new one. It shows 66 errors close to the end of the writing process.
    https://drive.google.com/open?id=1oWz4fiByZMb1fV6up-DmHg8da6LoQUEp
    As a remark I disabled the EEPROM programming since I'm not using it.

    Thank You

     
  • Alberto Maccioni

    I see a non conformant return packet otwards the end; it desyncs the verification routine, hence the errors.
    I have other questions, let's continue via email.

     

Anonymous
Anonymous

Add attachments
Cancel





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.