Skip to content

Circuit Python

Neil Khera edited this page Jun 3, 2022 · 17 revisions

Using Vscode

Seting Up VSCode

  1. Install the Circuit Python Extension for VSCode

Trouble shooting

  • Opening the Serial Monitor Won't Work (Ubuntu)

running sudo chmod a+rw /dev/ttyACM0 (or whatever other serial port instead of /dev/ttyACM0 fixed the issue temporarily)

Updating the PyCubedMini Board

Based on the instructions here

  1. Connect the PyCubed-Mini board to your computer via USB.
  2. Quickly double click the "RESET" button on the board (only small black button on the board). When the board boots into BOOTLOADER mode, the LED should be bright and white. The board should also mount as PYCUBEDBOOT.
  3. Then drag and drop the update_bootloader.uf2 into the the PYCUBEDBOOT drive (do this). However, renaming it to CURRENT.uf2 and replacing the current CURRENT.uf2 file in the drive also worked. The board should automatically reboot and update.
  4. Wait for the board to unmount, then remount in bootloader mode again.
  5. Copy over firmware.uf2
  6. The board should automatically reboot, and remount as CIRCUITPY
  7. If the libraries/code require updating also update the lib directory and the relevant python files.

Mainboard v03 Update Changes

Versions 1 and 2 of the PyCubed-Mini bootloader and firmware was configured for the ATSAMD51J20A microcontroller. Due to the ongoing global chip shortage, we have been forced to harvest ATSAMD51 chips from Adafruit's Feather M4 boards. These boards ship with the ATSAMD51J19A version of the MCU, which features 512KB of memory (as opposed to 1024 on the 20A version) and 192KB of SRAM (as opposed to 256KB on the 20A version). This requires for the following edits to the CircuitPython config files:

Bootloader

board.mk

  • Changed CHIP_VARIANT to SAMD51J19A

board_config.h

  • Changed PRODUCT_NAME to PyCubedMiniv03
  • Changed BOARD_ID to PyCubedMini_v03_J19

Firmware

board.c

  • Updates to this file are only relevant to replacing deprecated and changed functionality in the newest versions of CircuitPython. The most significant change is that of replacing all instances of pulseio to pwmio

mpconfigboard.h

  • Changed MICROPY_HW_MCU_NAME to samd51J19
  • Delete #define CIRCUITPY_INTERNAL_NVM_SIZE
  • Delete #define BOARD_FLASH_SIZE

mpconfigboard.mk

  • Changed CHIP_VARIANT to SAMD51J19A

pins.c

  • Changed #include "boards/board.h" to #include "supervisor/board.h" to work with new versions of CircuitPython

Instructions from past documentation

Detailed instructions and troubleshooting here. This page will be replaced with the future PyCubedMini instruction set.

Access the most recent versions of update_bootloader.uf2 and firmware.uf2 from here.

Access the most recent version of flight-software on the max-fsw branch of avionics-motherboard/firmware. Copy entire lib directory from that repo and replace the lib directory on your board. Note: We currently do not have access to this branch. However, copying the "firmware/pycubedminiv01/default/lib" directory here also works.