Board Sparkfun UBW32 - RetroBSD/retrobsd GitHub Wiki
UBW32 board (schematics, PCB, Eagle files) has been designed by Brian Schmalz, and manufactured by Sparkfun. Latest revision is based on Microchip PIC32MX795 microcontroller.
Features:
- PIC32MX795 microcontroller 80 MHz (MIPS architecture)
- 78 usable i/o pins
- miniUSB connector, with power supply option
- footprint for USB-host connector
- power select switch: from USB or from external source
- external power connector with diode protection and fuse 500mA
- 5 LEDs
- 3 buttons
Memory:
- 512 kbytes of Flash memory
- 12 kbytes of additional boot Flash memory
- 128 kbytes of RAM
Digital outputs can sink or source up to 18 mA. A rich set of peripheral functions is available: UART, SPI, I2C, ADC, timers. Two internal oscillators available: 8 MHz and 32 kHz. Power can be sourced from miniUSB, or from external power supply +7.6 ... 15 VDC.
Buttons:
- RESET - restart the processor
- PRG - enter bootloader mode (on RESET)
- USER - user defined action
LEDs:
- USB (green) - software controlled, blinks on USB activity
- LED1 (white) - software controlled
- LED2 (red) - software controlled
- LED3 (yellow) - software controlled
- PWR (blue) - lights when power is supplied
Original UBW32 Firmware
Originally, board comes with preinstalled software, which is called UBW32 Firmware. When attached to computer via miniUSB cable, blue LED is lighting and green LED is blinking: UBW32 Firmware is active. Computer detects the board as a USB-device:
ID 04d8:000a
bInterfaceClass 2 Communications
idVendor 0x04d8 Microchip Technology, Inc.
idProduct 0x000a CDC RS-232 Emulation Demo
UBW32 Firmware Implements a virtual COM-port interface. For example, in Linux you can access it as a serial device /dev/ttyACM0. On command "V {Enter}" you will get a Firmware version number:
$ kermit -l /dev/ttyACM0 -b 115200 -c
V
UBW32 Version 1.0
OK
Firmware commands:
Example | Reply | Description |
---|---|---|
C,0,0,0,0,65535,0,0 | OK | Configure direction of ports A, B, C, D, E, F, G. In bitmasks, 1 is an input, a 0 is an output. |
O,0,0,131,0,0,0,0 | OK | Write values to ports A, B, C, D, E, F, G. |
I | I,50943,64479,24606,65535,01015,12607,62403 | Get values from ports A, B, C, D, E, F, G. |
V | UBW32 Version 1.0 | Get version of Firmware. |
R | OK | Reset to default state, all ports as inputs. |
PD,B,2,1 | OK | Set pin direction. |
PI,C,6 | PI,1 | Get pin value. |
PO,A,3,0 | OK | Set pin value. |
CU,1,0 | OK | Configure generic parameters of Firmware. |
BL | (none) | Enter boot loader mode. |
T1,200,4 | OK | Run test #1 - running 1 on all ports. |
HID Bootloader
User program can be loaded into Flash memory via miniUSB port, using preinstalled boot loader. The bootloader is placed in separate Flash memory region, and is not erased when loading user program. Documentation and source codes of bootloader are available on UBW32 page.
To enter load mode, you should press and hold PRG button, and then press RESET button. In this mode, blue, yellow and red LEDs will light, and white and green LEDs will blink. The board will be detected as USB-device with following parameters:
ID 04d8:003c
bInterfaceClass 3 Human Interface Device
idVendor 0x04d8 Microchip Technology, Inc.
idProduct 0x003c USB HID Bootloader
PIC32 configuration registers, used by bootloader:
DEVCFG0 | Description |
---|---|
CP = OFF | Generic code protection disabled. |
BWP = OFF | Boot flash protection disabled. |
PWP = OFF | Program flash protection disabled. |
ICESEL = ICS_PGx2 | ICE/debugger uses signals PGC2/PGD2. |
DEBUG = OFF | Background debugger disabled. |
DEVCFG1 | Description |
---|---|
FWDTEN = OFF | Watchdog timer disabled. |
WDTPS = PS1 | Watchdog timer scale 1:1 |
FCKSM = CSECME | Clock switching enabled. |
FPBDIV = DIV_1 | PBCLK = SYSCLK / 1 |
OSCIOFNC = OFF | CLKO output disabled. |
POSCMOD = HS | Primary oscillator in HS mode. |
IESO = ON | Two-speed startup enabled. |
FSOSCEN = OFF | Secondary oscillator disabled. |
FNOSC = PRIPLL | Primary oscillator with PLL. |
DEVCFG2 | Description |
---|---|
FPLLODIV = DIV_1 | PLL output divider 1:1. |
UPLLEN = ON | USB PLL enabled. |
UPLLIDIV = DIV_2 | USB PLL input divider 1:2. |
FPLLMUL = MUL_20 | PLL multiplier 20x. |
FPLLIDIV = DIV_2 | PLL input divider 1:2. |
For user programs, a Flash memory region 9d005000-9d07ffff
is allocated.
Program is started from address 9d006000
.
For exception handler, address 9d005200
is recommended.
pic32prog utility can be used to download HEX files to the board. For example:
pic32prog test.hex
Signals
Connector | Signal | Function | Connector | Signal | Function |
---|---|---|---|---|---|
J3 / 1 | GND | J4 / 40 | GND | ||
J3 / 2 | +5V | J4 / 39 | +5V | ||
J3 / 3 | +3.3V | J4 / 38 | +3.3V | ||
J3 / 4 | RD8 | J4 / 37 | RA15 | SDA1, INT4 | |
J3 / 5 | RD9 | /SS1 | J4 / 36 | RA14 | SCL1, INT3 |
J3 / 6 | RD10 | SCK1 | J4 / 35 | RA5 | TDO |
J3 / 7 | RD11 | J4 / 34 | RA4 | TDI | |
J3 / 8 | RD0 | SDO1, INT0 | J4 / 33 | RA3 | SDA2 |
J3 / 9 | RC13 | J4 / 32 | RA2 | SCL2 | |
J3 / 10 | RC14 | J4 / 31 | RF8 | U1TX | |
J3 / 11 | RD1 | J4 / 30 | RF2 | U1RX | |
J3 / 12 | RD2 | J4 / 29 | RF5 | U2TX | |
J3 / 13 | RD3 | J4 / 28 | RF4 | U2RX | |
J3 / 14 | RD12 | J4 / 27 | RD15 | /U1RTS, U4TX | |
J3 / 15 | RD13 | J4 / 26 | RD14 | /U1CTS, U4RX | |
J3 / 16 | RD4 | J4 / 25 | RB15 | ||
J3 / 17 | RD5 | J4 / 24 | RB14 | ||
J3 / 18 | RD6 | J4 / 23 | RB13 | ||
J3 / 19 | RD7 | J4 / 22 | RB12 | ||
J3 / 20 | RF0 | J4 / 21 | RF12 | /U2CTS, U5RX | |
J3 / 21 | RF1 | J4 / 20 | RF13 | /U2RTS, U5TX | |
J3 / 22 | RG1 | J4 / 19 | RA1 | TCK | |
J3 / 23 | RG0 | J4 / 18 | RB11 | ||
J3 / 24 | RA6 | J4 / 17 | RB10 | ||
J3 / 25 | RA7 | J4 / 16 | RB9 | ||
J3 / 26 | RE0 | J4 / 15 | RB8 | ||
J3 / 27 | RE1 | J4 / 14 | RA10 | ||
J3 / 28 | RG14 | J4 / 13 | RA9 | ||
J3 / 29 | RG12 | J4 / 12 | RB3 | ||
J3 / 30 | RG13 | J4 / 11 | RB4 | ||
J3 / 31 | RE2 | J4 / 10 | RB5 | ||
J3 / 32 | RE3 | J4 / 9 | RE9 | INT2 | |
J3 / 33 | RE4 | J4 / 8 | RE8 | INT1 | |
J3 / 34 | RG15 | J4 / 7 | RA0 | TMS | |
J3 / 35 | E5 | J4 / 6 | RG9 | /SS2, U6RX | |
J3 / 36 | RE6 | J4 / 5 | VPP | /MCLR, reset | |
J3 / 37 | RE7 | J4 / 4 | RG8 | SDO2, U3TX | |
J3 / 38 | RC1 | J4 / 3 | RG7 | SDI2, U3RX | |
J3 / 39 | RC2 | J4 / 2 | RG6 | SCK2, U6TX | |
J3 / 40 | RC3 | J4 / 1 | RC4 | SDI1 |
Connector | Signal | Function |
---|---|---|
J5 / 1 | VPP | /MCLR, reset |
J5 / 2 | +3.3V | |
J5 / 3 | GND | |
J5 / 4 | PGD | B7, PGD2 |
J5 / 5 | PGC | B6, PGC2 |
J5 / 6 | B2 | |
J5 / 7 | B1 | PGC1 |
J5 / 8 | B0 | PGD1 |
Extensions
To use UART1 port, a Sparkfun FTDI Basic Breakout adapter can be used. How to attach it:
- Switch power output of FTDI Basic Breakout to +5V. Cut and sold the jumper on the bottom size of board.
- Connect GND to JP1/GND.
- Connect 3V3 to J1/+.
- Connect TXO to J4/30 = F2 U1RX.
- Connect RXI to J4/31 = F8 U1TX.
For Flash-cards, a Sparkfun Breakout Board for SD-MMC Cards is recommended. List of connections:
UBW32 board | Signal | SD/MMC board |
---|---|---|
J4 / 13 - A9 | SD-CS# | CS |
J3 / 8 - D0 | SDO1 | DI |
J5 / 2 - +3.3V | +3.3V | VCC |
J3 / 6 - D10 | SCK1 | CLK |
J5 / 3 - GND | GND | GND |
J4 / 1 - C4 | SDI1 | DO |