Update the Wi-Fi Core - Is this REQUIRED!

New User
I am very excited about mu new WIO Terminal. Great product…

On the Networking Overview it says that I need to (In BIG Scary RED) “update the Wi-Fi Core before usage!”

So I went forward with this.

Some notes of the process that I would like answers on?

  1. Is this still necessary. How do I know if I still MUST do this? Is there a something I can look at that says 'Relax you don’t have to do this"

  2. For beginners this process is VERY complex and scary. I am not a beginner and I still found the process stressful especially on Linux. Imagine how scary for an inexperienced user.

  3. I completed the process and got an error message from the flash stage!

Traceback (most recent call last):
File “flash_tools.py”, line 150, in
File “click/core.py”, line 829, in call
File “click/core.py”, line 782, in main
File “click/core.py”, line 1259, in invoke
File “click/core.py”, line 1066, in invoke
File “click/core.py”, line 610, in invoke
File “flash_tools.py”, line 139, in flash
File “flash_tools.py”, line 79, in copy_img
File “shutil.py”, line 241, in copyfile
shutil.SameFileError: ‘km0_boot_all.bin’ and ‘/home/stuart/git/km0_boot_all.bin’ are the same file

My assumption (based on years of experience) is that the version of the bin file is the same as the one I was flashing. However that is NOT clear from the message and if this is true then I just wasted 20 minutes of my time simply to find out that I did not need to go through this process.

Please confirm that my assumptions are correct.

Could you also please review the Wiki to reflect the requirements of this process.

Regards

Stuart

Hi @stuartdd

Sorry for making you this concern, this is needed as the initial factory firmware inside the Wireless core may not up to date and hence the reason we always recommend to flash the latest firmware from wiki.

For beginners, it might be easier to use the Windows .exe uploading tools for flashing.

For you error message, can you provide a screenshot as from this error message i cannot see what your inputs are. Thanks

Best Regards,
Anson

Hi. Sorry this took so long. I have re-visited the flash process and I am now getting an error.

Fresh download in to an empty directory.
/home/linux_user/git/flash

Note I extracted the files individually. The ‘.’ in the path of the .tar file causes the files for be extracted in to the parent path of the selected directory. Very confusing.

WIO Terminal is connected on /dev/ttyACM0

linux_user@linux_user-Alienware-17-R3:~/git/flash$ ls
amebad_flash_tool amebad_image_tool imgtool_flashloader_amebad.bin
linux_user@linux_user-Alienware-17-R3:~/git/flash$ ./amebad_flash_tool erase --port /dev/ttyACM0
Erasing…
All images are sent successfully!
Image tool closed!
done!
linux_user@linux_user-Alienware-17-R3:~/git/flash$

linux_user@linux_user-Alienware-17-R3:~/git/flash$ ls
amebad_flash_tool amebad_image_tool imgtool_flashloader_amebad.bin km0_boot_all.bin km0_km4_image2.bin km4_boot_all.bin
linux_user@linux_user-Alienware-17-R3:~/git/flash$ pwd
/home/linux_user/git/flash
linux_user@linux_user-Alienware-17-R3:~/git/flash$ ./amebad_flash_tool flash -d /home/linux_user/git/flash --port /dev/ttyACM0
copy img to workspace…
Traceback (most recent call last):
File “flash_tools.py”, line 150, in
File “click/core.py”, line 829, in call
File “click/core.py”, line 782, in main
File “click/core.py”, line 1259, in invoke
File “click/core.py”, line 1066, in invoke
File “click/core.py”, line 610, in invokeI nptice now that the files mentioned are the same file…
File “flash_tools.py”, line 139, in flash
File “flash_tools.py”, line 79, in copy_img
File “shutil.py”, line 241, in copRegardsyfile
shutil.SameFileError: ‘/home/linux_user/git/flash/km0_boot_all.bin’ and ‘/home/linux_user/git/flash/km0_boot_all.bin’ are the same file
[5323] Failed to execute script flash_tools

Regards

Stuartl

Solved!

I flashed from the parent directory and it worked.

So much for the years of experience!

I still think it is confusing to have the ‘.’ path in the root of the .tar file as exporting puts everything in the parent dir.

Could you update the WIKI to state that you should not do the flash in the same dir as the -d option defines.

linux_user@linux_user-Alienware-17-R3:~/git$ ./flash/amebad_flash_tool flash -d /home/linux_user/git/flash --port /dev/ttyACM0
copy img to workspace…
Flashing…
All images are sent successfully!
Image tool closed!
done!
linux_user@linux_user-Alienware-17-R3:

Thank for the response

Stuart

UPDATED: NOT SOLVED - Please refer to my next post.

I am sorry to say that I think the Linux process for uploading this RTL8720 firmware is broken.

I have been looking at similar posts related to:

Cannot initialize ESP-AT Lib

WIO Terminal: Networking not working

And some others and it seems to boil down to the firmware update not working. Apparently the Windows process works!

I have run this process 3 times and seen the result:

stuart@stuart-Alienware-17-R3:~/Arduino/temp/bin$ ./amebad_flash_tool flash -d /home/stuart/Arduino/temp/flash --port /dev/ttyACM0
copy img to workspace…
Flashing…
All images are sent successfully!
Image tool closed!
done!

However I cannot get the WIFI to connect. I uploaded the Scanning Wi-Fi Network Example Code, after my 1st upgrade and if fails as follows (I have removed blank lines):

Cannot initialize ESP-AT Lib!
[E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
[E][WiFiGeneric.cpp:477] mode(): Could not set mode! -1
[E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
Setup done
scan start

I ran the erase and flash again from scratch as recommended in the forum but this did NOT fix the issue.

I ran the erase and flash again but still did NOT fix the issue.

Please can someone go through the Linux command line process and fix the issues, or at least amend the WIKI to get this working. This is really frustrating.

Not everybody has accces to a Windows PC. I will have to wait until I have access to one…

Regards

Stuart

@ansonhe97 Please help check it

It seems that the core is not updated, did you use the erase command first then flash?

Yes I went through the whole process 3 times.

Download.
Extract.
Erase.
Flash.

All stages reported OK Done.

Regards

Hi @stuartdd

Have tested the Linux tool again this morning, and it’s working properly. Please can you check you did the same steps as this: https://drive.google.com/file/d/1DaMge77WuXwm_Xj02i81Ic08tR4sCDlK/view?usp=sharing

Again, sorry for the issue caused.

Best Regards,

Anson

Hi.

I used the linux GUI to unpack the the tar.gz file. I extracted the contents in to a dir called ‘flash’.

The ‘flash’ folder then contains:

amebad_flash_tool amebad_image_tool imgtool_flashloader_amebad.bin.

I then cd in to that directory and run:
./amebad_flash_tool erase --port /dev/ttyACM0

The response is:

Erasing…
All images are sent successfully!
Image tool closed!
done!

Although I think it was quicker than the process shown in the video.

Content of the flash directory is now:

amebad_flash_tool amebad_image_tool imgtool_flashloader_amebad.bin km0_boot_all.bin km0_km4_image2.bin km4_boot_all.bin

If I run:
./amebad_flash_tool flash -d /home/linux_user/git/flash --port /dev/ttyACM0

The response is:

copy img to workspace…
Traceback (most recent call last):
File “flash_tools.py”, line 150, in
File “click/core.py”, line 829, in **call**
File “click/core.py”, line 782, in main
File “click/core.py”, line 1259, in invoke
File “click/core.py”, line 1066, in invoke
File “click/core.py”, line 610, in invokeI nptice now that the files mentioned are the same file…
File “flash_tools.py”, line 139, in flash
File “flash_tools.py”, line 79, in copy_img
File “shutil.py”, line 241, in copRegardsyfile
shutil.SameFileError: ‘/home/linux_user/git/flash/km0_boot_all.bin’ and ‘/home/linux_user/git/flash/km0_boot_all.bin’ are the same file
[5323] Failed to execute script flash_tools

I got it to work (although there is some doubt) by cd’ing to the parent dir and using:

linux_user@linux_user-Alienware-17-R3:~/git$ ./flash/amebad_flash_tool flash -d /home/linux_user/git/flash --port /dev/ttyACM0

I do not see the following path generated anywhere!

20200730-rtl8720d-images-v2.2.0.2

Where does this come from?

The response I get is:

copy img to workspace…
Flashing…
All images are sent successfully!
Image tool closed!
done!

The output is the same as in your video.

If I then re-load the device with the scanner .ino example I get the error:

Cannot initialize ESP-AT Lib!
[E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
[E][WiFiGeneric.cpp:477] mode(): Could not set mode! -1
[E][esp_event_loop.c:99] at_unified_cb(): at_unified evt: 4
Setup done
scan start

In the console indicating that the flash process did not work.

If the unpacking process is critical than the process should be defined in the WIKI so that there is no reason not to do it that way.

I am away for a couple of days now and I will have access to a Windows laptop. I may just flash it that way as I want to get on.

Please unpack the tar.gz file using the linus gui and try it that way!

Regards

Stuart

OK I am now running the scan program. I eventually used the windows flash process but I believe the things I have learned (detailed below) apply to ALL flash platforms.

In retrospect I think there were steps that I missunderstood. The process works, I had not fully understood the details.

I see that the WIKI has been updated already.

My main mis-understanding was that I thought all of the files required were in the flash program tar.gz file. So the -d option refered to the same dir as the one that had the ‘erase’ backup binaries in them. This is why I had the shutil.SameFileError.

This is also why the flash, when I ran it from the parent dir worked but it flashed the same version that the erase had backed up so it did not fix the WIFI issue.

I could see from the video that the -d option refered to a separate dir and I did not understand where this came from.

Now I see that the binaries to be flashed were in 20200730-rtl8720d-images-v2.2.0.2 and needed to be downloaded and unzipped separatly. Once I added these files it all worked.

I believe an update to the WIKI giving more detail on the process would avoid this confusion.

Thank you for all your assistance I am now happy to continue:-)

Regards

Stuart

1 Like

Hi @stuartdd

Thanks for your support and yes, we will work on this document and make sure that it’s easy enough for anyone to update the core with Wio Terminal:D