Difference between revisions of "NU32v2: Serial Communication with the PC"

From Mech
Jump to navigationJump to search
Line 13: Line 13:


== Library Functions ==
== Library Functions ==
[[Media:Example.ogg | This code]] contains functions to read and write over the serial port.


NU32v2.h contains function prototypes, in addition to the serial functions, to initialize the LEDs on the NU32v2 board as well as the bootloader button.


NU32v2.c contains the functions. Neither this file or the .h file need to be changed to work.

The functions that control the serial communication are:
*InitSerial()
*WriteString()
*PutCharacter()

NU32v2_serial_example.c contains example code that shows how to uses the functions. It also contains the ISR for UART3, with an example of how to receive characters.


== Sample Code ==
== Sample Code ==

Revision as of 16:29, 25 January 2011

Under construction NDM 1/25/2010

The NU32v2 has the ability to talk directly with a computer over a virtual serial port connection. This ability can be used to debug code, transfer data, and interact with the microcontroller using a computer.

Overview

The NU32v2 uses an on board FT233RL chip from FTDI to convert RS-232 serial communication to USB. Using drivers from FTDI, the communication can be opened by any program that can access a serial port. On the NU32v2 side, sample code has been created to enable the Serial module on the PIC32. Using this code you can write strings to the computer, and generate an interrupt when characters are received. On the computer side, several programs that can access the serial connection are discussed, including PuTTY, Processing and MATLAB.

Details

The FT232RL chip is hardwired to the UART3 module on the PIC32M795F512L. The Receive (RX) pin, G7, and Transmit (TX) pin, G8, are also brought out to the sides of the NU32v2 board.

The NU32v2 Serial Bootloader uses the UART3 module at 115200 baud, as does the code below, but this can be changed as desired.

Library Functions

This code contains functions to read and write over the serial port.

NU32v2.h contains function prototypes, in addition to the serial functions, to initialize the LEDs on the NU32v2 board as well as the bootloader button.

NU32v2.c contains the functions. Neither this file or the .h file need to be changed to work.

The functions that control the serial communication are:

  • InitSerial()
  • WriteString()
  • PutCharacter()

NU32v2_serial_example.c contains example code that shows how to uses the functions. It also contains the ISR for UART3, with an example of how to receive characters.

Sample Code

The example

code

And more

PuTTY

Processing

MATLAB

More Information

More detailed information on how the the serial module on the PIC32 can be configured is on this page (DNE).