Friday, September 23, 2011

Simple USB Hello World for PIC32 (UBW32)

Here's a simple USB Hello World program that I wrote/modified/set up for the PIC32 (specifically UBW32 board, but any PIC32 will run it). It's a very quick, minimal, bare bones project, with minimal comments and clutter, formatted nicely.

Download project

Requirements:

Instructions:

1. Open the project in MPLAB (I'm using 8.76 with C32 v2.01).
2. Go to Build Options (green button on toolbar)
3. Go to Directories -> Include Search Path and edit the MAL line to your Microchip Applications Library Include folder. Go to Library Search Path and edit the line to your C32 libraries folder.
4. If you are NOT using the UBW32 board, edit HardwareProfile.h for your board (LEDs, etc). Also make sure to select your specific chip from Configure -> Select device...
5. Compile and program your board with a PICKIT/ICD/REAL ICE. This package does NOT support the bootloader because I use a REAL ICE to program my board, although you could probably very easily load it from the UBW32 bootloader by compiling it with the procdefs.ld file from the HelloWorldUSB package from the UBW32 website.
6. When the board is running the program, open a terminal program on the host computer (for example, Termite on Windows, or the "screen" command line tool on Linux/Mac OS X). Type something. You should see text sent back on the terminal.

4 comments:

  1. No useful download here. When I click on your download link I get this file "Hello_USB_1.7z" I have not been able to open it using Pkzip. What do I open it with?

    ReplyDelete
  2. Before making an assumption on the usefulness of a download, please first check that it is you that is not at fault. The file is a 7zip archive. A quick google search would have shown you that 7zip (and WinRAR) can extract *.7z archives.

    http://www.google.ca/search?q=how+to+open+7z&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

    ReplyDelete
  3. Agreed with Thomas. Although 7zip can be used with winrar and although you have kindly donated your time and efforts for the benefit of others it would have been much easier to use something like zip. I came to these pages through other links a few times and clicked away simply because of the file ext as I though they were corrupt files.

    ReplyDelete
  4. Thansks. Succeed, I was able to run it. But Windows

    New Device found
    CDC RS232 Emulation Demo.

    What should I do after this step now?
    If there are programs that must be what are they?

    ReplyDelete