#RTL8720DN eRPC CircuitPython development

1 messages · Page 1 of 1 (latest)

frail wadi
#

@dusk urchin
RTL8720DN is the wifi chip of Seeeduino Wio Terminal.
It uses and eRPC firmware that works with arduino.
If anyone wants to join, you are more than welcome to.

#

Notes insofar:
There seems to have been a hw revision across the years. In the later revision, leaving the uart pins floating panics the chip leaving it unresponsive. For this, initializing uart should be done near the chip reset.

#
import board
import busio
from time import sleep
from digitalio import DigitalInOut

import erpc
from erpc_shim import rpc_system, rpc_wifi_api

# Reset RTL8720
pwr = DigitalInOut(board.RTL_PWR)
pwr.switch_to_output()
pwr.value = False
sleep(.125)
pwr.value = True
uart = busio.UART(board.RTL_MOSI, board.RTL_MISO, baudrate=614400)
sleep(.125)
uart.read(uart.in_waiting)
rdy = DigitalInOut(board.RTL_READY)
log_uart = busio.UART(board.RTL_TXD, board.RTL_RXD, baudrate=614400)
xport = erpc.transport.SerialTransport(uart)
manager = erpc.client.ClientManager(xport, erpc.basic_codec.BasicCodec)

try:
    test_byte = 0xF
    system_client = rpc_system.client.rpc_systemClient(manager)
    ver = system_client.rpc_system_version()
    ack = system_client.rpc_system_ack(test_byte)
    print(f"OK: version: {ver}, ack({test_byte}): {ack}")
except TypeError:
    print("FAIL")