Basys MX3 Migration Guide

Welcome to the Migration Guide for the Basys MX3! This guide is intended to assist in the migration from the recently retired chiKIT Pro MX4 to the new Basys MX3. See below for the list of topics included in this guide.

The Basys MX3

With a few minor exceptions, the Basys MX3 can do all that the chipKIT Pro MX4 could do plus much more. The Basys MX3 is now our number one recommended board for teaching undergraduate embedded systems courses. The additional collection of electronic devices, sensors, and actuators present on the Basys MX3 allow for teaching a wider range of embedded systems concepts, while still using the MPLAB X professional development toolset and a high-performance 32-bit microprocessor. In addition, the Basys MX3 comes with a complete set of free and open-source coursework, “Embedded Systems with PIC32MX370 and Basys MX3,” that is deep enough to teach one to two semesters of undergraduate embedded systems courses. For those less interested in the hardware implementation details presented throughout the coursework, a full set of libraries is also provided to allow the user easy access to all of the board's peripherals.

New features

  • 2 Pmod ports (16 total microcontroller I/O)
  • 8 slide switches
  • 5 Push buttons
  • 8 LEDs, 1 RGB LED
  • 4-digit 7-segment display, 16×2 LCD character display
  • 2 servo connectors
  • 1 DC/stepper motor connector
  • 1 each of a Microphone, speaker, and audio jack
  • 3 Potentiometer
  • 1 IrDA module
  • 1 Accelerometer

A visual walkaround of the Basys MX3:
Basys MX3 top Basys MX3 bottom

Course material "Embedded Systems with PIC32MX370 and Basys MX3"

Free and completely open-source course material is available! Created in coordination with an experienced embedded systems university professor, a set of seven theoretical teaching units with 15 complete labs are available for download on the Basys MX3 Resource Center. Instructors can design a new course or update an old one more easily by following our coursework exactly, or picking and choosing from our labs that range from simple digital IO to audio digital signal processing. The coursework is titled “Embedded Systems with PIC32MX370 and Basys MX3.” Completed lab solutions are available to instructors upon request.

Hardware Comparison

To scale comparison between the chipKIT Pro MX4 and the Basys MX3:

Comparison between the chipKIT Pro MX4 and the Basys MX3

Table 1. Feature Comparison

chipKIT Pro MX4 Basys MX3
PIC32MX460F512L 32-bit processor PIC32MX370F512L 32-bit processor
0 Pmod ports with PPS* functionality 2 Pmod ports with PPS* functionality
90 user accessible digital IO pins 26 user accessible digital IO pins
14 user accessible analog pins 3 user accessible analog pins
USB 2.0 OTG/device connector N/A
Power input range of 3.6 to 12 V USB or external 5 V power input
Onboard programmer/debugger Onboard programmer/debugger
USB-UART bridge USB-UART bridge
N/A 4 MB of additional SPI flash
N/A Analog Discovery 2 connector
Embedded User I/O Embedded User I/O
0 Switches 8 Switches
2 Push buttons 5 Push buttons
4 LEDs 8 LEDs, 1 RGB LED
8 Servo connectors 2 Servo connectors
N/A 1 Stepper motor or 2 DC motor driver
N/A 2×16 LCD
N/A Seven Segment display
N/A Accelerometer
N/A Speaker
N/A Audio line out
N/A MEMs Microphone
N/A FIR compatible IrDA receiver/transmitter
N/A 3 Potentiometers for analog gain control

* - Peripheral Pin Select

Table 2. Processor Comparison

PIC32MX460F512L features PIC32MX370512L features
MIPS32® M4K® core runs up to 80 MHz using onboard 8 MHz oscillator MIPS32® M4K® core runs up to 96 MHz using onboard 8 MHz oscillator
512 KB program flash 512 KB program flash
N/A 12 KB of boot flash
32 KB internal SRAM 128 KB internal SRAM
Serial Interfaces Serial Interfaces
2 UART 5 UART
2 SPI 2 SPI
2 I2C 2 I2C
5 16-bit timers/counters 5 16-bit timers/counters
5 input capture modules 5 input capture modules
5 output compare modules 5 output compare modules
2 Analog comparators 2 Analog comparators
4/2 Programmable/Dedicated DMA Channels 4/0 Programmable/Dedicated DMA channels

Software support

As with the chipKIT Pro MX4, the Basys MX3 is designed to work with MPLAB X, as is the “Embedded Systems with Pic32MX370 and Basys MX3” coursework available on the Resource Center. The Basys MX3 can also work with the Arduino IDE with the Digilent Core. Users may also use MPLAB Harmony, although Digilent does not have any Basys MX3 dedicated materials for MPLAB Harmony at this point in time.

Completed lab solutions are available to instructors upon request.

Basys MX3 Hardware Configuration

Servos, DC motors, and Stepper Motors

The Basys MX3 comes with a pair of 3-pin servo motor headers labeled SERVO 0 and SERVO 1 on the silk screen. A 6-pin spring tension header is available in the upper right hand corner of Basys MX3 board that can support two DC motors or a single stepper motor.

All types of motors used on the Basys MX3 require external power to run, either from an external 5 V power supply connected to the barrel jack connector of the Basys MX3 or, in the case of the DC motors and stepper motor, from an alternate external power supply connected to the VEXT pin present on the 6-pin motor connector. None of the motors are wired to be able to be powered from one of the microUSB ports.

The servo motor headers use the following connections for their PWM outputs:

Servo Header PIC32 Pin
Servo 0 PWM RB8
Servo 1 PWM RA15

The servo motors should also be configured to be digital outputs with the analog functionality on Servo 0 disabled:

TRISBbits.TRISB8 = 0;
ANSELBbits.ANSB8 = 0;

TRISAbits.TRISA15 = 0;

The two PWM pins for the servos are mapped to a set of OCx pins in the Basys MX3 library pack. More details about remappable pins can be found in the corresponding section of the Basys MX3 Reference Manual.

RPB8R = 0x0B; //RB8 mapped to the OC5 peripheral

RPA15R = 0x0B; //RA15 mapped to the OC4 peripheral


The DC motor and stepper motor header can use an external voltage up to 11 V and can drive a pair of 1.5 A brushed DC motors. The following pins are used for the DC/stepper motor driver (a Texas Instruments DRV8835):

Basys MX3 Pin Name Motor Driver Pin Name PIC32 Pin
Mode Mode RF1
AIN1 AIN1/APHASE RB3
AIN2 AIN2/AENBL RE8
BIN1 BIN1/BPHASE RE9
BIN2 BIN2/BENBL RB5

The following configurations are used for the pins to define them as digital outputs and to disable the analog functionality on AIN1 and BIN2:

TRISFbits.TRISF1 = 0; //set RF1 (MODE) to be an output

TRISBbits.TRISB3 = 0; //set RB3 (AIN1) to be an output
ANSELBbits.ANSB3 = 0; //disable analog functionality for RB3 (AIN1)

TRISEbits.TRISE8 = 0; //set RE8 (AIN2) to be an output

TRISEbits.TRISE9 = 0; //set RE9 (BIN1) to be an output

TRISBbits.TRISB5 = 0; //set RB5 (BIN2) to be an output
ANSELBbits.ANSB5 = 0; //disable analog functionality for RB5 (BIN2)

Seven Segment Display and LCD Screen

The Basys MX3 comes with both a seven segment display and a LCD screen, offering a nice set of built-in replacements for Pmods or other displays that may have been otherwise used.

The seven segment display can be driven by using the following pins:

Anode Pins Cathode Pins
AN0 RB12 CA RG12 CE RG15
AN1 RB13 CB RA14 CF RD7
AN2 RA9 CC RD6 CG RD13
AN3 RA10 CD RG13 DP RG14

Users will need to configure the pins to these settings:

//set all the pins as digital output and disable analog functionality as necessary
TRISBbits.TRISB12 = 0; //RB12 set as output
ANSELBbits.ANSB12 = 0; //RB12 analog functionality disabled

TRISBbits.TRISB13 = 0; //RB13 set as output
ANSELBbits.ANSB13 = 0; //RB13 analog functionality disabled

TRISAbits.TRISA9 = 0; //RA9 set as output

TRISAbits.TRISA10 = 0; //RA10 set as output

TRISGbits.TRISG12 = 0; //RG12 set as output

TRISAbits.TRISA14 = 0; //RA14 set as output

TRISDbits.TRISD6 = 0; //RD6 set as output

TRISGbits.TRISG13 = 0; //RG13 set as output

TRISGbits.TRISG15 = 0; //RG15 set as output

TRISDbits.TRISD7 = 0; //RD7 set as output

TRISDbits.TRISD13 = 0; //RD13 set as output

TRISGbits.TRISG14 = 0; //RG14 set as output

The LCD screen can be driven using the following pins:

Control pins Parallel Data Pins
DISP_RS RB15 DB0 RE0 DB4 RE4
DISP_RW RD5 DB1 RE1 DB5 RE5
DISP_RS RB15 DB2 RE2 DB6 RE6
DB3 RE3 DB7 RE7

Users will need to configure the pins to these settings:

//set up the control pins as digital outputs with no analog functionality
TRISBbits.TRISB15 = 0; // RB15 (DISP_RS) set as an output
ANSELBbits.ANSB15 = 0; // disable analog functionality on RB15 (DISP_RS)

TRISDbits.TRISD5 = 0; // RD5 (DISP_RW) set as an output

TRISDbits.TRISD4 = 0; // RD4 (DISP_EN) set as an output

//set up the data pins as digital inputs (or outputs as needed) with no analog functionality

TRISEbits.TRISE0 = 1; // RE0 (DB0) set as input (change 1 to 0 for output/write functionality)

TRISEbits.TRISE1 = 1; // RE1 (DB1) set as input (change 1 to 0 for output/write functionality)

TRISEbits.TRISE2 = 1; // RE2 (DB2) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE20 = 0; // disable analog functionality on RE2 (DB2)

TRISEbits.TRISE3 = 1; // RE3 (DB3) set as input (change 1 to 0 for output/write functionality)

TRISEbits.TRISE4 = 1; // RE4 (DB4) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE21 = 0; // disable analog functionality on RE4 (DB4)

TRISEbits.TRISE5 = 1; // RE5 (DB5) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE22 = 0; // disable analog functionality on RE5 (DB5)

TRISEbits.TRISE6 = 1; // RE6 (DB6) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE23 = 0; // disable analog functionality on RE6 (DB6)

TRISEbits.TRISE7 = 1; // RE7 (DB7) set as input (change 1 to 0 for output/write functionality)
ANSELEbits.ANSE27 = 0; // disable analog functionality on RE7 (DB7)

The backlight for the LCD screen can be enabled by using the slide switch on the Basys MX3 between the LCD screen and the seven segment display. A library for the LCD is available from the Digilent Basys MX3 library pack; alternatively users may create their own library functions based on the commands available listed in the KS0066U display controller datasheet. A list of the predefined characters built into the display controller are available in the dropdown below:

Pmod CLP Predefined Characters
pmodclp_predefinedcharacters.jpg.

Accelerometer

An on-board accelerometer, NXP's MMA8652FC, is provided on the Basys MX3 to the right of the PIC32 chip with the directions of the measured Cartesian axes indicated on the silk screen. Demos using the accelerometer are available in the Basys MX3 Library Pack.

The accelerometer can be accessed through the following pins:

PIC32 Pin Description
SCL1/RG2 I²C Clock Signal
SDA1/RG3 I²C Data Signal
RG0 Interrupt Pin

If used, the interrupt pin should be configured as a digital input:

TRISGbits.TRISG0 = 1;

Audio: speaker and microphone

The Basys MX3 comes with a electro dynamic speaker, an audio jack, and a microphone. The two audio out components receive a PWM controlled digital signal to generate multiple values between 0 V and 3.3 V and are sent through a low pass filer to construct an analog signal. A potentiometer is located near the speakers to control the audio out volume. When using the speaker, the audio signal is first passed through a 1.2 W audio power amplifier; if the line out (headphones) connector is used instead, the on-board speaker is automatically muted.

The following pin is used for outputting an audio signal:

Signal Name PIC32 pin
A_OUT RB14

The following configuration is used to set the pin as a digital output and disable the analog functionality of that pin:

TRISBbits.TRISB14 = 0; //set as an output

ANSELBbits.ANSB14 = 0; //disable analog functionality

The audio library in the Basys MX3 library pack maps RB14 to the OC1 peripheral:

RPB14RR = 0x0C; //map RB14 to OC1

The embedded microphone is a Knowles Acoustics MEMs microphone with a SNR of 94 dB at 1 kHz. Additional information about the microphone is available in the corresponding section of the Basys MX3 reference manual.

The Basys MX3 uses the embedded PIC32's 10-bit ADC to receive all of the data coming from the microphone. The following pin is used to do so:

Pin name PIC32 pin
A_MIC RB4

The following configuration for the microphone is used:

TRISBbits.TRISB4 = 1; //set the pin as an input

ANSELBbits.ANSB4 = 1; //enable analog functionality

IrDA

The IrDA module is a FIR-compatible infrared transceiver that allows users to explore a widely available part of the electromagnetic spectrum that is commonly overlooked by microcontroller platforms.

The following pins are used with the IrDA:

Pin Name PIC32 Pin
IRDA_PDOWN RG1
IR_TX RB7
IR_RX RB6

The following configurations for the IrDA are used:

TRISGbits.TRISG1 = 0; //set RG1 (IRDA_PDOWN) as an output

TRISBbits.TRISB7 = 0; //set RB7 (IR_TX) as an output
ANSELBbits.ANSB7 = 0; //disable analog functionality on RB7 (IR_TX)

TRISBbits.TRISB6 = 1; //set RB6 (IR_RX) as an input
ANSELBbits.ANSB6 = 0; //disable analog functionality on RB6 (IR_RX)

I2C

The Basys MX3 provides access to one of the two I²C ports available on the embedded PIC32 chip, I2C1. This bus is shared by the accelerometer present on the Basys MX3 and already incorporates 2.2 kOhm pullup resistors on the SDA and SCL lines, eliminating the need for most other I2C devices that may be daisy-chained onto this bus to provide their own pullup resistors. The I2C1 interface on the Basys MX3 is not remappable, so there is no concern about having to properly configure the I2C pins.

The following pins are used for the I2C interface and are physically available on the 2×4 pin header located to the right of the seven segment display:

Pin Name PIC32 pin
SCL SCL1/RG2
SDA SDA1/RG3

SPI

There are two SPI ports available on the PIC32MX370F512L; the SPI2 is available to use on the Pmod A host port. The SPI1 is dedicated to the SPI flash memory present on the Basys MX3. By default the PIC32 has both SPI interfaces set to be a slave device, so pin remapping will be needed to make it a master device. The Basys MX3 library pack includes a library to work with the SPI2 interface.

The pins to use the SPI2 (as a slave device) are as follows:

Pmod pin names Function PIC32 Pin
JA1 SPI2_SS RC2
JA2 SPI2_SI RC1
JA3 SPI2_SO RC4
JA4 SPI2_SCK RG6

The following configuration is used to set SPI2 as a master SPI:

RPC1R = 0x06; // RC1 mapped to output SDO2

SDI2R = 0x0A; // input SDI2R mapped to pin RC4

ANSELGbits.ANSB16 = 0; //disable analog functionality on RG6 (SPI2_SCK)

The flash memory is a 4 MB Spansion S25FL132 that contains 1024 sectors of 4 KB. The Basys MX3 library pack provides a demo to interact with the SPI flash.

The following pins are used by default for SPI1:

Pin Name PIC32 Pin
SPI_CE RF8
SPI_SI RF2
SPI_SO RF7
SPI_SCK RF6

The following configurations are used to make SPI1 a master bus:

RPF2R = 0x08; //map RF2 to the SDO1 output

SDI1R = 0x0F; //map the SDI1 input to RF7

UART

The PIC32MX370F512L present on the Basys MX3 provides five UART interfaces, aptly named UART1, UART2, UART3, UART4, and UART5. Each of the UART interfaces can operate in 2-wire or 4-wire mode; 2-wire mode only uses the receive and transmit signals (RX and TX) while the 4-wire mode also includes the request-to-send and clear-to-send (RTS and CTS) signals.

The Basys MX3 includes a USB-UART serial converter, available via the microUSB port labeled UART just below the microUSB port labeled DEBUG. This serial converter can be mapped to either use UART4 or UART5; all of the other UART interfaces can be mapped to either one of the Pmod host ports.

The following pins are used in the aforementioned USB-UART serial converter:

Pin Name PIC32 Pin
UART_TX RF12
UART_RX RF13

The following configuration is used in the UART library available in the Basys MX3 library pack for the USB-UART bridge:

TRISFbits.TRISF12 = 0; //RF12 (UART_TX) set as an output
RPF12R = 0x02; //map RF12 to the UART4 output (U4TX)

TRISFbits.TRISF13 = 1; //RF13 (UART_RX) set as an input
U4RXR = 0x09; //map the UART4 input (U4RX) to RF13

Connectors

Pmod Ports

chipKIT Pro MX4 Basys MX3
Pmod Pin PIC32 Pin Pmod Pin PIC32 Pin Pmod Pin PIC32 Pin PPS Functionality
JA-01 PMD0/RE0 JF-01 SCL1/INT3/RA14 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 INT3/U5CTS/IC3/T2CK/OC3
JB-08 PMRD/CN14/RD5 JH-08 SDO1/OC1/INT0/RD0 JB8 RPD0/RD0 INT1/U5TX/IC1/T3CK/OC1/OC2
JB-09 PMWR/OC5/CN13/RD4 JH-09 IC1/RTCC/RD8 JB9 AN24/RPD1/RD1 INT1/U5RX/IC1/T3CK/OC1/OC2
JB-10 PMALH/PMA1/AN14/RB14 JH-10 PMD13/CN19/RD13 JB10 SOSCI/RPC13/RC13 INT4/U5RTS/IC4/T5CK/OC4
JC-01 TRD1/RG12 JJ-01 PGD1/EMUD1/AN0/CN2/RB0
JC-02 TRD0/RG13 JJ-02 PGC1/EMUC1/AN1/CN3/RB1
JC-03 TRD2/RG14 JJ-03 C2IN-/AN2/CN4/RB2
JC-04 RG15 JJ-04 C2IN+/AN3/CN5/RB3
JC-07 PMD8/RG0 JJ-07 C1IN-/AN4/CN6/RB4
JC-08 PMD9/RG1 JJ-08 VBUSON/C1IN+/AN5/CN7/RB5
JC-09 PMD11/RF0 JJ-09 C1OUT/AN8/RB8
JC-10 PMD10/RF1 JJ-10 C2OUT/AN9/RB9
JD-01 PMD15/CN16/RD7 JK-01 CVrefout/PMA13/AN10/RB10
JD-02 OC2/RD1 JK-02 PMA12/AN11/RB11
JD-03 IC2/SS1/RD9 JK-03 PMA11/AN12/RB12
JD-04 T2CK/RC1 JK-04 PMA10/AN13/RB13
JD-07 PMD14/CN15/RD6 JK-07 PMA7/Vref-/CVref-/RA9
JD-08 OC3/RD2 JK-08 PMA6/Vref+/CVref+/RA10
JD-09 IC3/SCK1/PMCS2/PMA15/RD10 JK-09 PMD12/IC5/RD12
JD-10 T3CK/RC2 JK-10 SDI1/T5CK/RC4
JE-01 CN20/U1CTS/RD14
JE-02 U1TX/RF8
JE-03 U1RX/RF2
JE-04 U1RTS/BCLK1/CN21/RD15
JE-07 INT2/RE9
JE-08 OC4/RD3
JE-09 IC4/PMCS1/PMA14/RD11
JE-10 T4CK/RC3

Analog Discovery 2 Connector

Beneath the LCD screen on the underside of the PCB is a 2×15 pin header, providing access to a variety of analog and digital signals that can be easily viewed via an oscilloscope or logic analyzer. The following pins are present on the header with pins 21 through 24 left unconnected:

Pin # Silk Screen Name PIC32 Pin Connected to / Module Corresponding Analog Discovery Pin
1 SPI_SI RPF2/RF2 SPI_SI / Flash memory Digital IO 7
2 BIN2 AN5/C1INA/RPB5/RB5 BIN2 / Motor driver Digital IO 15
3 SPI_CE RPF8/RF8 SPI_CE / Flash memory Digital IO 6
4 BIN1 RPE9/RE9 BIN1 / Motor driver Digital IO 14
5 SPI_SO RPF7/RF7 SPI_SO / Flash memory Digital IO 5
6 AIN2 RPE8/RE8 AIN2 / Motor driver Digital IO 13
7 SPI_SCK RPF6/SCK1/INT0/RF6 SPI_SCK / Flash memory Digital IO 4
8 AIN1 PGED3/AN3/C2INA/RPB3/RB3 AIN1 / Motor driver Digital IO 12
9 D_RS AN15/RPB15/PMA0/CTED6/RB15 DISP_RS / LCD module Digital IO 3
10 IRRX PGEC2/AN6/RPB6/RB6 IR_RX / IrDA module Digital IO 11
11 DISP_R/W RPD5/PMRD/RD5 DISP_R/W / LCD module Digital IO 2
12 IRTX PGED2/AN7/RPB7/CTED3/RB7 IR_TX / IrDA module Digital IO 10
13 D_EN RPD4/PMWR/RD4 DISP_EN / LCD module Digital IO 1
14 URX RPF13/RF13 UART_RX / UART Digital IO 9
15 DB0 PMD0/RE0 DB0 / LCD module Digital IO 0
16 UTX RPF12/RF12 UART_TX / UART Digital IO 8
17 T1 RPF0/PMD11/RF0 BTNC / TRIG_1 / User Buttons T1
18 T2 AN9/RPB9/CTED4/RB9 SW7 / TRIG_2 / User Switches T2
19 GND GND GND
20 GND GND GND
25 GND GND GND
26 GND GND GND
27 AOP analog pin A_OUT_P / Audio out Scope 2+
28 AON analog pin A_OUT_N / Audio out Scope 2-
29 AMIC AN4/C1INB/RB4 A_MIC / Microphone Scope 1+
30 GND GND Scope 1-