SparkFun Edge failing on "make bootload" on ubuntu

Hello, I tried to do the exemple make bootload with ubuntu 19.04 and the 18.4 but it is not working, but it work with windows. Here the error I get :

../../../../../tools/apollo3_scripts/create_cust_image_blob.py --bin bin/example1_edge_test.bin --load-address 0xC000 --magic-num 0xCB -o bin/main_nonsecure_ota --version 0x0 Header Size = 0x80 original app_size 0x487c ( 18556 ) load_address 0xc000 ( 49152 ) app_size 0x487c ( 18556 ) w0 = 0xcb0048fc Security Value 0x10 w2 = 0x10008080 addrWord = 0xc000 versionKeyWord = 0x0 child0/feature = 0xffffffff child1 = 0xffffffff crc = 0x6addcfd1 Writing to file bin/main_nonsecure_ota.bin ../../../../../tools/apollo3_scripts/create_cust_wireupdate_blob.py --load-address 0x20000 --bin bin/main_nonsecure_ota.bin -i 6 -o bin/main_nonsecure_wire --options 0x1 Header Size = 0x60 app_size 0x48fc ( 18684 ) Writing to file bin/main_nonsecure_wire.bin Image from 0x0 to 0x48fc will be loaded at 0x20000 ../../../bsp/tools/uart_wired_update_sparkfun.py -b 921600 /dev/ttyUSB0 -r 1 -f bin/main_nonsecure_wire.bin -i 6 Connecting with Corvette over serial port /dev/ttyUSB0... Sending Hello. No response for command 0x00000000 received bytes 48 ['0x86', '0xd5', '0xa4', '0x80', '0x5', '0x83', '0x80', '0xc0', '0x84', '0x82', '0x80', '0x87', '0x80', '0x81', '0x80', '0xff', '0x5c', '0xe9', '0xff', '0x25', '0x80', '0x20', '0x80', '0x83', '0xfc', '0xb2', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff', '0xff'] Traceback (most recent call last): File "../../../bsp/tools/uart_wired_update_sparkfun.py", line 341, in <module> main() File "../../../bsp/tools/uart_wired_update_sparkfun.py", line 42, in main connect_device(ser) File "../../../bsp/tools/uart_wired_update_sparkfun.py", line 61, in connect_device response = send_command(hello, 88, ser) File "../../../bsp/tools/uart_wired_update_sparkfun.py", line 238, in send_command raise NoResponseError main.NoResponseError make: *** [Makefile:197: bootload] Error 1

I tried every solution I find in the forum.

Does someone have an idea ?

Thanks

I tried with the ch340 and also with FT232RL (FTDI Friend). No luck at all. Some people have reported that compiling the ch341 driver manually has given them success, but when I saw the FT232RL also having issues I suspect that python is running differently on windows than linux. I’m not spending any more time.

I think it’s a driver issue, so does someone from sparkfun have a driver that work for linux?

Hello THARMIKA and chipace,

This error has been identified several times and consistently appears on Ubuntu machines. Additionally I am not yet aware of a case where using the patched drivers ([CH341SER by juliagoda on GitHub) has not solved the problem - given that the drivers are successfully installed.

I understand that building and loading a patched serial driver is challenging but the instructions in the README.md file of that repository are quite helpful.

The steps to take are:

  1. clone the repo (git clone https://github.com/juliagoda/CH341SER.git)

  2. navigate to the repository in your shell program

  3. run ‘make’

  4. run ‘sudo make load’

If steps 1-4 are successful then the patched drivers are installed, however there can still be a conflict with the old drivers. Follow these additional steps:

  1. lsmod | grep ch341

  2. If the above returns results it means that another CH341 driver is loaded, and we need to remove it using ‘sudo rmmod ch341’

  3. Finally, you can make sure the new driver (CH34X) is being used by unplugging the USB-serial bridge and then re-plugging it in to USB, then run ‘dmesg’ to see the latest logs

  4. Those logs should say that a CH34X device has been connected.

I hope these instructions will help you both!](GitHub - juliagoda/CH341SER: CH341SER driver with fixed bug)

Well It did not work. But can someone from SparkFun can tell what version of ubuntu did you use to do your test?

Coming from Windows/OSX world here, sorry for my ignorance. I am pretty sure that the individual that got the above steps working was using Arch Linux - I don’t know what kinds of difference that might make.

Have you tried using a different USB-serial bridge? The reason I ask is because so far few, if any, Apollo3 modules have had problems with the bootloader. If only the correct sequence of bytes could be accurately transmitted to the Edge board at 921600 baud then it should work. So in this swiss-cheese model:

  1. Computer generates correct binary

  2. Computer transmits correct binary correctly to Edge

  3. Edge correctly receives correct binary correctly transmitted by computer

I don’t suspect there is any trouble with step 1, and so far I haven’t seen any cases of step 3 failing. However there have been several reports of step 2 failing. If you have a different (non CH340-based) USB-serial bridge laying around try that out. If you don’t have one try this one (which is an FTDI brand converter that may work better):

https://www.sparkfun.com/products/9873

And if all that doesn’t work we can work with you to make sure that your Edge ends up working. For that try to get in touch with one of our Tech Support members (TS.name).

I am trying to build the binary by doing ‘make -f tensorflow/lite/experimental/micro/tools/make/Makefile \TARGET=sparkfun_edge micro_speech_bin’ but I hqve this error :In file included from tensorflow/lite/experimental/micro/examples/micro_speech/sparkfun_edge/audio_provider.cc:21:0:

tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/boards/SparkFun_TensorFlow_Apollo3_BSP/bsp/am_bsp.h:65:10: fatal error: am_devices_led.h: No such file or directory

#include “am_devices_led.h”

^~~~~~~~~~~~~~~~~~

I can’t find the driver am_devices_led.h can someone from Sparkfun can put it in the forum please.

Thanks

And the am_devices_button.h please

Hi, this should be located in the Ambiq SDK under “${AMBIQ_SDK}/devices”. There you will find both “am_devices_led.h” and “am_devices_button.h”. The TensorFlow code automatically downloads the Ambiq SDK as part of the build process. You can also find the link by reading this tutorial: [Ambiq Apollo3 Software Development Kit Setup Guide](Using SparkFun Edge Board with Ambiq Apollo3 SDK - SparkFun Learn)

Well I have still the same error and I can’t use the driver you advice me because I have Ubuntu 19.04 with kernel 5.0 and the driver you advice me it’s for kernel3 or less. Please Sparkfun advice me a new solution or a driver.

here the error I get when I try to do " Run the script to flash your board" with python3 tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py -b ${BAUD_RATE} ${DEVICENAME} -r 1 -f main_nonsecure_wire.bin -i 6:

Connecting with Corvette over serial port /dev/ttyUSB0…

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 338, in

main()

File “tensorflow/lite/experimental/micro/tools/make/downloads/AmbiqSuite-Rel2.0.0/tools/apollo3_scripts/uart_wired_update.py”, line 40, 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 60, 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 237, in send_command

raise NoResponseError

main.NoResponseError

Also my board have a boad rate of 115200. I think that the baud rate of the date transmission is one of the issue. How can I change it?

Can someone from SparkFun can help me ? please…

OK, i took some time and got to root-cause on why ubuntu (linux) has issues with (1) CH340 and (2) pyserial.

(1) The default kernel driver for CH340 can not control xonxoff. This means that CH340 under linux will not get a response to HELLO. I verified this by using my FT232RL and setting “xonxoff=True” in the “uart_wired_update_sparkfun.py” script. If a custom driver is compiled, the default of “xonxoff=False” will be effective.

(2) pyserial does not reset the input and output buffers when a new connection is made. In Windows the OS does this for the port (in the driver?). Under linux we need to do this explicitly in the file:

apollo3_blue_sdk/AmbiqSuite-Rel2.0.0/boards/SparkFun_Edge_BSP-master/bsp/tools/uart_wired_update_sparkfun.py

    with serial.Serial(args.port, args.baud, timeout=12) as ser:
        time.sleep(0.25) # delay for 250ms
        ser.reset_input_buffer()
        ser.reset_output_buffer()
        connect_device(ser)

In summary, to use a CH340 under Ubuntu you need to compile a new driver and update a script. To use a FT232RL under Ubuntu you just need to update the script.

Until CH340 gets an updated driver into the main linux kernel, I would not use that part at all.

Thank you very much for the answer. I did change the script by the one you advice me but I am still getting the same error

I have the same problem.

I see blue blinking lights change - after “sending hello” and some time getting “no response”

I gave up on Mac - and can’t flash on Ubuntu 16

It looks like BSP was tested only on Windows … bummer

Thank You chipace I finally make it work, I also had to change my cable to make it work

After looking at oscilloscope traces of the ch340 under linux (default driver), I don’t think xon/off was the problem. I was seeing more bits in the “HELLO” stream and originally thought that it might be xon, but it could have been parity or word length.