WIO Terminal - Looking for CircuitPython example to get GPS output

In the schematic for the Wio Terminal LoRaWan Chassis, I see pins for what looks like a UART, and then also an I2C set of pins reserved. I’ve tried them both, and looked to find the pin definitions… and so far I do not have either I2C or UART working.

Even just an example of how to define the serial interface for the GPS and receive a generic string would be fantastic! I’m happy to read the specs of the GPS, or go look at an example if there is one. (CircuitPython)

Thank you very much for your time… this really is an incredible platform.

Ken

So I can define this uart in Circuitpython, but I never get any output from the GPS.

If someone can confirm for me what two pins on the actual micro-controller the GPS serial lines map back to, I could try them. The schematics provided do not make this easy to tell!

Can anyone help me understand what to change here so that I can see what the GPS is sending? Are these the correct pins?

Suggestion: How about if we ask Seeed to help map the GPS pins on the LORA chassis to a named pin in the dir(board) list and have those two pins named GPS.TX and GPS.RX?

In this way, everyone will know what pins to use to talk to the GPS, and nobody will have to struggle with tryng to figure out how to map the UART… thoughts?

import time
import board
import busio
import microcontroller
uart = busio.UART(microcontroller.pin.PB02, microcontroller.pin.PB00, baudrate=9600)
output1 = bytes("\r\n", ‘ascii’)
uart.write(output1)
time.sleep(.5)
print(uart.readline())
time.sleep(.5)
print(uart.readline())

As a reference, in gps.cpp: (GitHub - disk91/WioLoRaWANFieldTester)

SoftwareSerial softSerial(3,2);

So in C++ code, what physical pins would that map back to on the actual processor?

I have an output of all of the combinations for this board that should be valid, and I’ve tried a lot of these combinations… believing that if I got the correct definition, I would start to see output from the GPS:

RX pin: board.A1 TX pin: board.A0
RX pin: board.D13 TX pin: board.A0
RX pin: board.GYROSCOPE_SCL TX pin: board.A0
RX pin: board.TX TX pin: board.A0
RX pin: board.A2 TX pin: board.A6
RX pin: board.A8 TX pin: board.A6
RX pin: board.DAC1 TX pin: board.A6
RX pin: board.RTL_CLK TX pin: board.A6
RX pin: board.RTL_CS TX pin: board.A6
RX pin: board.RTL_MISO TX pin: board.A6
RX pin: board.SD_CS TX pin: board.A6
RX pin: board.SD_MISO TX pin: board.A6
RX pin: board.SD_MOSI TX pin: board.A6
RX pin: board.BUTTON_3 TX pin: board.BUTTON_2
RX pin: board.D9 TX pin: board.BUTTON_2
RX pin: board.RTL_DIR TX pin: board.BUTTON_2
RX pin: board.RTL_PWR TX pin: board.BUTTON_2
RX pin: board.RTL_TXD TX pin: board.BUTTON_2
RX pin: board.SD_DET TX pin: board.BUTTON_2
RX pin: board.SWITCH_UP TX pin: board.BUTTON_2
RX pin: board.BUTTON_3 TX pin: board.D10
RX pin: board.D9 TX pin: board.D10
RX pin: board.RTL_DIR TX pin: board.D10
RX pin: board.RTL_PWR TX pin: board.D10
RX pin: board.RTL_TXD TX pin: board.D10
RX pin: board.SD_DET TX pin: board.D10
RX pin: board.SWITCH_UP TX pin: board.D10
RX pin: board.D10 TX pin: board.D9
RX pin: board.I2S_LRCLK TX pin: board.D9
RX pin: board.I2S_SDOUT TX pin: board.D9
RX pin: board.RTL_DIR TX pin: board.D9
RX pin: board.RTL_PWR TX pin: board.D9
RX pin: board.RTL_RXD TX pin: board.D9
RX pin: board.SD_DET TX pin: board.D9
RX pin: board.SWITCH_UP TX pin: board.D9
RX pin: board.D13 TX pin: board.GYROSCOPE_SCL
RX pin: board.GYROSCOPE_SDA TX pin: board.GYROSCOPE_SCL
RX pin: board.RTL_CS TX pin: board.GYROSCOPE_SCL
RX pin: board.RTL_MISO TX pin: board.GYROSCOPE_SCL
RX pin: board.RTL_MOSI TX pin: board.GYROSCOPE_SCL
RX pin: board.RX TX pin: board.GYROSCOPE_SCL
RX pin: board.A1 TX pin: board.GYROSCOPE_SDA
RX pin: board.D13 TX pin: board.GYROSCOPE_SDA
RX pin: board.GYROSCOPE_SCL TX pin: board.GYROSCOPE_SDA
RX pin: board.TX TX pin: board.GYROSCOPE_SDA
RX pin: board.CS TX pin: board.I2S_BCLK
RX pin: board.I2S_LRCLK TX pin: board.I2S_BCLK
RX pin: board.I2S_SDIN TX pin: board.I2S_BCLK
RX pin: board.I2S_SDOUT TX pin: board.I2S_BCLK
RX pin: board.MISO TX pin: board.I2S_BCLK
RX pin: board.SCK TX pin: board.I2S_BCLK
RX pin: board.TFT_MISO TX pin: board.I2S_BCLK
RX pin: board.D10 TX pin: board.I2S_SDIN
RX pin: board.I2S_LRCLK TX pin: board.I2S_SDIN
RX pin: board.I2S_SDOUT TX pin: board.I2S_SDIN
RX pin: board.RTL_DIR TX pin: board.I2S_SDIN
RX pin: board.RTL_PWR TX pin: board.I2S_SDIN
RX pin: board.RTL_RXD TX pin: board.I2S_SDIN
RX pin: board.SD_DET TX pin: board.I2S_SDIN
RX pin: board.SWITCH_UP TX pin: board.I2S_SDIN
RX pin: board.CS TX pin: board.IR
RX pin: board.I2S_LRCLK TX pin: board.IR
RX pin: board.I2S_SDIN TX pin: board.IR
RX pin: board.I2S_SDOUT TX pin: board.IR
RX pin: board.MISO TX pin: board.IR
RX pin: board.SCK TX pin: board.IR
RX pin: board.TFT_MISO TX pin: board.IR
RX pin: board.CS TX pin: board.MOSI
RX pin: board.I2S_LRCLK TX pin: board.MOSI
RX pin: board.I2S_SDIN TX pin: board.MOSI
RX pin: board.I2S_SDOUT TX pin: board.MOSI
RX pin: board.MISO TX pin: board.MOSI
RX pin: board.SCK TX pin: board.MOSI
RX pin: board.TFT_MISO TX pin: board.MOSI
RX pin: board.D13 TX pin: board.RTL_CLK
RX pin: board.GYROSCOPE_SDA TX pin: board.RTL_CLK
RX pin: board.RTL_CS TX pin: board.RTL_CLK
RX pin: board.RTL_MISO TX pin: board.RTL_CLK
RX pin: board.RTL_MOSI TX pin: board.RTL_CLK
RX pin: board.RX TX pin: board.RTL_CLK
RX pin: board.A2 TX pin: board.RTL_MOSI
RX pin: board.A8 TX pin: board.RTL_MOSI
RX pin: board.DAC1 TX pin: board.RTL_MOSI
RX pin: board.RTL_CLK TX pin: board.RTL_MOSI
RX pin: board.RTL_CS TX pin: board.RTL_MOSI
RX pin: board.RTL_MISO TX pin: board.RTL_MOSI
RX pin: board.SD_CS TX pin: board.RTL_MOSI
RX pin: board.SD_MISO TX pin: board.RTL_MOSI
RX pin: board.SD_MOSI TX pin: board.RTL_MOSI
RX pin: board.BUTTON_3 TX pin: board.RTL_RXD
RX pin: board.D9 TX pin: board.RTL_RXD
RX pin: board.RTL_DIR TX pin: board.RTL_RXD
RX pin: board.RTL_PWR TX pin: board.RTL_RXD
RX pin: board.RTL_TXD TX pin: board.RTL_RXD
RX pin: board.SD_DET TX pin: board.RTL_RXD
RX pin: board.SWITCH_UP TX pin: board.RTL_RXD
RX pin: board.D10 TX pin: board.RTL_TXD
RX pin: board.I2S_LRCLK TX pin: board.RTL_TXD
RX pin: board.I2S_SDOUT TX pin: board.RTL_TXD
RX pin: board.RTL_DIR TX pin: board.RTL_TXD
RX pin: board.RTL_PWR TX pin: board.RTL_TXD
RX pin: board.RTL_RXD TX pin: board.RTL_TXD
RX pin: board.SD_DET TX pin: board.RTL_TXD
RX pin: board.SWITCH_UP TX pin: board.RTL_TXD
RX pin: board.A1 TX pin: board.RX
RX pin: board.D13 TX pin: board.RX
RX pin: board.GYROSCOPE_SCL TX pin: board.RX
RX pin: board.TX TX pin: board.RX
RX pin: board.BUZZER TX pin: board.SD_MOSI
RX pin: board.SD_CS TX pin: board.SD_MOSI
RX pin: board.SD_MISO TX pin: board.SD_MOSI
RX pin: board.SD_SCK TX pin: board.SD_MOSI
RX pin: board.SWITCH_DOWN TX pin: board.SD_MOSI
RX pin: board.SWITCH_PRESS TX pin: board.SD_MOSI
RX pin: board.A2 TX pin: board.SD_SCK
RX pin: board.A8 TX pin: board.SD_SCK
RX pin: board.DAC1 TX pin: board.SD_SCK
RX pin: board.RTL_CLK TX pin: board.SD_SCK
RX pin: board.RTL_CS TX pin: board.SD_SCK
RX pin: board.RTL_MISO TX pin: board.SD_SCK
RX pin: board.SD_CS TX pin: board.SD_SCK
RX pin: board.SD_MISO TX pin: board.SD_SCK
RX pin: board.SD_MOSI TX pin: board.SD_SCK
RX pin: board.BUZZER TX pin: board.SWITCH_RIGHT
RX pin: board.SD_CS TX pin: board.SWITCH_RIGHT
RX pin: board.SD_MISO TX pin: board.SWITCH_RIGHT
RX pin: board.SD_SCK TX pin: board.SWITCH_RIGHT
RX pin: board.SWITCH_DOWN TX pin: board.SWITCH_RIGHT
RX pin: board.SWITCH_PRESS TX pin: board.SWITCH_RIGHT
RX pin: board.D13 TX pin: board.TX
RX pin: board.GYROSCOPE_SDA TX pin: board.TX
RX pin: board.RTL_CS TX pin: board.TX
RX pin: board.RTL_MISO TX pin: board.TX
RX pin: board.RTL_MOSI TX pin: board.TX
RX pin: board.RX TX pin: board.TX

Alas…

I have tried to use the I2C interface… the first hurdle with this is that this Lora board does not implement the pull up resistors. Using a raspberry pi breakout board, I installed the resistors, defined the I2C interface in circuitpython, and did a scan. No devices. So it appears that I2C is not there yet, and really is only a future idea. That’s unfortunate, because doing that in circuitpython would be easy. So the future version with I2C actually implemented sounds like will be well received, but is not real yet. With no pullups installed, that means even new firmware for this board cannot use this interface… without some kind of a workaround.

Meanwhile… from research and help from others, the existing pins D2 and D3, while easy to use a software UART from the Arduino perspective, are not easy to use from Circuitpython. If only the hardware designers had selected two pins that an also map to a uart on this chip… then it would be easy.

It seems very odd to actually rely on a software serial implementation when you step back and look at the virtual field of serial options on this host processor…

So… I physically connected D3 to to A1, and D2 to A0 on the 40 pin connector.

I then set D2 and D3 on the Wio Terminal side to inputs, to ensure there would be no conflicts:

led2 = digitalio.DigitalInOut(board.D3)
led2.direction = digitalio.Direction.INPUT
led1 = digitalio.DigitalInOut(board.D2)
led1.direction = digitalio.Direction.INPUT

I then defined the UART on the Wio Terminal side using A0 and A1.
The same data will go to D2 and D3, but I can’t see it there as a uart.
I can see it at A0 and A1. :wink:

uart = busio.UART(board.A0, board.A1, baudrate=9600)
time.sleep(.5)
print(uart.readline())
time.sleep(.5)
print(uart.readline())
time.sleep(.5)
print(uart.readline())
time.sleep(.5)
print(uart.readline())

And… bingo! I get GPS output from my newly defined UART.

I just had to bring it to a set of pins that the hardware can define as a serial device that is supported.

Someone within Seeed really should devote some time to supporting CircuitPython from within the community. I feel like this is very much a growth area for Seed that they are missing out on.

I’m sure it all looks easy from an Arduino perspective once you have done everything a few times… but approaching this platform from a Circuitpython perspective brings such a rich set of tools and rapid development that from my view… it’s just hard to ignore.

3 Likes