---

** [tickets:#299] OpenOCD SAMD21 programming from RPI Error Flash write 
discontinued / NVM programming error**

**Status:** new
**Milestone:** 0.10.0
**Created:** Wed Mar 17, 2021 04:24 PM UTC by Gregory Cronin
**Last Updated:** Wed Mar 17, 2021 04:24 PM UTC
**Owner:** nobody


I am trying to use OpenOCD + RPi to program an ATSAMD21J18A via SWD. I have a 
connection, can see flash info but programming fails with a Flash write 
discontinued / NVM programming error.

I have a feeling it has something to do with Erase or reset. 

**This is the error point:**

                ** Programming Started **
                Flash write discontinued at 0x00012f84, next section at 
0x00013f00
                SAMD: NVM programming error
                Failed to erase row containing 00000200
                SAMD: failed to erase sector 2 at 0x00000200
                failed erasing sectors 0 to 303
                embedded:startup.tcl:530: Error: ** Programming Failed **
                in procedure 'program' 
                in procedure 'program_error' called at file 
"embedded:startup.tcl", line 595
                at file "embedded:startup.tcl", line 530

My code:

                 sudo openocd -f interface/raspberrypi2-native.cfg \
                 -c "transport select swd" \
                 -c "set WORKAREASIZE 0" \
                 -c "set CHIPNAME at91samd21j18" \
                 -c "adapter speed 400" \
                 -c "adapter srst delay 200" \
                 -f target/at91samdXX.cfg \
                 -c "at91samd bootloader 0" \
                 -c "program openocd_hex/123456.hex verify"\
                 -c "at91samd bootloader 8192" 

raspberrypi2-native.cfg file

                adapter driver bcm2835gpio
                bcm2835gpio_peripheral_base 0x3F000000

                # Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
                # These depend on system clock, calibrated for stock 700MHz
                # bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET
                bcm2835gpio_speed_coeffs 146203 36

                # Each of the JTAG lines need a gpio number set: tck tms tdi tdo
                # Header pin numbers: 23 22 19 21
                bcm2835gpio_jtag_nums 11 25 10 9

                # Each of the SWD lines need a gpio number set: swclk swdio
                # Header pin numbers: SWCLK:23  SWDIO:22
                bcm2835gpio_swd_nums 11 25

                # If you define trst or srst, use appropriate reset_config
                # Header pin numbers: TRST - 26, SRST - 18

                # bcm2835gpio_trst_num 7
                # reset_config trst_only

                bcm2835gpio_srst_num 24
                # reset_config srst_only srst_push_pull

                # or if you have both connected,
                # reset_config trst_and_srst srst_push_pull

I've used telnet localhost 4444 to feed line by line, but I get the same error 
when I try to program. Tried changing adapter speed/delay, tried flash 
write_image, flash info 0 shows no protection.
How critical is the reset pin connection for this set-up.  I may have an issue 
there.


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to