Thank you Tom,
I should have thought to dig into the debug output.
I tried the code as you mentioned, but have the same result:
openocd -f interface/raspberrypi2-native.cfg \
> -c "transport select swd" \
> -f target/at91samdXX.cfg \
> -c "init;reset init;at91samd bootloader 0" \
> -c "flash write_image erase openocd_hex/123456.hex"
Open On-Chip Debugger 0.11.0+dev-00034-g4c00f96fc-dirty (2021-03-14-16:46)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO config: srst = 24
swd
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for at91samd.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0xfffffffe msp: 0xfffffffc
Info : SAMD MCU: SAMD21J18A (256KB Flash, 32KB RAM)
Info : Flash write discontinued at 0x00012f84, next section at 0x00013f00
Error: SAMD: NVM programming error
Error: Failed to erase row containing 00000100
Error: SAMD: failed to erase sector 1 at 0x00000100
Error: failed erasing sectors 0 to 303
auto erase enabled
I have uploaded the debug to pastebin.com/zeeGgXTz
Thanks
From: Tom <[email protected]>
Sent: Wednesday, March 17, 2021 4:34 PM
To: [openocd:tickets] <[email protected]>
Subject: [openocd:tickets] #299 OpenOCD SAMD21 programming from RPI Error
Flash write discontinued / NVM programming error
I suspect the command -c "at91samd bootloader 0" does not work as expected
and flash stays locked.
You have first issue "init" to close up OpenOCD initialization, then prepare
the device for programming by "reset init". The script "program" calls both
"init" and "reset init", but it is too late for "at91samd bootloader 0".
Try this:
openocd -f interface/raspberrypi2-native.cfg \
-c "transport select swd" \
-f target/at91samdXX.cfg \
-c "init;reset init;at91samd bootloader 0" \
-c "flash write_image erase openocd_hex/123456.hex"
and if it works, add "verify_image openocd_hex/123456.hex" and setting
bootloader protection.
If the problem persists, please run with -d and upload full debug log to
some paste bin service.
_____
[tickets:#299] <https://sourceforge.net/p/openocd/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 you indicated interest in
https://sourceforge.net/p/openocd/tickets/299/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/
---
** [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 09:39 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