Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sparkfun Edge bootloader problems

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 ;-)

like image 770
opprud Avatar asked Apr 01 '19 20:04

opprud


2 Answers

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

like image 88
opprud Avatar answered Nov 03 '22 23:11

opprud


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

like image 44
Meghna Natraj Avatar answered Nov 03 '22 22:11

Meghna Natraj