DsPIC30F 5011 Development Board

This project aims to provide the development tools for building a multi-purpose MCU board. Description is based on Microchip dsPic33FJ256GP506 (was dsPic30F5011), but information provided in this wiki may give useful directions for developing similar embedded systems with different platforms.

Features of dsPic33FJ256GP506
* For reference only, subject to change
 * 3.0 to 3.3 V
 * Up to 40 MIPs
 * Maximum current sink/source for I/O pins: 4 mA
 * 16-bit arithmetics
 * DSP Instruction Set
 * Dual programming techniques: ICSP and RTSP
 * Memory
 * 256 KB flash (86K instructions)
 * 16 KB RAM (incl. 2 KB DMA RAM)
 * No EEPROM
 * Communications ports
 * UART
 * I2C: up to 1 Mbit/s
 * SPI
 * ADC
 * 10-bit A/D, 1.1 Msps
 * 12-bit A/D, 500 ksps
 * No DAC (PWMs only)
 * Pin-to-pin compatible with other dsPICs

Forums

 * Microchip: Official forum by Microchip
 * See MPLAB ICD 2, MPLAB IDE, MPLAB C30 Compiler, ASM30, Link30 forum, dsPIC30F Topics, dsPic33 topics
 * HI-TECH Software Forum: Discussion on dsPICC, a C compiler developed by HI-TECH
 * FreeRTOS Real Time Kernel: Open Discussion and Support on FreeRTOS
 * Nabble: MicroControllers - GNUPIC

Code Examples

 * Microchip Example Codes for dsPic

Related Development

 * Ethernet Module
 * Modulation Plugin

Programming Methods

 * There are 2 programming methods: In-Circuit Serial Programming (ICSP) and Run-Time Self-Programming (RTSP)
 * ICSP allows the devices to be programmed after being placed in a circuit board.
 * RTSP allows the devices to be programmed when an embedded program is already in operation.

ICSP: External Programmer (ICD2)

 * Two types of ICSP are available: ICSP and Enhanced ICSP. Both of them require setting MCLR# to VIHH (9V – 13.25V).
 * Standard ICSP
 * Use external programmer (e.g. MPLAB® ICD 2, MPLAB® PM3 or PRO MATE® II) only.
 * Required low-level programming to erase, program and verify the chip.
 * Slower, because codes are serially executed.


 * Enhanced ICSP
 * Use external programmer and Programming Executive (PE).
 * PE is stored in the on-chip memory.
 * PE allows faster programming.
 * PE can be downloaded to the chip by external programmer using the standard ICSP method.
 * PE contains a small command set to erase, program and verify the chip, avoiding the need of low-level programming.

Hardware Interface
* For reference only (exclude shipping), subject to change

Software Interface

 * The program can be written and compiled in an Integrated Development Environment (IDE) using either Assembly or C. The complied codes are then loaded to the device through the external programmer.


 * 1) Full-featured for the first 60 days. After 60 days, some code optimization functions are disabled. The compiler will continue to function after 60 days, but code size may increase.

RTSP: COM Port (Bootloader)

 * RTSP works in normal voltage (MCLR# no need to raise to VIHH).
 * No literature has mentioned the incorporation of Programming Executive (PE). Presumably, since Enhanced ICSP needs to set MCLR# to VIHH, RTSP cannot use PE.
 * Refer to bootloader section.

Windows



 * C-Compiler, Assembler and Linker are under GNU license.
 * MPLAB C30 C Compiler (*.c -> *.s)
 * MPLAB ASM30 Assembler (*.s -> *.o)
 * MPLAB LINK30 Linker (*.o -> *.bin)


 * PA optimizer, simulator, runtime libraries, header files, include files, and linker scripts are not covered by GNU. Reference is here.


 * Microchip has integrated ASM30, LINK30, assembly header files, linker scripts in MPLAB IDE, which is free for download.
 * MPLAB C30 costs US$895. A 60-day free student version is also available. After 60-days, the optimizer is automatically disabled, while other tools can still function properly.


 * C-libraries contained in C30 includes (Refer to 16-Bit Language Tools Libraries from Microchip).

Linux



 * C Compiler, Assembler and Linker are under GNU license.
 * The code can be downloaded from Microchip at here.
 * Current MPLAB ASM30 Assembler: v2.04
 * Current MPLAB C30 Compiler: v2.04
 * Important Note: Only the compiler is free. The header files and library are owned by Microchip.

Conversion Example

 * Pre-install these packages: dpkg-dev, debhelper, bison, flex, sysutils, gcc-3.3, fakeroot
 * cmd: sudo apt-get install dpkg-dev debhelper bison flex sysutils gcc-3.3 fakeroot
 * Download and unzip template: pic30-3.01.tar.bz2
 * Download assembler: mplabalc30v3_01_A.tar.gz. Save under /pic30-3.01/pic30-binutils-3.01/upstream/
 * Download c-compiler: mplabc30v3_01_A.tgz. Save under /pic30-3.01/pic30-gcc-3.01/upstream/
 * Install MPLAB_C30_v3_01-StudentEdition under Windows
 * Copy directories /include, /lib, /support, and /bin/c30_device.info to pic30-3.01/pic30-support-3.01/upstream/
 * Pack pic30-binutils into deb file
 * goto /pic30-3.01/pic30-binutils-3.01/
 * type cmd: dpkg-buildpackage -rfakeroot -b
 * Install pic30-binutils_3.01-1_i386.deb
 * type cmd: sudo dpkg -i pic30-binutils_3.01-1_i386.deb
 * Pack pic30-gcc-3.01 into deb file
 * goto /pic30-3.01/pic30-gcc-3.01/
 * type cmd: dpkg-buildpackage -rfakeroot -b
 * Install pic30-gcc_3.01-1_i386.deb
 * type cmd: sudo dpkg -i pic30-gcc_3.01-1_i386.deb
 * Pack support files into deb file
 * goto /pic30-3.01/pic30-support-3.01/
 * type cmd: dpkg-buildpackage -rfakeroot -b
 * Install pic30-support_3.01-1_all.deb
 * type cmd: sudo dpkg -i pic30-support_3.01-1_all.deb
 * After installation, locations of
 * C-Header (*.h): /usr/pic30-elf/include
 * Libraries (*.a): /usr/pic30-elf/lib
 * Assembly header (*.inc): /usr/share/pic30-support/inc
 * Linkerscript (*.gld): /usr/share/pic30-support/gld

Burning Program Codes to Target Board

 * 1) Use 'dspicprg and dspicdmp' utilities developed by Homer Reid to burn hex code (*.hex) to devices. See Reference here. Through serial port only?
 * 2) Use Piklab IDE. Details on file format not known.
 * 3) Use MPLAB IDE to burn hex code (*.hex) to devices.

Code Optimization

 * Below is a comparsion between different optimization levels for the project including drivers for 2 projects.

Driver Development

 * Description on developing drivers with POSIX API

Bootloader Development

 * Description on concepts and development on bootloader
 * Description on dsPicProgrammer to download firmware via bootloader

Programming the Device

 * Description on how to use dsPicProgrammer to download firmware to dspic