RTL8195 with Arduino SDK on Linux won't connect to WiFi

Hello!

I am programming an RTL-AMEBA_DEV01_1V0 (RTL8195) dev board using Arduino 1.8.16 on Linux Peppermint Linux version 5.4. amd64 (Ubuntu 7.5.0-3ubuntu1~18.04).

I added support to Realtekboards using this link:

https://www.amebaiot.com/en/ameba-arduino-getting-started/

I have installed 2.0.11 version but I have tried with versions 2.0.5 to 2.0.11 without luck.

After I load the example from File → Examples → AmebaWifi → ConnectWithWPA

this is what I get in the console:

========================================================= ROM Version: 0.3

Build ToolChain Version: gcc version 4.8.3 (Realtek ASDK-4.8.3p1 Build 2003)

=========================================================

Check boot type form eFuse
SPI Initial
Image1 length: 0x3a88, Image Addr: 0x10000bc8
Image1 Validate OK, Going jump to Image1
BOOT from Flash:YES
===== Enter Image 1 ====
SDR Controller Init
load NEW fw 0
Flash Image2:Addr 0xb000, Len 64124, Load to SRAM 0x10006000
Image3 length: 0x2b298, Image3 Addr: 0x30000000
Img2 Sign: RTKWin, InfaStart @ 0x10006049
===== Enter Image 2 ====
addr:1002C070 size:00043F90
addr:300308EC size:001CF714
interface 0 is initialized
interface 1 is initialized
Initializing WIFI …
WIFI initialized

RTL8195A[Driver]: set ssid [RED]
RTL8195A[Driver]: start auth to 38:80:df:0d:3c:0f
RTL8195A[Driver]: auth success, start assoc
RTL8195A[Driver]: association success(res=4)

I can not see the output of the line:

Serial.print("You're connected to the network");

The SSID and password are OK.

It seems that program won’t return from this call:

Breakpoint 4, wifi_connect (ssid="RED", security_type=RTW_SECURITY_WPA2_AES_PSK, password="123456780", ssid_len=3, password_len=9, key_id=0, semaphore=) at ../../../component/common/api/wifi/wifi_conf.c:414

Its called from int8_t WiFiDrv::wifiSetPassphrase at wifi_drv.cpp(116)

Realtek board can connect with the AP if security is disabled (tested with the example ConnectNoEncryption).

ESP32 can connect to the AP using WPA encryption (tested with the example WiFiClient for ESP32 boards).

Can someone help me to debug this issue? Could be a Layer 8 problem?

1 Like

Hi @V1ct0r

Thanks for reporting this issue. You are correct in that it seems that version 2.0.11 has an issue with connecting to WPA authenticated WiFi networks. I could not get it to work in either Ubuntu or Windows.

However, testing of version 2.0.10 shows that it connects to WPA WiFi networks with no issue in both windows and ubuntu. You might want to try 2.0.10 again. I suspect that somehow it did not remove version 2.0.11 cleanly. You should do a remove in Arduino board manager, ensure that the 2.0.11 folder has been deleted from the .arduino15\packages\realtek\hardware\Ameba1 directory, then install version 2.0.10 and check that the 2.0.10 folder appears in that directory.

1 Like

Thank you for your answer @wyy

As you pointed, I have deleted the arduino files and tried 2.0.10 version. Now the board can connect to WPA protected networks and get an IP address.

This should be an error related to the Standar SDK because the same bug appears in the master branch at GitHub - ambiot/amb1_sdk: SDK for Ameba1

Should I open another post related to the Standard SDK?

Thanks for the information, since the Arduino package and standard SDK use the same underlying WiFi firmware, seeing the same issue appear in the SDK is no surprise.
I will test it out and feedback to the development team as well, so there is no need to create another post on this.

1 Like

@V1ct0r

After testing the standard SDK on Github, I am unable to find the same bug. It is able to connect to WPA WiFi networks with no issue.
Can you provide more information on how you encountered this bug with the standard SDK?

I have moved my amb1_sdk folder to amb1_sdk_mod and made a new clone of the repo with git clone https://github.com/ambiot/amb1_sdk.git

In one window I’m running ~/amb1_sdk/project/realtek_ameba1_va0_example/GCC-RELEASE/run_openocd.sh.

In another window I have made make clean; make; make flash and I’m getting this error:

../../../component/soc/realtek/8195a/misc/gcc_utility//rtl_gdb_flash_write.txt:6: Error in sourced command file: :2331: Expiró el tiempo de conexión (connection time expired).

So I can’t reproduce the bug in a new install of the SDK.

If I use my previous folder called amb1_sdk_mod, then:

In one window I’m running ~/**amb1_sdk_mod**/project/realtek_ameba1_va0_example/GCC-RELEASE/run_openocd.sh .

In other window (in the ~/amb1_sdk_mod/project/realtek_ameba1_va0_example/GCC-RELEASE) directory, I have made make clean; make; make flash and the the bin file gets flashed to the board.

This is what I get in the console (the AP is offline):

RTL8195A[Driver]: set ssid [RED] 
auto reconnect ...

When I put online the AP, the board connects to WiFi.

RTL8195A[Driver]: auth success, start assoc
RTL8195A[Driver]: association success(res=1)
RTL8195A[Driver]: set pairwise key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4)

This code is based on the 1b3f28c commit of the SDK in github and the attached files had been modified:

main.h in directory inc/
wlan_network.c in directory component/common/api/network/src/

main.h.xml (2,8 KB)
wlan_network.c.xml (1,9 KB)

I have deleted and cloned again the repo and I’m still unable of flashing the board. Maybe I need to reorder my thoughts. I don’t know why I cannot upload code to the board using a new clone of the repo.

tested with both 1b3f28c and the latest 4527809 commits of the GitHub SDK, both are able to connect to WPA WiFi networks.

As an alternative to make flash, you can directly copy the file \GCC-RELEASE\application\Debug\bin\ram_all.bin into the DAP drive that appears when the board is connected, this has the same effect as flashing the image onto the board.