RTL8710AF - a longer story!

About a year ago, I was made aware of WiFi+CPU SoC devices at one of the Reading Geek Night meetings. They looked pretty cool... So I investigated a bit, and because at the time, from what I found, the RTL8710 looked useful, and was available in an RTLDUINO format, I bought one on AliExpress. From China. Eeek! It arrived... along with some other stuff I've yet to decipher, but hey...

Anyway, I loaded up the Arduino IDE with the Ameba dev kit, and had a go. Plugged the NodeMCU-sized board into the USB, a light flashed, hurrah. Except I couldn't talk to it at all. More research revealed that the RTLDUINO is part of the ARM Corp's IoT ecosystem, and requires a development motherboard, which cost more. Boring. So I chucked the board in a box - I think it cost me $8, no harm done. I did find a lot out about many things as a result though...

Incidentally, AliExpress is a geek's goldmine - a bit like the market in Bladerunner, I'm surprised you can't buy replicants, spare augemented body parts and the like. Amazing!

And so to today. Following my experience with NodeMCU, I dug the RTL8710 board out again, on the basis that

  • It looked very like the NodeMCU board, and thus might be amenable to some coaxing
  • It used the CH340 UART-USB chip, which has also been used for NodeMCU boards, and now I realised, having loaded the CP2210 driver into my Mac, would require a CH340 driver...
I also read the instructions on the back of the board (!), which are pretty helpful if you have any idea at all. Obviously I don't. The usual story, it's no good giving a message to someone who is not prepared to receive it!
  1. Install CH340 driver
  2. Use 38400 baud rate
  3. Jlink debug (TMS CLK VCC GND)
  4. transparent transmission mode interface (GA0 GA4)
I loaded the CH340 driver, plugged the sucker in, found another Arduino IDE dev kit, and had another go. This time it said "ERR: Cannot access mbed driver!". Googled quite a bit, various web sites, including the ARM Corp's mbed.com, and once again, I still need the damn development board. Bugger. So is there anyway to talk to the damn chip at all??

Then I found someone mentioning that AT commands (the old Hayes modem command set, for people under 30) would work, issued from a terminal programme. Marv. Tried it using screen, with the command screen /dev/tty.usbserial-999 38400  and after a bit of stty -f /dev/tty.usbserial-999 38400 c8 to set the baud rate as per the instructions on the back of the board (!), it came up with [MEM] After do cmd, available heap 59704 in response to "AT" typed at it. Excellent!!

Right, now what AT commands will it accept?? Amazingly, someone came up with the following documents
  • ATW? - queries the WiFi state

[ATW?]: _AT_WLAN_INFO_


WIFI wlan0 Status: Running
==============================
[rltk_wlan_statistic] tx stat: tx_packets=6, tx_dropped=0, tx_bytes=1192
[rltk_wlan_statistic] rx stat: rx_packets=1308, rx_dropped=1308, rx_bytes=308935, rx_overflow=0
[rltk_wlan_statistic] min_free_heap_size=50168, current heap free size=59704
[rltk_wlan_statistic] max_skbbuf_used_num=3, skbbuf_used_num=0
[rltk_wlan_statistic] max_skbdata_used_num=3, skbdata_used_num=0
[rltk_wlan_statistic] max_timer_used_num=11

WIFI  wlan0 Setting:
==============================
      MODE => STATION
      SSID => myssid
   CHANNEL => 1
  SECURITY => AES
  PASSWORD => password

Interface (wlan0)
==============================
        MAC => 00:e0:4c:87:01:22
        IP  => 192.168.1.28
        GW  => 192.168.1.1

  • ATPN=<ssid>,<pwd>[,<key_id>,<bssid>] - connect to AP
    • RTL8195A[Driver]: set ssid [myssid] 

      RTL8195A[Driver]: start auth to 84:16:f9:f4:db:b4

      RTL8195A[Driver]: auth success, start assoc

      RTL8195A[Driver]: association success(res=26)

      RTL8195A[Driver]: set pairwise key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4)

      RTL8195A[Driver]: set group key to hw: alg:2(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:1
         
      Interface 0 IP address : 192.168.1.28
      [MEM] After do cmd, available heap 59704

  • ATWS - scan for APs; no proper result 
    • [ATWS]: _AT_WLAN_SCAN_
  • ATWQ - Start simple config - this broke things :-(
    • [ATWQ]: _AT_WLAN_SIMPLE_CONFIG_

  • LwIP_DHCP: dhcp stop.

    Deinitializing WIFI ...
  • ATPS=0,80 - start a TCP server on port 80 (!!!)
    • [ATPS]: _AT_TRANSPORT_START_SERVER
# The TCP SERVER START OK!
  • ATPK=1 - Auto receive mode, sends data to "host" i.e. my terminal?
    • I then connected with telnet 192.168.1.28 80 (device, port 80) and sent "asdasdasdasdasd"
    • [ATPR] OK,17,2:asdasdasdasdasd
  • ATPG=1 - store WiFI config in flash and auto connect on restart
  • ATPL=1 - save TCP info in flash and restart (this didn't work)
  • ATSR - restart!!
=========================================================


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 ====

load NEW fw 0
Flash Image2:Addr 0xb000, Len 279116, Load to SRAM 0x10006000
No Image3
Img2 Sign: RTKWin, InfaStart @ 0x10006051
===== Enter Image 2 ====
                     ######################                 ####################            ########################
                    #                      #               #                    #          #                        #
                   #     ################   #             # # ##################            #########      #########
                   #    #               #   #             # #                                       #      #
                   #   #                #   #             #  #                                      #      #
                   #   #                #   #              #  #                                     #      #
                   #   #                #  #                #  #                                    #      #
                   #    ################  #                  #  #                                   #      #
                   #                      #                   #  #                                  #      #
                   #   ################## #              #######  #                                 #      #
                   #   #                #  #            #          #                                #      #
                   #   #                #   #          #  #######   #        ####                   #      #
                   #   #                #   #          # #        #  #       #  #                   #      #
                   #   #                #   #          # #          #  #     #  #                   #      #
                   #   #                #   #          # #           #  #    #  #                   #      #
                   #    ################    #          #   ##########    #####  #                   #      #
                   #                       #            #                      #                    #      #
                    #######################               #####################                     ########
#interface 0 is initialized
interface 1 is initialized

Initializing WIFI ...
Start LOG SERVICE MODE

#
WIFI initialized

init_thread(53), Available heap 0xc840
RTL8195A[Driver]: set ssid [myssid]

RTL8195A[Driver]: start auth to 84:16:f9:f4:db:b4

RTL8195A[Driver]: auth success, start assoc

RTL8195A[Driver]: association success(res=26)

RTL8195A[Driver]: set pairwise key to hw: alg:4(WEP40-1 WEP104-5 TKIP-2 AES-4)

RTL8195A[Driver]: set group key to hw: alg:2(WEP40-1 WEP104-5 TKIP-2 AES-4) keyid:1

Interface 0 IP address : 192.168.1.28Auto connect isn't enabled for server

AT_UART_CONF: 38400,8,1,0,0
RTL8195A[HAL]: ISR 81 had been allocated!!!
[GPIO Err]HAL_GPIO_Irq_Init: GPIO Pin(0) Unavailable

  • ATWD - disconnect from AP

  • [ATWD]: _AT_WLAN_DISC_NET_

    Deassociating AP ...
    ioctl[SIOCGIWESSID] ssid = NULL, not connected
    WIFI disconnected

    [MEM] After do cmd, available heap 60656

So much to understand!! There is a very interesting command, ATSO - OTA Upgrade, which downloads a new firmware image from a server at the specified location. Hmmm...

Unfortunately, it won't let me set it as an AP, using the ATPA command - no response to it, and the ATW? command gives the same status, STATION. Boo.

Comments

  1. any progress? i'm in the same boat as you :) after years wanted to see if anyone came up with a solution still no luck :)

    ReplyDelete

Post a Comment

Popular posts from this blog

Replacing Coffee Machine Pump (Dualit Espressivo)

Multiple SHT30 sensors on a single I2C bus with Sonoff-Tasmota

NodeMCU + Tasmota code + SHT30