1 = Demo Example = 2 3 This example demonstrates UART communication using UART1. Interrupt conditions 4 on the UART peripheral are handled, input is tested, output is produced, and 5 upon receiving the `0` character, DMA-driven output is initiated. 6 7 The DMA-driven output demonstrates mechanisms employed by some of the [[VGA 8 Output Examples|VGA examples]]. A channel is enabled by the interrupt handler 9 and its transfers each initiated by a timer; this should cause text to be 10 transmitted relatively slowly across the serial connection... 11 12 {{{ 13 Hello! 14 }}} 15 16 When this first channel completes all transfers, two other channels chained to 17 it are enabled. Another timer then causes their transfers to be initiated. 18 Since these two channels effectively compete for access to the UART 19 peripheral, their transfers are interleaved. Regardless of the configuration 20 of the example, more text should be transmitted relatively slowly... 21 22 {{{ 23 And once again, hello! 24 }}} 25 26 Although such DMA channel interleaving is rather exotic, other techniques 27 employed by the example are likely to be applicable elsewhere. 28 29 To communicate with the PIC32, observe the wiring instructions and then 30 establish a serial connection at 115200 baud. For example, using the `screen` 31 program on a system exposing the serial connection through a device associated 32 with a USB port: 33 34 {{{ 35 screen /dev/ttyUSB0 115200 36 }}} 37 38 The precise device naming details will vary between systems and depend on the 39 nature of the USB devices already connected. Where a programming device such 40 as an Arduino board is in use, it may already be associated with `ttyUSB0`, 41 thus exposing the PIC32 itself as `ttyUSB1`. 42 43 == Hardware Details == 44 45 The pin usage of this solution is documented below. 46 47 === PIC32MX270F256B-50I/SP Pin Assignments === 48 49 {{{ 50 MCLR# 1 \/ 28 51 RA0 2 27 52 RA1 3 26 RB15/U1TX 53 RB0 4 25 RB14 54 RB1 5 24 RB13/U1RX 55 RB2 6 23 56 RB3 7 22 RB11/PGEC2 57 8 21 RB10/PGED2 58 RA2 9 20 59 RA3 10 19 60 RB4 11 18 RB9 61 12 17 RB8 62 13 16 RB7 63 RB5 14 15 64 }}} 65 66 Note that RB6 is not available on pin 15 on this device (it is needed for VBUS 67 unlike the MX170 variant). 68 69 === UART Connections === 70 71 UART1 is exposed by the RB13 and RB15 pins.