Description
After updating my linux system to the latest arm-none-eabi-gcc toolset (7.2.1) I have been experiencing some odd behavior when executing a build of CP 3.0 master on my Metro-m4-express.
The compile and upload run with no problems and I can enter the REPL on the M4. When I execute some scripts, the system will run for awhile then apparently hang and after about 30 seconds, it disconnects the USB port. It can be restored by a RESET.
I recompiled CP 3.0 master with gcc 6.3.1 and everything works properly.
I have compiled CP 2.x for several M0 boards with gcc 7.2.1 and have not seen any problems.
Also I have compiled CP 3.0 master for the feather nrf52 board (also an M4) and have not experienced any problems (but my testing of it has been minimal).
Note that CP 3.0 master compiled with gcc 7.2.1 for the metro-m0-express also works without any problems.
I am attaching 2 scripts that cause hangs - the BMP280_test.py runs an report 3 full samples then on the 4th sample it hangs after reporting the Temperature. -- this is repeatable ...
the ring.py script displays a color wheel on a 16 element neopixel ring. It hangs immediately and none of the neopixels even get illuminated.
I have also caused it to hang via the REPL by setting up the BMP280 and making repeade reads. After several successful reads, it hung as before.
bmp280_test:
import board
import digitalio
import busio
import time
import adafruit_bmp280
# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
# OR create library object using our Bus SPI port
#spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
#bmp_cs = digitalio.DigitalInOut(board.D10)
#bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
# change this to match the location's pressure (hPa) at sea level
bmp280.seaLevelhPa = 1013.25
while True:
print("\nTemperature: %0.1f C" % bmp280.temperature)
print("Pressure: %0.1f hPa" % bmp280.pressure)
print("Altitude = %0.2f meters" % bmp280.altitude)
time.sleep(2)
ring.py:
from digitalio import *
from board import *
import neopixel
import time
pixpin = D2
numpix = 16
#led = DigitalInOut(D13)
#led.direction = Direction.OUTPUT
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.2,auto_write=False)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0):
return (0, 0, 0)
if (pos > 255):
return (0, 0, 0)
if (pos < 85):
return (int(pos * 3), int(255 - (pos*3)), 0)
elif (pos < 170):
pos -= 85
return (int(255 - pos*3), 0, int(pos*3))
else:
pos -= 170
return (0, int(pos*3), int(255 - pos*3))
def rainbow_cycle(wait):
for j in range(255):
for i in range(len(strip)):
idx = int ((i * 256 / len(strip)) + j)
strip[i] = wheel(idx & 255)
strip.show()
time.sleep(wait)
try:
while True:
rainbow_cycle(0.001)
except:
pass
finally:
for i in range(len(strip)):
strip[i] = (0,0,0)
strip.show()