Artemis SVL Bootloader "Unknown Error"

I am trying to use the Arduino environment to build Artemis Blackboard test programs. Things were working earlier this weekend when I was using the old 1.0.2 Apollo3 board package, but as of this morning I made the apparently fatal mistake to update to the 1.0.8 board package. Now when I try to upload a sketch I get the following error:

Artemis SVL Bootloader

phase:	setup
	cleared startup blip

phase:	bootload
	have 9860 bytes to send in 5 frames

	error receiving packet
{'len': 128, 'cmd': 128, 'data': b'\x80\x80\x00\x80\x80\x80\x80\x80\x00\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x00\x80\x80\x80\x80\x00\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x00\x80\x80\x80\x80\x80\x00\x80\x80\x00\x80\x00\x80\x80\x80\x00\x80\x80\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x80', 'crc': 51537, 'timeout': 0}


unknown error
	sending frame #0, length: 0

	Upload failed

phase:	setup
	cleared startup blip

phase:	bootload
	have 9860 bytes to send in 5 frames

	error receiving packet
{'len': 128, 'cmd': 128, 'data': b'\x80\x80\x00\x80\x80\x80\x80\x80\x00\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x00\x80\x80\x80\x80\x00\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x00\x80\x80\x80\x80\x80\x00\x80\x80\x00\x80\x00\x80\x80\x80\x00\x80\x80\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x80', 'crc': 51537, 'timeout': 0}


unknown error
	sending frame #0, length: 0

	Upload failed

phase:	setup
	cleared startup blip

phase:	bootload
	have 9860 bytes to send in 5 frames

	error receiving packet
{'len': 128, 'cmd': 128, 'data': b'\x80\x80\x00\x80\x80\x80\x80\x80\x00\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x00\x80\x80\x80\x80\x00\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x80\x00\x80\x80\x80\x80\x00\x00\x80\x80\x80\x00\x80\x00\x00\x00\x80\x80\x80\x80\x80\x00\x80\x80\x00\x80\x00\x80\x80\x80\x00\x80\x80\x00\x80\x80\x80\x00\x80\x00\x00\x80\x00\x80\x80\x80\x80\x00\x80\x00\x80\x00\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x80', 'crc': 51537, 'timeout': 0}


unknown error
	sending frame #0, length: 0

	Upload failed

I tried updating my Arduino from 1.8.9 to 1.8.10, but that didn’t help. I tried uninstalling and reinstalling the Sparkfun Apollo3 board package, and that didn’t help. I tried downgrading back to 1.0.2 and that didn’t help.

Does anyone know what might have happened? Is my bootloader corrupted?

In case there was a bootloader problem, I tried reloading the bootloader itself according to this forum article: viewtopic.php?f=163&t=50480

The reload process fails like this:

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\robin\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/bootloaders/artemis/artemis_svl_OTA_blob.bin
testing: C:\Users\robin\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/bootloaders/artemis/artemis_svl_OTA_blob.bin
Header Size =  0x60
app_size  0x2788 ( 10120 )
Writing to file  C:\Users\robin\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/bootloaders/artemis/artemis_svl_Wired_OTA_blob.bin
Image from  0x0  to  0x2788  will be loaded at 0x20000
Connecting over serial port COM14...
Sending Hello.
Received response for Hello
Received Unknown Message
msgType = 0x646f
Length = 0x2065
['0x56', '0x53', '0x2d', '0x43', '0x6f', '0x64', '0x65', '0x20', '0x53', '0x6c', '0x65', '0x65', '0x70', '0x20', '0x4d', '0x6f', '0x64', '0x65', '0x20', '0x54', '0x65', '0x73', '0x74', '0x69', '0x6e', '0x67', '0x20', '0x53', '0x65', '0x70', '0x20', '0x31', '0x36', '0x20', '0x32', '0x30', '0x31', '0x39', '0x20', '0x31', '0x30', '0x3a', '0x30', '0x31', '0x3a', '0x30', '0x32', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43', '0x54', '0x52', '0x4c', '0x2d', '0x3e', '0x44', '0x45', '0x56', '0x50', '0x57', '0x52', '0x45', '0x4e', '0x3a', '0x20', '0x24', '0x34', '0x30', '0x30', '0x32', '0x31', '0x30', '0x30', '0x38', '0x3a', '0x20', '0x24', '0x38', '0x30', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43']
Fail
Sending Hello.
Received response for Hello
Received Unknown Message
msgType = 0x646f
Length = 0x2065
['0x56', '0x53', '0x2d', '0x43', '0x6f', '0x64', '0x65', '0x20', '0x53', '0x6c', '0x65', '0x65', '0x70', '0x20', '0x4d', '0x6f', '0x64', '0x65', '0x20', '0x54', '0x65', '0x73', '0x74', '0x69', '0x6e', '0x67', '0x20', '0x53', '0x65', '0x70', '0x20', '0x31', '0x36', '0x20', '0x32', '0x30', '0x31', '0x39', '0x20', '0x31', '0x30', '0x3a', '0x30', '0x31', '0x3a', '0x30', '0x32', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43', '0x54', '0x52', '0x4c', '0x2d', '0x3e', '0x44', '0x45', '0x56', '0x50', '0x57', '0x52', '0x45', '0x4e', '0x3a', '0x20', '0x24', '0x34', '0x30', '0x30', '0x32', '0x31', '0x30', '0x30', '0x38', '0x3a', '0x20', '0x24', '0x38', '0x30', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43']
Fail
Sending Hello.
Received response for Hello
Received Unknown Message
msgType = 0x646f
Length = 0x2065
['0x56', '0x53', '0x2d', '0x43', '0x6f', '0x64', '0x65', '0x20', '0x53', '0x6c', '0x65', '0x65', '0x70', '0x20', '0x4d', '0x6f', '0x64', '0x65', '0x20', '0x54', '0x65', '0x73', '0x74', '0x69', '0x6e', '0x67', '0x20', '0x53', '0x65', '0x70', '0x20', '0x31', '0x36', '0x20', '0x32', '0x30', '0x31', '0x39', '0x20', '0x31', '0x30', '0x3a', '0x30', '0x31', '0x3a', '0x30', '0x32', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43', '0x54', '0x52', '0x4c', '0x2d', '0x3e', '0x44', '0x45', '0x56', '0x50', '0x57', '0x52', '0x45', '0x4e', '0x3a', '0x20', '0x24', '0x34', '0x30', '0x30', '0x32', '0x31', '0x30', '0x30', '0x38', '0x3a', '0x20', '0x24', '0x38', '0x30', '0xd', '0xa', '0x50', '0x57', '0x52', '0x43']
Fail
Tries = 3
Upload failed

The interesting part is that when I decoded the response that system believes it is getting from the ‘hello’ request to the bootloader, it is actually my own initialization text being printed from the last Arduino program that was flashed into the device:

void setup()
{
  // We will use the Serial object while we get set up, then shut it down during our deep sleep test
  Serial.begin(115200);
  delay(1000);
  Serial.print("VS Code Sleep Mode Testing ");
  Serial.println(__DATE__ " " __TIME__);
  ...

So it would appear that my blackboard either never actually went into booloader mode, or somehow got out of bootloader mode and started running the most recently programmed Arduino app.

Hi robin,

I hope we can work this out.

Does anyone know what might have happened? Is my bootloader corrupted?

There were big changes to the bootloader between v1.0.2 and v1.0.8

v1.0.2 - used the original SVL which had some platform-dependent timing issues.

[v1.0.4 - First implementation of the SVL V3 bootloader. V3 was designed to be atomic and to use proper 16-bit CRC message checking

All the while the Ambiq Secure Bootloader should have been left intact with the original settings. (For the BlackBoard Artemis, as well as all boards except the original TF conference version of the Edge board, this is set to 115200 baud) That is the tool that gets used when trying to update the bootloader. Unfortunately that tool is susceptible to failure when there is a lot of UART traffic. However from the code snippet you showed it doesn’t seem to be enough UART traffic to cause a problem, especially after [this fix.

From your debug output I can’t tell what baud rate the ASB was called with when you tried to update the bootloader… Can you try again and post the call? It should look something like this:

C:\Users\owen.lyke\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\you\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/bootloaders/artemis/artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\owen.lyke\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.8/bootloaders/artemis/artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM4 -r 2 -v 

By no means should the fallback bootloader (ASB) be corrupted or unrecoverable. I have yet to see a case like that myself.

The key is to make sure that the BlackBoard is properly entering bootload mode. This is done by making sure the ‘Boot’ pin of the Artemis module is HIGH when the Apollo3 leaves reset. This is usually taken care of by an auto-bootload circuit, but if that is failing you may have to do it manually (i.e. solder a button between 3.3V and the BOOT line, and hold it while you reset the board)

https://cdn.sparkfun.com/assets/4/5/a/3 … ematic.pdf

I’m sorry that you’re having this trouble. I’m not sure exactly what the cause is but I will do my best to help you work through it](Add input buffer reset just before device connection · sparkfun/Arduino_Apollo3@7f6773d · GitHub)](Release v1.0.4 · sparkfun/Arduino_Apollo3 · GitHub)

OK, I got it solved. The bootloader did get corrupted somehow. I swear, I was just doing Arduino uploads!

If it happens to anyone else, here is what I did to fix it on my Blackboard:

  • - In the Arduino IDE, select Tools/Programmer and choose “Ambiq Secure Bootloader”
  • - Stick a pullup resistor into the 3.3V header (I used 20K but the value is not critical - it’s just the first one I could find on my desk)
  • - use a jumper clip to connect the other end of the resistor to the tip of an exacto blade
  • - touch the tip of the exacto blade to the end of R9 as shown in the detail photo (below)
  • - Important: you need to hold the exacto tip on the correct end of R9 continuously during the next two steps:
  • - …press and release the reset button
  • - ...In the Arduino IDE, select the Tools/"Burn Bootloader"
  • The new Sparkfun bootloader gets flashed in a few seconds, and you can finally quit probing R9 with the exacto! Making sure that the Arduino IDE Tools/Bootloader selection was set to use the Sparkfun Variable Bootloader, I could upload sketches again.

    Whew.

    Hello Robin,

    I tried the procedure you described several times for my Redboard Artemis but I always get this error message:

    java.lang.NullPointerException

    at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:329)

    at processing.app.Editor.lambda$handleBurnBootloader$61(Editor.java:2366)

    at java.lang.Thread.run(Thread.java:748)

    Fehler beim Brennen des Bootloaders.

    Any ideas? Or is there other ways to burn the bootloader?

    The reason I want to burn the bootloader is because I get this error message every time I try to upload a sketch:

    Artemis SVL Bootloader

    Script version 1.7

    Phase: Setup

    Cleared startup blip

    Failed to enter bootload phase

    Phase: Setup

    Cleared startup blip

    Failed to enter bootload phase

    Phase: Setup

    Cleared startup blip

    Failed to enter bootload phase

    Target failed to enter bootload mode. Verify the right COM port is selected and that your board has the SVL bootloader.

    wjulian@t-online.de:
    Hello Robin,

    I tried the procedure you described several times for my Redboard Artemis but I always get this error message:

    java.lang.NullPointerException

    at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:329)

    at processing.app.Editor.lambda$handleBurnBootloader$61(Editor.java:2366)

    at java.lang.Thread.run(Thread.java:748)

    Fehler beim Brennen des Bootloaders.

    Any ideas? Or is there other ways to burn the bootloader?

    EDIT: This is the actual error message when having chosen Ambiq Secure Bootloader under Programmer (instead of under Bootloader) for burning:

    C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM3 -r 2 -v 
    Header Size =  0x80
    original app_size  0x3290 ( 12944 )
    load_address  0xc000 ( 49152 )
    app_size  0x3290 ( 12944 )
    w0 = 0xcb003310
    Security Value  0x10
    w2 =  0x10008080
    addrWord =  0xc000
    versionKeyWord =  0x0
    child0/feature =  0xffffffff
    child1 =  0xffffffff
    crc =   0x826a7429
    Writing to file  C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_OTA_blob.bin
    testing: C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_OTA_blob.bin
    Header Size =  0x60
    app_size  0x3310 ( 13072 )
    Writing to file  C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_Wired_OTA_blob.bin
    Image from  0x0  to  0x3310  will be loaded at 0x20000
    Connecting over serial port COM3...
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Tries = 3
    Upload failed
    C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/tools/ambiq/windows/ambiq_bin2board.exe --bin C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl.bin --load-address-blob 0x20000 --magic-num 0xCB -o C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port COM3 -r 2 -v 
    Header Size =  0x80
    original app_size  0x3290 ( 12944 )
    load_address  0xc000 ( 49152 )
    app_size  0x3290 ( 12944 )
    w0 = 0xcb003310
    Security Value  0x10
    w2 =  0x10008080
    addrWord =  0xc000
    versionKeyWord =  0x0
    child0/feature =  0xffffffff
    child1 =  0xffffffff
    crc =   0x826a7429
    Writing to file  C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_OTA_blob.bin
    testing: C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_OTA_blob.bin
    Header Size =  0x60
    app_size  0x3310 ( 13072 )
    Writing to file  C:\Users\LAB\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.0.30/bootloaders/artemis/artemis_svl_Wired_OTA_blob.bin
    Image from  0x0  to  0x3310  will be loaded at 0x20000
    Connecting over serial port COM3...
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Sending Hello.
    No response for command 0x00000000
    Failed to respond
    Fail
    Tries = 3
    Upload failed
    

    Ahh, okay we are making some progress here.

    Have you been able to upload using the ASB before? What host platform are you on (windows, linux, mac?) This error is one i usually see from Linux computers trying to upload to an Edge board (which uses a 921600 baud rate instead of the more stable 115200 baud rate for the ASB)

    I will not respond to this thread any more - we need to keep the converstion in just one place, i.e. viewtopic.php?f=169&t=52896