High Speed UART

This application note demonstrates how to achieve a serial data rate of 400KBytes/s or more between two Gecko OS devices running Gecko OS.

This application uses two Gecko OS devices and a Python Script running on a PC.

The flow of data is as follows:

The diagram below shows the flow of data:

Module 1 - Settings

Gecko OS Commands (Module 1) Description

set uart.flow                 1 on
set uart.baud                 1 10000000 raw

set bus.mode                  stream
set bus.data_bus              uart1
set bus.log_bus               uart0

set bus.stream.flush_time     0

set bus.stream.flush_count    1460

set network.buffer.size       55000
set network.buffer.rxtx_ratio 85


set wlan.ssid                 <YOUR SSID>
set wlan.passkey              <YOUR PASSWORD>
set wlan.auto_join.enabled    1

set remote_terminal.enabled   1
set remote_terminal.port      50007

set tcp.server.auto_start     1

set tcp.server.port           40007

set broadcast.interval        10
set broadcast.port            55555
set broadcast.data            remote_terminal_port,ip


set ntp.enabled               0
set wlan.rssi_average         0


save
reboot

<- UART1 hardware flow control
<- UART1 baud rate of 10Mbit/s

<- Streaming data mode
<- UART1 is the data bus
<- UART0 is the logging bus
   (optional)
<- Disable the flush timer
   (allows for data zero-copy)
<- Maximum flush packet size

<- Network buffer size (max of 70k)
<- 85% of network buffer used for
   RX packets

<- Update with name of your network
<- Update with password to your network
<- Automatically join network on reboots

<- Enable remote configuration terminal
<- Port remote terminal listens on

<- Automatically start TCP server
   when network starts
<- Port TCP server listens on

<- Broadcast module info every 10s
<- Broadcast module info on this port
<- Broadcast remote terminal's port
   and module's IP

<- Disable Network Time Protocol (NTP) &
<- Disable WLAN RSSI averaging to avoid
   interrupting the onboard processor

<- Save settings
<- Reboot module to start with new settings

Module 2 - Settings

Gecko OS Commands (Module 2) Description

set uart.flow                 1 on
set uart.baud                 1 10000000 raw

set bus.mode                  stream
set bus.data_bus              uart1
set bus.log_bus               uart0

set bus.stream.flush_time     0

set bus.stream.flush_count    1460

set network.buffer.size       55000
set network.buffer.rxtx_ratio 15


set wlan.ssid                 <YOUR SSID>
set wlan.passkey              <YOUR PASSWORD>
set wlan.auto_join.enabled    1

set remote_terminal.enabled   1
set remote_terminal.port      50008

set tcp.server.auto_start     1

set tcp.server.port           40008

set broadcast.interval        10
set broadcast.port            55555
set broadcast.data            remote_terminal_port,ip


set ntp.enabled               0
set wlan.rssi_average         0


save
reboot

<- UART1 hardware flow control
<- UART1 baud rate of 10Mbit/s

<- Streaming data mode
<- UART1 is the data bus
<- UART0 is the logging bus
   (optional)
<- Disable the flush timer
   (allows for data zero-copy)
<- Maximum flush packet size

<- Network buffer size (max of 70k)
<- 85% of network buffer used for
   TX packets

<- Update with name of your network
<- Update with password to your network
<- Automatically join network on reboots

<- Enable remote configuration terminal
<- Port remote terminal listens on

<- Automatically start TCP server
   when network starts
<- Port TCP server listens on

<- Broadcast module info every 10s
<- Broadcast module info on this port
<- Broadcast remote terminal's port
   and module's IP

<- Disable Network Time Protocol (NTP) &
<- Disable WLAN RSSI averaging to avoid
   interrupting the onboard processor

<- Save settings
<- Reboot module to start with new settings

Notes for Settings


Using the Module 1 Soft AP

You can connect the Gecko OS devices and computer via any available Wi-Fi network. As the diagram above suggests, it is also possible to use the soft AP on Module 1 to create a wireless network between the modules and the PC. To use this setup (rather than a standalone Wi-Fi Access Point), add the following to the Module 1 Settings listed above:

Gecko OS Commands (Module 1) - enables use of Module 1 softAP
set softap.auto_start         1
set network.default_interface softap
set broadcast.interface   default
set tcp.server.auto_interface default

Note that the settings for broadcast.interface and tcp.server.auto_interface are not necessary if these variables have not been changed from their factory defaults.

Set the Module 2 wlan.ssid and wlan.passkey according to the Module 1 settings for softap.ssid and softap.passkey . IP addresses are allocated to connected devices by the Module 1 soft AP DHCP server , if running, according to the setting for softap.static.ip . Connect your computer to the Module 1 soft AP before running the Python script.


Setup Instructions

To run this example, follow these steps.

Update Settings

Copy and paste the settings above into a terminal connected to each respective module. Note that after rebooting the module, the module will no longer respond to terminal commands since hardware flow control is enabled and the UART baud rate is set to 10Mbit/s.

Use the remote terminal if a setting needs to be updated or factory reset the module using the external GPIO.

Connect UARTs

Connect the module UART signals. The signals are connected with Rx/Tx crossover and RTS/CTS crossover, as follows. Header pins shown are examples. Use the pins appropriate for your evaluation board:

Module 1
UART1 Signal
Module 1
H2 Pin
Module 2
UART1 Signal
Module 2
H2 Pin
RX 18 TX 17
TX 17 RX 18
RTS 16 CTS 15
CTS 15 RTS 16

Run Python Script

Copy the following python script to your computer.

highspeed_uart.py

Execute the python script. You should see the following

Listening for module UDP broadcast packets...

The Python script procedure is:

Script output is similar to the following:


Supporting Gecko OS Versions

Change Log

Modified Changes
2019-01-01 Created