-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
This is a weird one, so I hope someone else can reproduce it.
I have a Metro M4 Express marked "beta", purchased from the Adafruit store on May 8. It's loaded with the 3.0 release: Adafruit CircuitPython 3.0.0 on 2018-07-09; Adafruit Metro M4 Express with samd51j19
. Attached to it is a GPS shield which at power on starts sending NMEA sentences every second.
Normally, an 'echo' program will work properly, showing GPS packets to the computer via USB. While preparing a minimum test case to file this issue, I pared it down to this, which just reads up to 96 bytes:
import board
import busio
uart = busio.UART(board.TX, board.RX, baudrate=9600)
#class F:
# def f(): pass
data = uart.read(96)
print(repr(data))
Note the commented-out class F
definition. When saved as echo.py
, it can be imported and it shows the first few bytes of communication with the GPS:
Adafruit CircuitPython 3.0.0 on 2018-07-09; Adafruit Metro M4 Express with samd51j19
>>> import echo
b'$GPRMC,013202.00,A,4047.12000,N,09641.84538,W,0.154,,250718,,,A*65\r\n$GPVTG,,T,,M,0.154,N,0.285,K'
If I uncomment the definition class F
, the code breaks, read
always returns None
.
Adafruit CircuitPython 3.0.0 on 2018-07-09; Adafruit Metro M4 Express with samd51j19
>>> import badecho
None
It is nothing to do with the amount of time spent between uart = busio.UART...
and the first uart.read
, because inserting time.sleep(2)
there works just fine.