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

**URL:** <https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062>\
**Category:** WiFi\
**Created:** [January 23, 2022, 2:02pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062 "2022-01-23T14:02:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 23, 2022, 2:02pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/1 "2022-01-23T14:02:02Z")

</div>

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:

> **[Ameba ARDUINO: Getting Started with RTL8710 – Realtek IoT/Wi-Fi MCU Solutions](https://www.amebaiot.com/en/ameba-arduino-getting-started-rtl8710/)**

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?

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [January 24, 2022, 7:55am UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/2 "2022-01-24T07:55:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 24, 2022, 12:38pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/3 "2022-01-24T12:38:30Z")

</div>

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](https://github.com/ambiot/amb1_sdk)

Should I open another post related to the Standard SDK?

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [January 24, 2022, 12:58pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/4 "2022-01-24T12:58:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [January 25, 2022, 2:51am UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/5 "2022-01-25T02:51:21Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 25, 2022, 2:58pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/6 "2022-01-25T14:58:11Z")

</div>

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.

 ![bug_connection_expired](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/1320cd45618046431be6027211220f3779303678.jpeg)

---

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 25, 2022, 3:16pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/7 "2022-01-25T15:16:24Z")

</div>

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.

 ![ameba_flashed](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/13597a6ac43b1e13684a2e1279827ce7a556754f.jpeg)

---

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 25, 2022, 3:28pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/8 "2022-01-25T15:28:55Z")

</div>

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

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

```

 ![terminal1](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/6465297df4a28235c48a130ca9f4c06def1c6c87.jpeg)

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

```auto
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](https://forum.amebaiot.com/uploads/short-url/6QxvSDvi0btx3WDd7RFLTPVJ9Hp.xml) (2,8 KB)  
[wlan\_network.c.xml](https://forum.amebaiot.com/uploads/short-url/oRP5jfIcihYhKTG1l9UBQo5NQHS.xml) (1,9 KB)

---

<div class="post-metadata">

**Author:** ![V1ct0r](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/v1ct0r/32/796_2.png) [@V1ct0r](https://forum.amebaiot.com/u/V1ct0r)\
**Post date:** [January 25, 2022, 6:32pm UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/9 "2022-01-25T18:32:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wyy](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@wyy](https://forum.amebaiot.com/u/wyy)\
**Post date:** [January 26, 2022, 4:14am UTC](https://forum.amebaiot.com/t/rtl8195-with-arduino-sdk-on-linux-wont-connect-to-wifi/1062/10 "2022-01-26T04:14:05Z")

</div>

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.
