Sparkfun Edge bootloader problems

5

Finally the sparkfun board edge boards arrived today ;-)

Following this well written guide : https://codelabs.developers.google.com/codelabs/sparkfun-tensorflow/#3 i am stuck with the following NoResponseError when trying to flash the code on the Ambiq, with the uart_wired_update.pyscript, that comes with tensorflow examples

opprud$ python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py -b 115200 /dev/cu.usbserial-1430 -r 1 -f main_nonsecure_wire.bin -i 6

MOJ/Connecting with Corvette over serial port /dev/cu.usbserial-1430...

Sending Hello.

No response for command 0x00000000

Traceback (most recent call last):

  File "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py", line 336, in <module>

    main()

  File "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py", line 38, in main

    connect_device(ser)

  File "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py", line 58, in connect_device

    response = send_command(hello, 88, ser)

  File "tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py", line 235, in send_command

    raise NoResponseError

__main__.NoResponseError

My setup:

  • Macbook pro, tried both old 15" & new 13"
  • Sparkfun serial basic breakout, USBC version (default jumped to 3v3)
  • FTDI 3v3 serial cable

I have tried

  • two different edge boards, with the correct Key14 & reset combo + misc variants and timing
  • legacy USB on old Macbook
  • new Macbook w USB C
  • FTDI 3v3 serial cable as alternative to sparkfun serial board
  • Running an alternative uart_boot_host.py script in tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/bootloader_scripts/uart_boot_host.py, also no response

I can measure, with a scope, the handshake bytes '0x14', '0x55', '0x9d', '0xe9' '0x0', '0x0', '0x8', '0x0' being transmitted initially at 115200 on the TXO pin on the programming header - but the ambiq is not replying anything.

btw. The onboard demo is running, blue led flashing, an some "yes's" are being recognized.

Any inputs welcome.

Does anyone know the protocol for the corvette bootloader ?

Are there any CPU revision changes from the first batch of boards, or possibly any lock bits programmed accidentally from sparkfun ?

rgds from an eager TF lite user ;-)

bootloader
tensorflow-lite
asked on Stack Overflow Apr 1, 2019 by opprud

5 Answers

2

I tried measuring the actual baudrate with a scope on rx/tx pins, and saw that the bit timing using default OSX serial driver is rather imprecise, app 10% off, causing faulty readings, and ultimately missing bytes, when the baudrate are high.

After updating to the ch340 serial driver, timing improved, and the bit timings were correct. At 921600bps, a single byte 8N1 is supposed to be10.9uS

Driver install https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver

answered on Stack Overflow Apr 4, 2019 by opprud
2

This is what worked for me: (source: github.com/sparkfun/SparkFun_Edge_BSP/issues/3, the SparkFunEdge tutorial and my teammates!). I am running this on a Linux machine (x86_64; Run $ uname -a) and my SparkfunEdge DEVICENAME=/dev/ttyUSB0

The tutorial does warn you about this problem at Step 4:

Note: Some users have reported issues with their operating system's default drivers for programmer, so we recommend installing the driver before you continue.

Click on the driver link and follow the instructions under "Other Linux distributions" as follows:

  1. Install the correct version of the ch34 library. $ git clone https://github.com/juliagoda/CH341SER.git $ cd CH341SER/ $ make $ sudo insmod ch34x.ko $ sudo rmmod ch341

  2. To verify that the correct driver is being used, run: $ dmesg .. [889247.585301] usb 1-7: ch341-uart converter now attached to ttyUSB0 [955698.718839] usbcore: registered new interface driver ch34x [955698.718848] usbserial: USB Serial support registered for ch34x [955759.196437] usbserial: USB Serial deregistering driver ch341-uart [955759.196576] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0 [955759.196601] usbcore: deregistering interface driver ch341 [955759.196643] ch341 1-7:1.0: device disconnected

    Now unplug the USB-C from the SparkfunEdge Board, and plug it back again $ dmesg .... [955876.176950] ch34x 1-7:1.0: ch34x converter detected [955876.177320] usb 1-7: ch34x converter now attached to ttyUSB0

answered on Stack Overflow Aug 9, 2019 by Meghna Natraj • edited Aug 9, 2019 by Meghna Natraj
1

glad to hear that you're so excited about the board. I have a hunch that this will be an easy fix.

The Edge boards handed out at the conference have a bootloader set for 115200 baud, however the Edge boards that have come out in the second batch are upgraded to flash at 921600 baud, greatly reducing flashing time. Try changing the baud rate in your serial upload script.

You can also set up the Ambiq Software Development Kit to write your own applications for the Apollo3 microcontroller. Check out the tutorial here: Using the Edge Board with Ambiq SDK

answered on Stack Overflow Apr 3, 2019 by oclyke
0

Since I can't comment on your post (not enough reputation.... thanks SE) I'll be responding here.

If the baud rate accuracy is a problem I'm slightly unsure that that would be caused by the OS, but rather I'd think it is a problem with the USB-serial converter chip. I've been using the CH340G whereas on the USB-C version there is the CH340C IC. The difference between the two is that the "C" version includes an internal oscillator to provide the frequency reference. It is possible that that one is less accurate...? I'll try it out over here (but on windows) and let you know.

If this is a persisting problem would you mind making a post on the SparkFun forums? That way our tech support can get linked in (they are the people who could get you replacement hardware in case it is defective, also). Here's a forum for the Edge: SparkFun Edge Forums

If the problem is coming from the OS then the only fix that we can do with the Edge is to reduce the bootloader speed. We're working on a short tutorial about how to do that, but it would require having a programmer/debugger for Cortex-M processors. The Ambiq Apollo3 Evaluation Board has a built-in SEGGER J-Link which is what we used to program the boards.

answered on Stack Overflow Apr 4, 2019 by oclyke
0

On MacOS Mojave, Installing/Reinstalling CH340 works for me: https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers#mac-osx

Before doing install, check that you actually see the sparkfun edge device with: ls -l /dev/cu* If driver is correctly installed, you should detect: /dev/cu.wchusbserial1420

I got similar issue whereas I only had /dev/cu.usbserial-1420 and thought that was expected device to access, whereas it is /dev/cu.wchusbserial1420 which was only detected after installed ch340 driver. Then flashing device works successfully for me.

answered on Stack Overflow Sep 15, 2020 by cl3ment

User contributions licensed under CC BY-SA 3.0