1 = VGA Output Example (Parallel Mode Transfers) = 2 3 This example demonstrates the generation of an analogue [[VGA Signal Output| 4 VGA]] signal from a PIC32 microcontroller using the parallel mode (parallel 5 master port, PMP) peripheral. The result is not entirely satisfactory: 6 7 * Pixels are very narrow unless buffered using a flip-flop driven by the 8 peripheral, this being a characteristic of the way the peripheral works, it 9 normally being used to drive memory and display controllers. 10 11 * Introducing a flip-flop means that the final pixel from the pixel data 12 remains asserted and must be reset using a second DMA channel. 13 14 * Every fourth pixel is wider than the others, this apparently being an 15 artefact of the DMA transfer mechanism. 16 17 It might be possible introduce some kind of delay to the write strobe (PMWR) 18 and even out the pixel widths, but this has not been investigated. 19 20 It appears to be the case that the system and peripheral clock frequencies 21 need to be matched. In this example, a frequency of 48MHz has been chosen. 22 23 == Hardware Details == 24 25 The pin usage of this solution is documented below. 26 27 === PIC32MX270F256B-50I/SP Pin Assignments === 28 29 {{{ 30 MCLR# 1 \/ 28 31 D7/PMD7/RA0 2 27 32 D6/PMD6/RA1 3 26 RB15/U1TX 33 D0/PMD0/RB0 4 25 RB14 34 D1/PMD1/RB1 5 24 RB13/(PMRD)/U1RX 35 D2/PMD2/RB2 6 23 36 PMWR/RB3 7 22 RB11/PGEC2 37 8 21 RB10/PGEC3 38 RA2 9 20 39 (PMA0)/RA3 10 19 40 HSYNC/OC1/RB4 11 18 RB9/PMD3/D3 41 12 17 RB8/PMD4/D4 42 13 16 RB7/PMD5/D5 43 VSYNC/OC2/RB5 14 15 44 }}} 45 46 Note that RB6 is not available on pin 15 on this device (it is needed for VBUS 47 unlike the MX170 variant). 48 49 === UART Connections === 50 51 UART1 is exposed by the RB13 and RB15 pins. 52 53 === Data Signal Routing === 54 55 A flip-flop is used to buffer the outputs: 56 57 {{{ 58 Dn -> 74HC273:Dn 59 74HC273:Qn -> Qn 60 VCC -> 74HC273:MR# 61 PMWR -> 74HC273:CP 62 }}} 63 64 For two bits of intensity, two bits per colour channel: 65 66 {{{ 67 Q7 -> 2200R -> I 68 Q6 -> 4700R -> I 69 70 I -> diode -> R 71 I -> diode -> G 72 I -> diode -> B 73 74 Q5 -> 470R -> R 75 Q4 -> 1000R -> R 76 Q3 -> 470R -> G 77 Q2 -> 1000R -> G 78 Q1 -> 470R -> B 79 Q0 -> 1000R -> B 80 81 HSYNC -> HS 82 VSYNC -> VS 83 }}}