Before beginning, you should make sure you have all of the following components of the evaluation kit.
- EV Kit Board with Socketed MAX78000
- MAX32625PICO Debugger with Cables
- Olimex ARM-USB-OCD-H
- Olimex ARM-JTAG 20-10 ADAPTER
- Camera Module
- 2 USB-A to MICRO-B Cables
- 1 USB-A to USB-B Cable
- Extra Shunts
EV Kit schematic: Schematics
The MAX78000 Evaluation Kit (EV kit) comes preloaded with a MAX78000 device that has been preprogrammed with a sample application. This application blinks an LED and repeatedly outputs messages to its UART. Use this application to verify the hardware is connected and functioning properly.
-
Begin by making sure the PWR switch (SW1) is in the "OFF" position.
-
Make sure that jumper JP1 is installed. This jumper enables LED, D1.
-
Make sure that the P0_0 and P0_1 jumpers are installed on JH1. These two jumpers connect UART0 RX and TX to the console output.
-
Connect USB cables from the PC to the USB/PWR connector (CN1) of the EV kit. This cable will power the board and provide a virtual serial port connection to the MAX78000's UART.
-
Install JP7 and JP14 to enable the external boost controller.
-
Move the PWR switch to the "ON" position.
-
On your PC, open a serial terminal application (minicom, gtkterm, etc.), and connect to the virtual serial port using a baud rate of 115200 and 8-N-1 settings.
-
Reset the EV kit via SW5. You will see message from the MAX78000 appear in the terminal and LED1 (D1) on the board will begin blinking at a steady rate.
Once you see the described behavior, you know your board is functioning properly.
If you do not get the expected results, here are some things to note.
- If the terminal program you are using says 'permission denied,' try prepending
sudo
. For example, instead of typing 'gtkterm', type 'sudo gtkterm'. Alternatively, ensure your user is part of thedialout
group. - If the serial port successfully opens, but nothing appears on the console output, press RESET on the EV Kit, SW5.
- Some early versions of the EV Kit did not pre-program the Hello World example, instead, they still have a test program in flash. If you see a console output that starts with '*** CNN Test *** ', you should also see '*** PASS *** '. In this case LED D1 should also be illuminated constantly.
- If you can no longer program the MAX78000, it may be in a locked-out state. Refer to the "How to Unlock a MAX78000 That Can No Longer Be Programmed" section.
- If there are no signs-of-life (no LEDs blinking, no terminal output, no debugger communication), you can open the socket and inspect the MAX78000 to see if it is present and ball 1 is in the proper location. Additional information regarding the socket and ball 1 indicators are provided below. Be sure to power off the board before opening the socket.
There are a few tools you will need to build, load, run, and debug applications on the EV Kit.
-
The GNU Tools for ARM Embedded Processors
-
Browse to https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads and download and extract the gcc-arm-none-eabi-9-2019-q4-major package that corresponds to your system.
-
Edit your PATH variable to include the path to the arm-none-eabi directory.
-
-
The MAX78000 SDK
- The SDK is hosted on GitHub and is a submodule of the ai8x-sythesis repository. To get the SDK and all the additional supporting files, clone the ai8x-sythesis repository (including submodules) found at https://github.com/MaximIntegratedAI/ai8x-synthesis.
-
OpenOCD
-
Maxim provides pre-built binaries for the Ubuntu 18.04 LTS distribution. These should automatically be installed along with the SDK above. However, if not, the binaries can be downloaded from here.
-
You also have the option of building OpenOCD from source. Visit https://github.com/MaximIntegratedMicros/openocd and follow the instructions in the README found there.
-
Note: Linux is the preferred platform for machine learning due to the tools needed for training of the neural networks. The Windows platform can still be used for all other development outside of the machine learning.
-
Download and run the Maxim Micros SDK.
-
At the first screen that appears, click the Settings button in the lower left corner of the application.
-
Click on the Repositories tab.
-
Add three temporary repositories by clicking on Temporary repositories and clicking the Add button three times. Add the following URLs:
-
Click on the Use temporary repositories only checkbox to enable it.
-
Click the OK button and follow the on-screen instructions to complete the installation.
The SDK includes multiple examples to demonstrate the features of the MAX78000 and to show the use of the various functions available in the API. Each example includes a makefile that has been configured to work with the EV Kit. To build an example, simply change to the directory containing the example and run "make". When built, each example results in a max78000.elf (or max78000-combined.elf for projects involving both the RISC-V and ARM cores) file that can be found in the "build" directory of that example.
On Windows, the MinGW shell can be used to build examples. Start 'msys.bat' to launch the shell. The shell can be accessed from the Windows Start Menu or in the default installation directory show below.
Below is an example of how to build the "hello world" example. Other tools, such as openocd and gdb can be accessed from the MinGW shell.
Applications are loaded, debugged, and run using OpenOCD and GDB.
-
Connect the ribbon cable of the MAX32625PICO debug adapter to SWD connector (JH5) of the EV Kit.
-
Connect a USB cable between the MAX32625PICO debug adapter and the PC.
-
Change to the OpenOCD directory and launch OpenOCD with the following command:
openocd -f interface/cmsis-dap.cfg -f target/max78000.cfg -s/c/MaximSDK/Tools/OpenOCD/scripts
-
On successful connection, you will see messages as shown below.
- From another command prompt, change to the directory containing the application you would like to load.
-
Launch GDB using one of the following commands:
arm-none-eabi-gdb max78000.elf arm-none-eabi-gdb max78000-combined.elf
-
Connect GDB to OpenOCD and reset the MAX78000.
target remote localhost:3333 monitor reset halt
-
Load and verify the application.
load compare-sections
-
Reset the device and run the application:
monitor reset halt c
Follow the same steps provided in the Loading and Running Applications on the EV Kit section. While the application is running, use <CTRL-C> to interrupt the application and halt its execution. The table below lists a few of the commands available to you any time the application is halted.
Command | Short Command | Description |
---|---|---|
monitor halt | Halt the microcontroller. | |
monitor reset halt | Reset the microcontroller and immediately halt. | |
monitor max32xxx mass_erase 0 | Mass erase the flash. | |
continue | c | Continue execution. |
break <arg> | b <arg> | Set a breakpoint. Argument can be function_name, file:line_number, or *address. |
print <variable> | p | Print the value of a variable. Variable must be in current scope. |
backtrace | bt | Print contents of the stack frame. |
step | s | Execute the next instruction. |
next | n | Execute the next line of code. |
finish | f | Continue to the end of the current function. |
info reg | Print the values of the ARM registers. | |
help | Print descriptions for available commands | |
help <cmd> | Print description for given command. |
The SWD interface is unavailable for a certain number of clock cycles after reset. If the application code instructs the device to enter any low power or shutdown mode too soon, it could be difficult to reprogram the device. The following instructions help recover a device in this lockout state:
- Remove the USB cable connected to the MAX32625PICO debug adapter board.
- Remove power to the target device by powering down the EV Kit or feather board.
- Place the MAX32625PICO debug adapter in MAINTENENCE mode by holding down its button while reconnecting the USB cable to the host PC.
- The MAX32625PICO debug adapter will enumerate as a mass storage device named MAINTENANCE.
- Drag-n-Drop the provided bin file to the drive named MAINTENANCE: special DAPLINK bin file.
- Following the Drag-n-Drop, the MAX32625PICO should reboot and reconnect as a drive named DAPLINK.
- Make sure the 'Automation allowed' field is set to 1 in the DETAILS.TXT file on the DAPLINK drive. If not, follow these instructions to enable it.
- If not already connected, use the supplied ribbon cable to re-connect the MAX32625PICO debug adapter board to the target board that is locked-out and turn on power to the target device/board.
- Create an empty file named 'erase128.act' and Drag-n-Drop it onto the DAPLINK drive.
- This should mass erase the flash of the target device, allowing the device to be programmed again.
- Restore the original MAX32625PICO debug adapter board firmware by performing the following:
- Re-enter MAINTENANCE mode by disconnecting the USB cable to the MAX32625PICO debug adapter board, pressing down on the button, and then reconnecting the USB cable.
- Once the MAINTENANCE drive appears, Drag-n-Drop this file: original DAPLINK bin file.
- This will again reboot the MAX32625PICO and reconnect as DAPLINK.
At this point, the target device should be once again programmable and the MAX32625PICO adapter board restored to its original firmware.
Note: In order to avoid the locked out state to begin with, it is recommended that during code development, a delay be placed at the beginning of user code in order to give the debug adapter an opportunity to communicate with or halt the processor. A delay of 2 seconds is ideal so that the debugger can be attached manually.
The examples are separated by device type. The SDK on GitHub currently only includes the MAX78000. Therefore, the examples will be located in the Examples/MAX78000 folder. For each example, you will find the following files.
-
makefile -- This file contains the rules used to build the application with the "make" command. The binaries for each project can be removed with the "make clean" command. Use "make distclean" to remove the binaries for each project and any libraries the project depends on.
-
main.c -- This source file contains the entry point for the application.
-
*.c -- These files contain additional source code required by the example if necessary. Many of the examples reside entirely in the main.c file and will not have additional .c files.
-
*.launch, .cproject, and .project -- These files are the project files used in the Eclipse environment. They can be ignored when working with OpenOCD and GDB from the command line. (Note a few examples do not have Eclipse project files yet.) For more information on using Eclipse, see "Getting Started with Eclipse"
The SDK provides an API for working with the device's components. To use the API, you will need to include the header (*.h) files in your source code. The API header files for the MAX78000 reside in Libraries/PeriphDrivers/Include/MAX78000/. For convenience, you can include the "mxc.h" file in your source. This file includes the headers for all the supported peripheral libraries. Documentation for the functions contained in the API can be found at Libraries/PeriphDrivers/Documentation/MAX78000/index.html.
The jumpers on the board have been set to the proper position prior to shipment. There are a few that you may want to change based on the needs of your application. Note: The complete list of jumpers can be found at: jumper settings.xlsx
Jumper Name | Description |
---|---|
JH1.P0_2 | Connects the CTS signal of UART0 to the CTS signal of the USB to Serial convertor. |
JH1.P0_3 | Connects the RTS signal of UART0 to the CTS signal of the USB to Serial convertor. |
JH1.P0_0 | Connects the RX signal of UART0 to the TX signal of the USB to Serial convertor. |
JH1.P0_1 | Connects the TX signal of UART0 to the RX signal of the USB to Serial convertor. |
JH2.P0_13 | Connects the TX signal of UART1 to the RX signal of the USB to Serial convertor. |
JH2.P0_12 | Connects the RX signal of UART1 to the TX signal of the USB to Serial convertor. |
JP1 | Allows P0.2 to the control the state of LED1 (D1). |
JP2 | Allows P0.3 to the control the state of LED2 (D2). |
JP7 | Enables the CNN BOOST circuitry. When this jumper is connected, use the `--boost 2.5` command line argument to ai8xizer. This enables port 2.5 during CNN computation, which enables the current boost. |
JP13 | Can be removed to measure the CNN current. To measure current connect a low impedance current meter across this jumper. If the meter is not low impedance, resister R14 should be removed from the board. |
In rare ocassions, you may need to open the socket containing the MAX78000. If there are no signs-of-life (no LEDs blinking, no terminal output, no debugger communication), you can open the socket and inspect the MAX78000 to see if it is present and ball 1 is in the proper location. When looking at the top of the MAX78000 chip, the plus sign (+) indicates the corner containing ball 1. Ball 1 of the MAX78000 needs to match the ball 1 location of the socket, which can be determined by looking at the PCB silkscreen (see picture below). Other times this information is relevant is when the user wants to swap MAX78000s, for example, to program more than one device.
Now that proper operation of the EV Kit has been established by running a simple demo and observing the expected LED and console output, the next step is to run the included 'Hello World' of CNNs, the mnist example.
But before jumping to the mnist example, there are a couple of addtional comments about the EV Kit worth mentioning.
The EV kit features an external boost circuit that can be used to supply the CNN when under high computational load. The boost circuit is enabled by jumping JP7 and J14 as described previously and supplying the --boost 2.5
command line argument to ai8xizer.
The internal SIMO can be used to power the CNN under moderate computational loads, however, the external boot circuit is recommended during development to avoid SIMO brown-out due to transient over-current conditions which can cause the CNN to fail.
To measure the CNN current, JP13, PM BYPASS VREGI, and connect a low impedance current meter (<5 mΩ) across JP13. If the meter impedance is greater than 5 mΩ then also remove R14 from the board.