Programming the Device

From Open Circuits

Jump to: navigation, search

Description on how to use dsPicProgrammer to download firmware to DsPIC30F 5011 Development Board

Contents

[edit] Loading Bootloader (Once only)

[edit] Hardware Requirement

  1. PC with USB port (with Windows)
  2. ICD2 Programmer
  3. Target Board
  4. 5V Power Supply

[edit] Software Requirement

  1. MPLAB IDE v7.50: v7.60 is not compatible with our current ICD2 Programmers. There are consistent "Devices cannot be founded" warnings. See manual for details.

[edit] Files

  1. dsPicBootloader (bl_$(MODEL).hex).

[edit] Procedure

Loading Bootloader
Step Remarks
Install MPLAB IDE
  • Do NOT connect ICD 2 (via USB) to PC
  • Execute MPLAB vX.XX Install.exe
Install USB Driver
  • Follow the instruction in (C:\Program Files\Microchip\MPLAB IDE\ICD2\Drivers\Ddicd2.htm)
Select Target Chip
  • Run MPLAB IDE on PC
  • Select: Configure>Select Devices...
  • Choose the correct dsPic model
Load Bootloader
  • Select: File>Import...
  • Select bl_$(MODEL).hex
ICD 2 <-> PC
  • Plug-in ICD 2 to PC via USB cable
Target <-> ICD 2
  • Connect six pin cable to target board. Beware of the pin assignments. Only pin 1 - 5 are used.
  • Power-up the target.
ICD 2 <-> PC
  • Select: Programmer>Select Programmer>MPLAB ICD 2
  • If this is the first time the ICD 2 is connected to PC, MPLAB IDE will automatically download the required OS to ICD 2, wait until it has finished
  • If you have not connected and powered up the target, you might see Warnings on invalid device IDs, and/or running self tests.
  • See results of self test if necessary: Programmer>Settings, Status Tab. Refer to ICD2 User's Guide Chapter 7.
Start Programming
  • Select: Programmer>Program
  • Wait until finishes
Finishing
  • Power-down the Target
  • Select: Programmer>Select Programmer>None
  • Unplug USB cable


[edit] Download and Loading Firmware

[edit] dsPicProgrammer User Guide

dsPicProgrammerUserGuide_V2.0.1

[edit] Hardware Requirement

  1. PC (Linux/Windows) with COM Port OR USB-COM converter cable
  2. Target Board (with bootloader)
  3. 5V Power Supply

[edit] Software Requirement

  1. dsPicProgrammer

[edit] Files

  1. Application hex file (e.g. app.hex)

[edit] Procedure

[edit] Setup COM Port

  • Connect your USB-COM converter cable to your computer
  • Or Using a real COM PORT



[edit] Find out your COM port Number

  • Go to Control Panel \ Device Manager



  • Find out your Device COM Port Number



[edit] Get the Dspic Programmer



[edit] Download Firmware

  • Save your .hex file(foo.hex) to the folder called firmware.
  • Run dsPicProgrammer.bat (Windows) / dsPicProgrammer.sh (linux)
    • Make sure your device is connected through a "Direct RS232 Cable" to PC Serial Port.



  • Choose a COM port
  • Choose a baudrate
115200 is communication speed [in bps]



  • Choose a .hex file



  • Press start
  • Then press Yes to confirm programming the device



  • The status during programming



  • The programming have been completed, press OK the close the message box

[edit] Troubleshooting

[edit] Invalid COM Port

  • In case of selecting an invalid COM port, you should see the error message:
    gnu.io.NoSuchPortException: Choosing COM Port Error
    Image:3 1 com err.JPG

  • Solution: check the COM port ID, or close any programs that are using the COM Port

[edit] Missing firmware file

  • In case of selecting a firmware file that does not exist, you should see the error message:
    java.io.FileNotFoundException: foo1.hex <The system cannot find the file specified>
    Image:3 2 file err.JPG

  • Solution: check the file path

[edit] Missing RXTX driver

  • In case of missing the RXTX driver, you should see the error message:
    Exception in thread “main” java.lang.NoClassDefFoundError: gnu/io/UnsupportedCommOperationException
    Image:3 3 rxtx err.JPG

  • Solution:
    • Copy RXTXcomm.jar to /dsPicProgrammer/rxtx/lib
    • Copy rxtxSerial.dll to /dsPicProgrammer/rxtx/bin (Window)
    • Copy librxtxSerial.so to /dsPicProgrammer/rxtx/bin (Linux)

[edit] Missing JAVA

  • In case of missing JAVA JDK or JRE, an error message will be prompted.
  • Solution:
    • Copy the contents under directory C:/Program Files/Java/jre$(VERSION)/ to /dsPicProgrammer/jre

[edit] Further reading

Personal tools