SparkFun Forums 

Where electronics enthusiasts find answers.

#208533
I have worked a while with Sparkfun Edge board. Now I got the latest Edge 2 board.

In the old Edge board there is button 14 which I have to press while flashing. But in the latest Edge 2 this button does not exist. So how is it possible to flash this device? I could not find any guideline to the new board.
#208563
Hi piisku78,

The Edge 2 added an auto-reset circuit so the D14 button is no longer necessary and it was removed. We have the release notes posted here if you would like to view the full list of changes between Edge v1 and v2. You should be able to upload to it with a 3.3V USB-to-Serial converter with no issues. Let us know if you have any problems uploading to it and we would be happy to help.
#208596
Also I have cloned sparkfun Tensorflow https://github.com/sparkfun/tensorflow and I am able to build micro_speech project for edge2 device as target. During the build process this project will download AmbiqSuite-Rel2.2.0 which is then used to flash. Here are all the commands I do, the last step fails: "uart_wired_update.py"

gmake -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge2 micro_speech_bin

python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.2.0/tools/apollo3_scripts/create_cust_image_blob.py --bin tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech.bin --load-address 0xC000 --magic-num 0xCB -o main_nonsecure_ota --version 0x0

python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.2.0/tools/apollo3_scripts/create_cust_wireupdate_blob.py --load-address 0x20000 --bin main_nonsecure_ota.bin -i 6 -o main_nonsecure_wire --options 0x1

python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.2.0/tools/apollo3_scripts/uart_wired_update.py -b 115200 /dev/cu.wchusbserial1420 -r 1 -f main_nonsecure_wire.bin -i 6

Error msg:

tensorflow/lite/experimental/micro/tools/make/downloads/gcc_embedded//lib/gcc/arm-none-eabi/7.3.1/thumb/v7e-m/fpv4-sp/hard/crtbegin.o
arm-none-eabi-objcopy tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech.bin -O binary
Header Size = 0x80
original app_size 0x17bb4 ( 97204 )
load_address 0xc000 ( 49152 )
app_size 0x17bb4 ( 97204 )
w0 = 0xcb017c34
Security Value 0x10
w2 = 0x10008080
addrWord = 0xc000
versionKeyWord = 0x0
child0/feature = 0xffffffff
child1 = 0xffffffff
crc = 0xb3b6c4ab
Writing to file main_nonsecure_ota.bin
Header Size = 0x60
app_size 0x17c34 ( 97332 )
Writing to file main_nonsecure_wire.bin
Image from 0x0 to 0x17c34 will be loaded at 0x20000
Connecting with Corvette over serial port /dev/cu.wchusbserial1420...
Sending Hello.
Received response for Hello
Received Unknown Message
msgType = 0x0
Length = 0x0
['0x3c', '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', '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', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0', '0x0']
!!!Wired Upgrade Unsuccessful!!!....Terminating the script


I tried to change baud rate to 921600 but it did not help.
#208682
I got it working like this:

gmake -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge2 micro_speech_bin

python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.2.0/boards_sfe/common/tools_sfe/ambiq/ambiq_bin2board.py --bin tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech.bin --load-address-blob 0x20000 --magic-num 0xCB -o main_nonsecure_ota --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port /dev/cu.wchusbserial1420 -r 2
#208744
Similar to your post above, I was able to get the Edge 1 working with the micro_speech example, however I'm struggling with doing the same on the Edge 2 on Ubuntu 18.04.3:

I run the commands from the sparkfun repository (rather than the Tensorflow owned one) in the order you recommended:

First command:
  • ~/Documents/sparkfun/tensorflow$ make -f tensorflow/lite/experimental/micro/tools/make/Makefile TARGET=sparkfun_edge2 micro_speech_bin
Resulting in:
  • [...]
    arm-none-eabi-objcopy tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech.bin -O binary
Second command:
  • ~/Documents/sparkfun/tensorflow$ python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.2.0/boards_sfe/common/tools_sfe/ambiq/ambiq_bin2board.py --bin tensorflow/lite/experimental/micro/tools/make/gen/sparkfun_edge2_cortex-m4/bin/micro_speech.bin --load-address-blob 0x20000 --magic-num 0xCB -o main_nonsecure_ota --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port /dev/ttyUSB0 -r 2 -v
Resulting in:
  • Header Size = 0x80
    original app_size 0x1926c ( 103020 )
    load_address 0xc000 ( 49152 )
    app_size 0x1926c ( 103020 )
    w0 = 0xcb0192ec
    Security Value 0x10
    w2 = 0x10008080
    addrWord = 0xc000
    versionKeyWord = 0x0
    child0/feature = 0xffffffff
    child1 = 0xffffffff
    crc = 0xe258736a
    Writing to file main_nonsecure_ota_OTA_blob.bin
    testing: main_nonsecure_ota_OTA_blob.bin
    Header Size = 0x60
    app_size 0x192ec ( 103148 )
    Writing to file main_nonsecure_ota_Wired_OTA_blob.bin
    Image from 0x0 to 0x192ec will be loaded at 0x20000
    Connecting over serial port /dev/ttyUSB0...
    Sending Hello.
    Received response for Hello
    Received Unknown Message
    msgType = 0xa0a
    Length = 0xa0a
    ['0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0x48', '0x65', '0x6c', '0x6c', '0x6f', '0x20', '0x57', '0x6f', '0x72', '0x6c', '0x64', '0x21', '0xa', '0xa', '0x56', '0x65', '0x6e', '0x64', '0x6f', '0x72', '0x20', '0x4e', '0x61', '0x6d', '0x65', '0x3a', '0x20', '0x41', '0x4d', '0x42', '0x51', '0xa', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65', '0x20', '0x74', '0x79', '0x70', '0x65', '0x3a', '0x20', '0x41', '0x70', '0x6f', '0x6c', '0x6c', '0x6f', '0x33', '0xa', '0x51', '0x75', '0x61', '0x6c', '0x69', '0x66', '0x69', '0x65', '0x64', '0x3a', '0x20', '0x4e', '0x6f', '0xa', '0x44', '0x65', '0x76']
    Fail
    Sending Hello.
    Received response for Hello
    Received Unknown Message
    msgType = 0xa0a
    Length = 0xa0a
    ['0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0x48', '0x65', '0x6c', '0x6c', '0x6f', '0x20', '0x57', '0x6f', '0x72', '0x6c', '0x64', '0x21', '0xa', '0xa', '0x56', '0x65', '0x6e', '0x64', '0x6f', '0x72', '0x20', '0x4e', '0x61', '0x6d', '0x65', '0x3a', '0x20', '0x41', '0x4d', '0x42', '0x51', '0xa', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65', '0x20', '0x74', '0x79', '0x70', '0x65', '0x3a', '0x20', '0x41', '0x70', '0x6f', '0x6c', '0x6c', '0x6f', '0x33', '0xa', '0x51', '0x75', '0x61', '0x6c', '0x69', '0x66', '0x69', '0x65', '0x64', '0x3a', '0x20', '0x4e', '0x6f', '0xa', '0x44', '0x65', '0x76']
    Fail
    Sending Hello.
    Received response for Hello
    Received Unknown Message
    msgType = 0xa0a
    Length = 0xa0a
    ['0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0xa', '0x48', '0x65', '0x6c', '0x6c', '0x6f', '0x20', '0x57', '0x6f', '0x72', '0x6c', '0x64', '0x21', '0xa', '0xa', '0x56', '0x65', '0x6e', '0x64', '0x6f', '0x72', '0x20', '0x4e', '0x61', '0x6d', '0x65', '0x3a', '0x20', '0x41', '0x4d', '0x42', '0x51', '0xa', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65', '0x20', '0x74', '0x79', '0x70', '0x65', '0x3a', '0x20', '0x41', '0x70', '0x6f', '0x6c', '0x6c', '0x6f', '0x33', '0xa', '0x51', '0x75', '0x61', '0x6c', '0x69', '0x66', '0x69', '0x65', '0x64', '0x3a', '0x20', '0x4e', '0x6f', '0xa', '0x44', '0x65', '0x76']
    Fail
    Tries = 3
    Upload failed
I've attempted to do the same by building each main_nonsecure_ota.bin and main_nonsecure_wire.bin and then attempting to flash with uart_wired_update.py, but the result was basically the same (though less verbose). I also increased the number of loadTries and connection_timeout, in hopes that one of those would suffice.

Were there any other areas of code that you changed between your initial issue on the 13th and the resolution on the 16?
#208845
Hi gemoore, I just looked over your process and couldn't spot any glaring errors. Can you verify that the bootlaoder by trying to upload a simpler project? I'd recommend using either Arduino (change bootloader option to 'Ambiq Secure Bootloader') or using our mirror of the AmbiqSuiteSDK with the 'make bootload_asb' option (being on unix you will at least need to override the default com port with 'COM_PORT=/dev/***')

Those tools rely on the same 'ambiq_bin2board.py' script so if they work then so should the process yout outlined above. I wish I could offer better advice here.

Last ditch effort would be to re-program the ASB bootloader. I would add that ability to our SDK mirror if you need it. (But you will need to use a programmer/debugger such as the Segger J-Link EDU)