Hi Liquid Solder and all,
This is worth a dedicated thread, although it is a combination of these:
viewtopic.php?f=164&t=50266#p205524
Summary:
Recently, I followed instructions on this forum at viewtopic.php?p=206278#p206278 to reconfigure the ASB bootloader, which has made both custom and stock boards unable to be programmed (either by Arduino IDE and SVL, or by JTAG), although a Burn Bootloader appears to be successful and the SVL is present. I now have two bricked boards, please help…
Background:
I have a custom board with an early module I had suspected of not being configured correctly (or a hardware/assembly error on my part). The custom board would not accept a Burn Bootloader or USB upload, but would accept JTAG programming, and then communicate via serial over USB (inc. reset when Serial Monitor started), so I was hesitant to start desoldering things until all things software had been investigated. Reprogramming the ASB/configuration seemed like the last thing to try, and useful practise in the event of bricking. I also have (had) a stock Sparkfun Artemis Blackboard (Uno footprint), unaltered, and working great.
Detailed Testing/Process Notes:
Hardware/Software: Windows 10, Arduino 1.8.9, Core 1.0.6 (Burn Bootloader and compile/upload also tried in 1.0.7), J-Link Mini EDU JTAG programmer from Sparkfun, Ambiq SDK 2.2.0 (and also tried with 2.0.0, yes for both versions I did remember to copy/rename the noted file to keys_info.py, and to use both the .bin and the .txt files from either version for the jlink step).
Following instructions from:
viewtopic.php?p=206278#p206278
Downloaded Ambiq SDK, and copy/renamed the file to keys_info.py as directed
Python adventures
(moved to later - a bunch of extra steps that had to be figured out, might be useful to someone)
Back to actual Artemis stuff:
On an Admin command prompt I entered:
cd C:\Users\XYZ\Desktop\AmbiqSuite-Rel2.2.0_vVeIKav\AmbiqSuite-Rel2.2.0\tools\apollo3_scripts
.\create_info0.py --valid 1 info0 --pl 1 --u0 0x1C200c0 --u1 0xFFFF3031 --u2 0x2 --u3 0x0 --u4 0x0 --u5 0x0 --main 0xC000 --gpio 0x0E --version 0 --wTO 5000
(note backslash for windows) This was checked and double checked against the instructions mentioned above. I did wonder if 0x1C200c0 (115200 baud rate) had the c0 suffix as an error. Tried omitting and it made no difference.
A whole lot of nice messages (see below), and info0.bin was created in the tools\apollo3_scripts directory. Cool.
I copied info0.bin and jlink-prog-info0.txt to C:\Program Files (x86)\SEGGER\JLink_V648b
From Admin Command Prompt at C:\Program Files (x86)\SEGGER\JLink_V648b, entered:
jlink -CommanderScript jlink-prog-info0.txt
Looks like it worked! Many happy messages (see below)
Then opened Arduino IDE, and did a Burn Bootloader to put SVL on. Also many happy messages (see below).
Try to compile and upload basic sketch and… upload failed (see below for output)
Try to upload SerialCallResponseASCII.bin file to 0x10000 via JTAG, apparently successful, but code doesn’t run
Try to upload SerialCallResponseASCII.bin file to 0xC000 via JTAG, apparently successful, but code doesn’t run
(see my JTAG programming how-to here viewtopic.php?f=165&t=50685 )
I repeated this with the stock Sparkfun board and bricked it too, with all the same messages as far as I can tell. Hopefully it’s a minor error somewhere that’s easily fixed. Perhaps a different script is used in production?
Python adventures
First I tried to generate info0.bin with Python 2.7 but that didn’t work, here is the error message in case anyone is desperately searching:
Traceback (most recent call last):
File "C:\Users\XYZ\Desktop\AmbiqSuite-Rel2.2.0_vVeIKav\AmbiqSuite-Rel2.2.0\tools\apollo3_scripts\create_info0.py", line 13, in <module>
from am_defines import *
File "C:\Users\XYZ\Desktop\AmbiqSuite-Rel2.2.0_vVeIKav\AmbiqSuite-Rel2.2.0\tools\apollo3_scripts\am_defines.py", line 524
def am_print(*args, level=AM_PRINT_LEVEL_INFO, **kwargs):
^
SyntaxError: invalid syntax
So I installed the latest Python (3.7.4), with some help from here:
https://learn.sparkfun.com/tutorials/us … n----oh-my
For the record, it ends up at: C:\Users\XYZ\AppData\Local\Programs\Python\Python37-32
Make sure it’s added to your PATH so can be run from anywhere.
Additional modules(?) need to be installed for the Ambiq stuff to work.
From admin command prompt at \Scripts, I entered:
“pip3 install pycryptodome” (download/install followed)
“pip3 install pyserial” (download/install followed)
Left it as “python.exe”, instead of changing to “python3.exe” as suggested in the tutorial. Calling “python” or “python.exe” from the command line runs the later version. The scripts definitely execute on the latest Python (I got paranoid and renamed the .exe in the 2.7 folder to something else)
Messages for creating info0.bin file:
C:\Users\XYZ\Desktop\AmbiqSuite-Rel2.2.0_vVeIKav\AmbiqSuite-Rel2.2.0\tools\apollo3_scripts>.\create_info0.py --valid 1 info0 --pl 1 --u0 0x1C200c0 --u1 0xFFFF3031 --u2 0x2 --u3 0x0 --u4 0x0 --u5 0x0 --main 0xC000 --gpio 0x0E --version 0 --wTO 5000
info0 Signature...
['0x88', '0xad', '0xea', '0x48', '0x37', '0x57', '0x70', '0xc9', '0x58', '0x84', '0x6b', '0xa', '0x74', '0x9d', '0x1a', '0xe4']
Security Word = 0x55fff
Customer Trim = 0xffffffff
Customer Trim2 = 0xffffffff
Override = 0xe
WiredCfg = 0x13884021
UART Config 0x1c200c0 0xffff3031 0x2 0x0 0x0 0x0
Version = 0x0
Main Ptr = 0xc000
SRAM Reservation = 0x0
Permanent Write Protections = 0xffffffff : 0xffffffff
Permanent Copy Protections = 0xffffffff : 0xffffffff
SBL Overridable Write Protections = 0xffffffff : 0xffffffff
SBL Overridable Copy Protections = 0xffffffff : 0xffffffff
Customer Key
['0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde']
chipID 16
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0']
wrap mode 0
KEK
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0']
['0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff']
['0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa', '0xaa']
['0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55', '0x55']
['0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11', '0x11']
['0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5', '0xa5']
['0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66', '0x66']
['0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde']
AuthKey
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0']
['0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0']
['0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff']
['0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff']
['0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55']
['0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55', '0xaa', '0x55']
['0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde']
['0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde', '0xef', '0xbe', '0xad', '0xde']
KREV Mask = 0xffffffff
AREV Mask = 0xffffffff
Writing to file info0.bin
Messages for writing info0.bin to Artemis:
C:\Program Files (x86)\SEGGER\JLink_V648b>jlink -CommanderScript jlink-prog-info0.txt
SEGGER J-Link Commander V6.48b (Compiled Aug 2 2019 10:19:19)
DLL version V6.48b, compiled Aug 2 2019 10:18:25
J-Link Command File read successfully.
Processing script file...
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link EDU Mini V1 compiled Jul 10 2019 16:32:48
Hardware version: V1.00
S/N: 801011102
License(s): FlashBP, GDB
VTref=3.299V
Selecting SWD as current target interface.
Selecting 1000 kHz as target interface speed
Target connection not established yet but required for command.
Device "AMA3B1KK-KBR" selected.
Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
Cortex-M4 identified.
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
ResetTarget() start
JDEC PID 0x000000CF
Ambiq Apollo3 ResetTarget
Bootldr = 0x04000000
Secure Part.
Secure Chip. Bootloader needs to run which will then halt when finish.
CPU halted after reset. TryCount = 0x00000000
ResetTarget() end
Sleep(10)
MSP = 0x10000100
Writing 00000000 -> 10000000
Writing D894E09E -> 10000004
Writing FFFFFFFF -> 10000008
Sleep(50)
10000008 = 00000000
Writing 00000000 -> 10000000
Writing 00000000 -> 10000004
Writing 00000800 -> 10000008
Writing D894E09E -> 1000000C
Writing FFFFFFFF -> 10000010
Downloading file [info0.bin]...
O.K.
Sleep(50)
10000010 = 00000000
Writing 0000001B -> 40000004
Script processing completed.
Messages from Arduino IDE “Burn Bootloader”
Using settings… Board: Sparkfun Artemis Blackboard ATP, Bootloader: Sparkfun Variable Loader, SVL Baud Rate: 921,600, Programmer: Ambiq Secure Bootloader
C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM15 -r 2 -v
Header Size = 0x80
original app_size 0x2708 ( 9992 )
load_address 0xc000 ( 49152 )
app_size 0x2708 ( 9992 )
w0 = 0xcb002788
Security Value 0x10
w2 = 0x10008080
addrWord = 0xc000
versionKeyWord = 0x0
child0/feature = 0xffffffff
child1 = 0xffffffff
crc = 0x6442ad39
Writing to file C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_OTA_blob.bin
testing: C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_OTA_blob.bin
Header Size = 0x60
app_size 0x2788 ( 10120 )
Writing to file C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_Wired_OTA_blob.bin
Image from 0x0 to 0x2788 will be loaded at 0x20000
Connecting over serial port COM15...
Sending Hello.
Received response for Hello
Bootloader connected
Received Status
length = 0x58
version = 0x3
Max Storage = 0x4ffa0
Status = 0x2
State = 0x7
AMInfo =
0x1
0xff2da3ff
0x55fff
0x11
0x49f40003
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
Sending OTA Descriptor = 0xfe000
Sending Update Command.
number of updates needed = 1
Sending block of size 0x27e8 from 0x0 to 0x27e8
Sending Data Packet of length 8180
Sending Data Packet of length 2036
Sending Reset Command.
Tries = 0
Upload complete!
C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM15 -r 2 -v
Header Size = 0x80
original app_size 0x2708 ( 9992 )
load_address 0xc000 ( 49152 )
app_size 0x2708 ( 9992 )
w0 = 0xcb002788
Security Value 0x10
w2 = 0x10008080
addrWord = 0xc000
versionKeyWord = 0x0
child0/feature = 0xffffffff
child1 = 0xffffffff
crc = 0x6442ad39
Writing to file C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_OTA_blob.bin
testing: C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_OTA_blob.bin
Header Size = 0x60
app_size 0x2788 ( 10120 )
Writing to file C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/bootloaders/artemis/artemis_svl_Wired_OTA_blob.bin
Image from 0x0 to 0x2788 will be loaded at 0x20000
Connecting over serial port COM15...
Sending Hello.
Received response for Hello
Bootloader connected
Received Status
length = 0x58
version = 0x3
Max Storage = 0x4ffa0
Status = 0x2
State = 0x7
AMInfo =
0x1
0xff2da3ff
0x55fff
0x11
0x49f40003
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
0xffffffff
Sending OTA Descriptor = 0xfe000
Sending Update Command.
number of updates needed = 1
Sending block of size 0x27e8 from 0x0 to 0x27e8
Sending Data Packet of length 8180
Sending Data Packet of length 2036
Sending Reset Command.
Tries = 0
Upload complete!
Arduino IDE standard upload operation
(using either 115200 or 921600, Programmer: ASB, Board: Artemis ATP, Bootloader: SVL)
(also tried Bootloader: Ambiq Secure Bootloader for luck, even though I’m pretty sure it’s not meant to work that way)
Sketch uses 7752 bytes (0%) of program storage space. Maximum is 960000 bytes.
C:\Users\XYZ\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.6/tools/artemis/windows/artemis_svl.exe COM15 -f C:\Users\STEPHE~1\AppData\Local\Temp\arduino_build_107952/SerialCallResponseASCII.ino.bin -b 115200 -v
Artemis SVL Bootloader
phase: setup
cleared startup blip
phase: bootload
have 7784 bytes to send in 4 frames
error receiving packet
{'len': 0, 'cmd': 0, 'data': 0, 'crc': 1, 'timeout': 1}
unknown error
sending frame #0, length: 0
Upload failed
phase: setup
cleared startup blip
phase: bootload
have 7784 bytes to send in 4 frames
error receiving packet
{'len': 0, 'cmd': 0, 'data': 0, 'crc': 1, 'timeout': 1}
unknown error
sending frame #0, length: 0
Upload failed
phase: setup
cleared startup blip
phase: bootload
have 7784 bytes to send in 4 frames
error receiving packet
{'len': 0, 'cmd': 0, 'data': 0, 'crc': 1, 'timeout': 1}
unknown error
sending frame #0, length: 0
Upload failed