Skip to main content

Microcontroller Kit Overview

We sell a complete kit containing all necessary components on the Amiga shop website: farm-ng microcontroller kit

Feather M4 Can device setup

This device can be used for rapid prototyping of applications that interact with farm-ng's Amiga platform.

The Feather M4 board front and back, where to solder the connector, and the resistor that must be cut:

Screen Shot 2022-08-16 at 7 34 34 PM

The connected Feather M4 and which wire to screw into high and low sides and where the reset button is:

Screen Shot 2022-08-16 at 7 24 54 PM

The male M12 CAN bus connector whose white (high) and blue (low) connectors are screwed into the Feather M4 and the male CAN bus connector is attached to the CAN bus:

Screen Shot 2022-08-16 at 7 41 38 PM

Flashing the UF2 firmware on the M4 device

We run CircuitPython on the microcontrollers, as it is well supported, well documented, and recommended by Adafruit for their microcontrollers.

CircuitPython is installed by flashing the microcontroller with the correct UF2 file, and you can tell if CircuitPython is installed if the microcontroller is mounted as a directory called CIRCUITPY whenever you connect it.

On first connection

note

The following instructions summarize the CircuitPython on Feather M4 CAN instructions. You can also check out the more generic Adafruit Installing CircuitPython instructions.

  1. Connect your feather to your computer through the USB-C port on the feather
tip

Check that the large LED is green or randomly varying colored. If it is red, you are most likely using a charge only USB-C cable.

  1. Double click the reset button to enter BOOTLOADER mode, allowing you to flash the microcontroller with a Microsoft standard flash format uf2 file. The Feather should automatically remount and show up as FTHRCANBOOT or FEATHERBOOT

    tip

    The timing of the double click can be a little tricky, so if it mounts as CIRCUITPY, just try again until it mounts as AMIGA. If you cannot get the double click timing correct, you can enter BOOTLOADER mode with the following advanced user steps:

    import microcontroller
    microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
    microcontroller.reset()
  2. You can now flash the drive with the correct CircuitPython version, with either the drag & drop or the command line method.

  3. After the flashing, feather should automatically update, reboot with the newly loaded firmware, and remount as CIRCUITPY

Flash by drag & drop

  1. Download the correct UF2 file

  2. Copy (drag & drop) the UF2 file onto the feather mounted in BOOTLOADER mode.

  3. It should automatically update and remount as CIRCUITPY

Flash UF2 by command line

These instructions show how to copy (flash) the UF2 file onto the Feather from the cloned amiga-dev-kit repo, for each OS.

From a terminal, use the command line:

cd ~/<to_your_base_directory>/amiga-dev-kit
cp circuitpy/feather_m4_can/uf2s/adafruit-circuitpython-feather_m4_can-en_US-7.3.2.uf2 \
/media/$USERNAME/FTHRCANBOOT/

On subsequent connection

When attaching a previously flashed Feather M4 device, it should automatically mount as CIRCUITPY. You can always check the our farm-ng adk uf2 dir or the Feather M4 CAN UF2 page for future stable & experimental releases.

Loading code on the Feather

Now that you have a flashed Feather, time to load some code:

  1. Copy the lib/ folder from amiga-dev-kit/circuitpy/ to the root of the Feather. The contents of lib/ are automatically added to your python path on the microcontroller.

  2. Attach a serial terminal to the feather, so you can see std out.

    screen /dev/ttyACM0
    tip

    Mu is the recommended serial console program by adafruit on their CircuitPython serial console page. Mu has a built in plotter for tuples printed to the serial console (print statements in the python code on your microcontroller).

    However, we've found that Mu can be a little unstable and freezes occasionally, so we'd recommend checking out their links for the "advanced" serial console:

  3. Now add a code.py file to the root of the Feather drive. Try one of the examples found in the Examples index, such as the Hello Main Loop example.

note

The feather should automatically reload when you drop any new code onto it.

The feather automatically runs the file named code.py and adds the contents of the lib/ directory to the python path.

You can also reload through the serial console by:

  • Cancelling the current execution with crtl+C
  • Reloading with ctrl+D

Feather M4 references