microcontrollers supported Many on-board modules Easy-add extra boards Two connectors for each port Fast USB 2.0 programmer and PIC24®, dsPIC33® and pic32® Multimedia peripherals mikroBUS™ sockets Amazing Connectivity In-Circuit Debugger USER'S GUIDE v7 To our valued customers Providing our users the ability to easily switch between architectures on the same development board has always been an engineering challenge for us. But we have mastered this technology during the past decade and now we present you the revolutionary board that combines support for three different microcontroller families: Microchip's dsPIC33®, PIC24® and PIC32®. EasyPIC Fusion™ v7 is the ultimate board for all of your 16-bit and 32-bit PIC projects. You made the right choice. Nebojsa Matic, Owner and General Manager of mikroElektronika Table of contents Introduction Communication Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 04 USB-UART A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 It's good to know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 05 USB-UART B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 USB host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 USB device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Ethernet communication . . . . . . . . . . . . . . . . . . . . . . . . . . 26 CAN communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Power Supply Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 06 Supported MCUs Multimedia MCU cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 08 Audio Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Other supported MCU cards . . . . . . . . . . . . . . . . . . . . . . . 11 microSD card slot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 TFT display 320x240 pixels . . . . . . . . . . . . . . . . . . . . . . . 30 Touch panel controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Navigation switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Piezo Buzzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Programmer/debugger On-board programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Installing programmer drivers . . . . . . . . . . . . . . . . . . . . . . 14 Programming software . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 mikroICD™ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Connectivity Other Modules DS1820 - Digital Temperature Sensor . . . . . . . . . . . . . . 34 LM35 - Analog Temperature Sensor . . . . . . . . . . . . . . . . 35 Serial Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Input/Output Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 I2C EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 mikroBUS™ sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 ADC inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Click™ Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Additional GNDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 page 3 introduction Introduction EasyPIC Fusion™ v7 is the first board of it's kind to combine support for three popular Microchip® low-power microcontroller architectures in one place. We wanted to put as many peripherals on the board as possible, to cover many internal modules. We have gone through a process of fine tuning the board performance, and used 4-layer PCB to achieve maximum efficiency. Finally, it had met all of our expectations, and even exceeded in some. We present you the board which is powerful, well organized, with on-board programmer and debugger and is ready to be your strong ally in development. EasyPIC Fusion™ v7 development Team One board for three architectures Everything is already here Ready for all kinds of development For easier connections dsPIC33, PIC24 & PIC32 mikroProg on board Multimedia peripherals mikroBUS™ support For the first time we combined the power of three separate boards in one ultimate board for high performance Microchip MCUs. Developers now have the new scalability like never before. Powerful on-board mikroProg™ programmer and In-Circuit debugger supports over 65 microcontrollers. It features fast enhanced programming and rich set of debugging instructions. TFT 320x240 with touch panel, stereo mp3 codec, audio input and output, navigation switch and microSD card slot make a perfect set of peripherals for multimedia development. This innovative new socket allows you to use dozens of Click accessory boards with almost no hardware adjustments. Adding new functionality to your device was never so easy. page 4 ™ v7 introduction It's good to know System Specifications power consumption power supply 7–23V AC or 9–32V DC or via USB cable (5V DC) weight ~460g (1.014 lbs) board dimensions 266 x 220mm (10.47 x 8.66 inch) ~143mA (all modules are disconnected) L NA IO RE WA FT SO • • • • • • • • • • • • • • • • • • MIK ROC ILERS , MI COMP KRO BA SIC ,M IK RO PA SC AL • • • • • • • • • • • • • • • • • S VER DRI EXAM PLE S CO • PRODUCT DVD RS LE PI M AD DI T Package contains www.mikroe.com www.libstock.com • S TIC MA HE • • • • • • • • • • • • • PROGRAMM ERS A ND D EBU GG ER S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • • • • • M IK IA ED M RO Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. DS AR BO •• • • • • • • • RD S• • • •• • • • SC • • • •• • • • • • D EVELO PME UALS NT MAN BO A 1 Damage resistant protective box 2 EasyMx PRO™ v7 board in antistatic bag 3 USB cable 4 DVD with examples and documentation 5 User Manual 6 Board schematic 7 mikroProg Suite™ manual 8 mikroICD™ manual v7 page 5 power supply Power supply Board contains switching power supply that creates stable voltage and current levels necessary for powering each part of the board. Power supply section contains specialized MC33269DT3.3 power regulator which creates VCC3.3V power supply, thus making the board capable of supporting 3.3V microcontrollers. Power supply unit can be powered in three different ways: with USB power supply (CN20), using external adapters via adapter connector (CN30) or additional screw terminals (CN31). External adapter voltage levels must be in range of 9-32V DC and 7-23V AC. Use jumper J9 to specify which power source you are using. Upon providing the power using either external adapters or USB power source you can turn on power supply by using SWITCH 1 (Figure 3-1). Power LED ON (Green) indicates the presence of power supply. 1 3 VCC-5V E15 10uF 2 Vout Vin MC33269DT3.3 C38 100nF VCC-USB VCC-5V REG1 GND Figure 3-1: Power supply unit of EasyPIC Fusion™ v7 C37 100nF CN20 VCC VCC-3.3V LD78 FP1 POWER E16 10uF C5 100nF R68 2K2 1 2 3 GND 4 USB 3.3V VOLTAGE REGULATOR SWITCH1 1N4007 1N4007 CN30 D7 SMCJ13 C39 1uF R69 10K 1 2 3 4 U8 ST1S10 VINA INH FB GND PGND SW VINSW SYNC 8 7 6 5 1 D6 3 1N4007 D5 E CN31 1N4007 E17 220uF/35V/LESR - D4 2 VCC-5V D3 VCC-USB L1 C45 22uF 10uH J9 R84 4K7 R74 100K C40 22uF C42 22uF R76 20K Figure 3-2: Power supply unit schematic page 6 v7 Board power supply creates stable 3.3V necessary for operation of the microcontroller and all on-board modules. Power capacity: power supply Power supply: via DC connector or screw terminals (7V to 23V AC or 9V to 32V DC), or via USB cable (5V DC) up to 500mA with USB, and up to 600mA with external power supply How to power the board? 1. With USB cable 1 2 3 4 5 6 Set J9 jumper to USB position To power the board with USB cable, place jumper J9 in USB position. You can then plug in the USB cable as shown on images 1 and 2 , and turn the power switch ON. 2. Using adapter Set J9 jumper to EXT position To power the board via adapter connector, place jumper J9 in EXT position. You can then plug in the adapter cable as shown on images 3 and 4 , and turn the power switch ON. 3. With laboratory power supply Set J9 jumper to EXT position To power the board using screw terminals, place jumper J9 in EXT position. You can then screw-on the cables in the screw terminals as shown on images 5 and 6 , and turn the power switch ON. v7 page 7 supported MCUs MCU cards Microcontrollers are supported using specialized MCU cards containing 104 pins, which are placed into the on-board female MCU socket. There are several types of cards which cover PIC24x, dsPIC33x, PIC32MX4xx, PIC32MX7xx microcontroller families in 100-pin TQFP packages. One of the MCU cards is shown on Figure 4-1. It contains PIC32MX795F512L microcontroller with on-chip peripherals and is a great choice for both beginners and professionals. After testing and building the final program, this card can also be taken out of the board socket and used in your final device. 1 PIC32MX795F512L has 80MHz maximum frequency, 512K bytes of program memory (flash), 128K bytes of data memory. It has integrated Ethernet controller, USB (OTG, Host, Device), 85 General purpose I/O pins, 5 16-bit timers, 16 Analog Input pins (ADC), 6 UARTs, internal 8 MHz and 32kHz oscillators, internal Real time clock (RTC), 5 I2C, 4 SPI and 2 CAN controllers. It also contains 3 analog comparators and two programming and debugging interfaces. 2 8MHz crystal oscillator. We carefully chose the most convenient crystal value that provides clock frequency which can be used directly, or with the PLL multipliers to create higher MCU clock value. MCU card also contains 32.768 kHz crystal oscillator which provides external clock waveform for RTCC module. 3 USB communications lines. These two jumpers, when in USB position, connect D+ and D- lines of the on-board USB connector with RG2 and RG3 microcontroller pins. Since PIC32MX795F512L supports USB, jumpers are in USB position. 4 Ethernet transceiver. This MCU card contains single-chip Ethernet physical (PHY) layer transceiver which provides additional Ethernet functionality to PIC32MX795F512L controller 5 25MHz crystal oscillator. This crystal oscillator is connected to external Ethernet module. 5 4 1 2 3 Figure 4-1: MCU card with PIC32MX795F512L page 8 v7 C2 100nF C3 100nF VCC C4 100nF VCC VCC C5 100nF C6 100nF RC4 RC2 RE7 RE5 VCC VCC supported MCUs C1 100nF VCC VCC RB0 RB2 RB4 RE9 RA0 MCLR# VCC 103 101 99 97 95 93 91 89 87 85 83 81 79 VCC C7 100nF VCC RG15 RG9_ETH MCLR# RG8_ETH RG7_RST# RG6 RC4 RC3 RC2 RC1 RE7 RE6 RE5 RB0 RB1 RB2 RB3 RB4 RB5 RE9 RE8 RA0 GND RB1 RB3 RB5 RE8 RG6 RC3 RC1 RE6 RG15 GND 104 102 100 98 96 94 92 90 88 86 84 82 80 HD3 VCC VCC E2 10uF 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 E1 10uF RB14 RD14 RF4 VCC 1 3 5 7 9 11 13 15 17 19 21 23 25 2 4 6 8 10 12 14 16 18 20 22 24 26 TXP RXP LED2 RB7 RA10 RB9 RA1 RF12 RG2 RG2/DP USB-D_P RB15 RF5 GND J1 HD1 RG3 RG3/DM USB-D_N RXP RXN TXP TXN J2 12K1 VCC FP1 LAN8720A GND RXD1 RXD0 VDDIO RXER CRS_DV MDIO X3 VDD2A LED2 LED1 XTAL2 XTAL1 VDDCR 25MHz R1 TXD1 18 TXD0 17 16 TXEN 15 RG7_RST# 14 REFCLK 13 RD11_MDC TXD1 TXD0 TXEN RST# nINT MDC 1M VCC RXD1 RXD0 CRS_DV TXD1 TXD0 TXEN REFCLK R4 R5 R6 R7 R8 R9 R10 27 RB13_ETH 27 RB12_ETH 27 RG8_ETH 27 RF0_ETH 27 RF1_ETH 27 RD6_ETH 27 RG9_ETH OSC1 OSC2 RG3/DM RG2/DP RA2 RA3 RA4 RA5 C11 22pF 8MHz C9 22pF X1 X2 C10 22pF R3 1K5 E5 10uF 77 VCC 75 RE4 73 RE2 71 RG12 69 RE1 67 RA7 65 RG0 63 61 59 RD4 57 RD12 55 RD3 53 RD1 78 76 74 72 70 68 66 64 RD7 62 RD5 60 RD13 58 RD2 56 GND 54 HD4 32.768KHz VCC VCC E3 10uF E4 10uF C8 22pF 27 29 31 33 35 37 39 41 43 45 47 49 51 HD2 VCC RG2 USB-D_P USB-VBUS NC MCU_MISO RA2 RA4 RA14 C13 100nF RB11_RXER CRS_DV RD8_MDIO C12 2.2uF Vcap RD7 RD6_ETH RD5 RD4 RD13 RD12 RD3 RD2 RD1 GND RE3 RG13 RG14 RE0 RA6 RG1 7 8 9 10 11 12 C16 22pF RXD1 RXD0 C15 22pF RE4 RE3 RE2 RG13 RG12 RG14 RE1 RE0 RA7 RA6 RG0 RG1 RF1_ETH RF0_ETH RD10 RD0 VCC 1 2 3 4 5 6 Rbias RXP RXN TXP TXN VDD1A U2 LED2 LED1 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 28 GND RG3 30 USB-D_N 32 34 NC RF3 36 38 MC U_SCK 40 MCU_MOSI RA3 42 RA5 44 46 RA15 RD9 48 50 52 GND 100nF RF3 MCU_MISO MCU_MOSI USB-VBUS 24 23 22 21 20 19 C14 RD14 MCU_SCK RF4 RF5 PIC32MX795F512L RE4 RE3 RE2 RG13 RG12 RG14 RE1 RE0 RA7 RA6 RG0 RG1 RF1 RF0 VDD VCAP/VDDCORE RD7 RD6 RD5 RD4 RD13 RD12 RD3 RD2 RD1 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 R2 RA1 RF13 RF12 RB12_ETH RB13_ETH RB14 RB15 RB6 RB7 RA9 RA10 AVDD AVSS RB8 RB9 RB10 RB11 VSS VDD RA1 RF13 RF12 RB12 RB13 RB14 RB15 VSS VDD RD14 RD15 RF4 RF5 RA14 RA15 RD8_MDIO RD9 RD10 RD11_MDC RD0 OSC32_IN OSC32_OUT TXN RXN LED1 RB6 RA9 RB8 RB10 RF13 RB8 RB9 RB10 RB11_RXER 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 RF3 RF2 RF8 VBUS VUSB D-/RG3 D+/RG2 RA2 RA3 RA4 RA5 VDD OSC1/RC12 OSC2/RC15 VSS RA14 RA15 RD8 RD9 RD10 RD11 RD0 SOSCI/RC13 SOSCO/RC14 VSS RB6 RB7 RA9 RA10 RB0 RB1 RB2 RB3 RB4 RB5 RE9 RE8 RA0 VDD VSS RG9 MCLR RG8 RG7 RG6 RC4 RC3 RC2 RC1 RE7 RE6 RE5 VDD RG15 U1 Figure 4-2: ETHERNET MCU card schematic v7 page 9 supported MCUs How to properly place your MCU card into the socket? Before you plug the microcontroller card into the socket, make sure that the power supply is turned off. Images below show how to correctly plug the MCU card. First make sure that MCU card orientation matches the silkscreen outline on the 1 Figure 4-3: On-board MCU socket has silkscreen markings which will help you to correctly orient the MCU card before inserting. page 10 EasyPIC Fusion™ v7 board MCU socket. Place the MCU card over the socket so each male header is properly aligned with the female socket as shown in Figure 4-4. Then put the MCU card slowly down until all the pins match the socket. Check again if 2 Figure 4-4: Place the MCU card on the socket so that pins are aligned correctly. everything is placed correctly and press the MCU card until it is completely plugged into the socket as shown in Figure 4-5. If done correctly all pins should be fully inserted. Only now you can turn on the power supply. 3 Figure 4-5 Properly placed MCU card. v7 supported MCUs Other supported MCU cards mikroElektronika currently offers total of five populated MCU cards with different microcontrollers. You can also purchase empty PCB cards that you can populate on your own and solder any supported microcontroller you need in your development. There are total of five empty PCB cards available. This way your EasyPIC Fusion™ v7 board becomes truly flexible and reliable tool for almost any of your PIC24®, dsPIC33® and PIC32® projects. MCU cards can also be used in your final devices. For complete list of currently available MCU cards, please visit the board webpage: http://www.mikroe.com/easypic-fusion/ Empty 100-pin TQFP PT ETHERNET MCU CARD Empty 100-pin TQFP PT MCU CARD 1 Empty 100-pin TQFP PF MCU CARD 1 Empty 100-pin TQFP PT MCU CARD 2 Empty 100-pin TQFP PF MCU CARD 2 100-pin TQFP PT ETHERNET CARD with PIC32MX795F512L 100-pin TQFP PT MCU CARD 1 with PIC24EP512GU810 100-pin TQFP PT MCU CARD 1 with dsPIC33EP512MU810 100-pin TQFP PT MCU CARD 2 with PIC32MX460F512L 100-pin TQFP PF MCU CARD 2 with dsPIC33FJ256GP710A v7 page 11 programming On-board programmer What is mikroProg™? mikroProg™ is a fast USB 2.0 programmer with mikroICD™ hardware In-Circuit Debugger. Smart engineering allows mikroProg™ to support all PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC30/33, PIC32 MCU families in a single programmer! It supports over 570 microcontrollers from Microchip®. Outstanding performance and easy operation are among it's top features. How do I start? In order to start using mikroProg™ and program your microcontroller, you just have to follow two simple steps: 1. Install the necessary software - Install USB drivers (Page 14) - Install mikroProg Suite™ for PIC® software (Page 15) 2. Power up the board, and you are ready to go. - Plug in the programmer USB cable - Turn on Power switch - LINK and POWER LED should light up. Figure 5-1: mikroProg™ is well protected under metal casing Why so many LEDs? Three LEDs indicate specific programmer operation, Figure 5-1. Link LED lights up when USB link is established with your PC, Active LED lights up when programmer is active. Data LED lights up when data is being transferred between the programmer and PC software (compiler or mikroProg Suite™ for PIC®). Programming with ICD2/ICD3 EasyPIC Fusion™ v7 is equipped with RJ-12 connector compatible with Microchip® ICD2® and ICD3® external programmers. You can either use the on-board mikroProg™ programmer or external programming tools as long as you use only one of them at the same time. Insert your ICD programmer cable into connector CN33, as shown in images 1 and 2 . page 12 1 2 v7 programming VCC-3.3V LINK ACTIVE VCC-3.3V DATA VCC-3.3V LD64 VCC-5V VCC-USB CN20 VCC-5V LD65 FP1 USBDN-CON LD66 USBDP-CON R2 2K2 R59 4K7 C5 100nF R61 6K8 LED-DATA LED-ACT LED-USB MCLR# RB6 RB7 VCC-3.3V C35 100nF MCU-VPP MCU-PGC MCU-PGD VCC-3.3V R45 10K T68 1 D- 2 D+ 3 GND 4 USB VCC-3.3V CN33 1 2 3 4 5 6 MCU-PGC MCU-PGD MCU-VPP R47 220 C31 100nF RESET VCC MCLR# ICD DATA BUS Figure 5-2: mikroProg™ block schematic v7 page 13 L NA IO • RE WA FT SO • • • • • • • • • • • • • • • • • MIK ROC ILERS , MI COMP KRO BA SIC ,M IK RO PA SC AL • • • • • • • • • • • • • • • • • S VER DRI EXAM PLE S CO • PRODUCT DVD RS LE PI M AD DI T On-board mikroProg™ requires drivers in order to work. Drivers are located on the Product DVD that you received with the EasyPIC Fusion™ v7: www.mikroe.com www.libstock.com • S TIC MA HE • • • • • • • • • • • • • PROGRAMM ERS A ND D EBU GG ER S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • • • DVD://download/eng/software/ development-tools/universal/ mikroprog/mikroprog_for_pic_ drivers_v200.zip • •• • • • • • • • RD S• • • •• • • • • • D EVELO PME UALS NT MAN BO A le on Product D! DS AR BO • • •• • • • SC • lab M IK Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. • Av ai IA ED M RO programming Installing programmer drivers DV When you locate the drivers, please extract files from the ZIP archive. Folder with extracted files contains sub folders with drivers for different operating systems. Depending on which operating system you use, choose adequate folder and open it. In the opened folder you should be able to locate the driver setup file. Double click on setup file to begin installation of the programmer drivers. page 14 Step 1 - Start Installation Step 2 - Accept EULA Welcome screen of the installation. Just click on Next button to proceed. Carefully read End User License Agreement. If you agree with it, click Next to proceed. Step 3 - Installing drivers Drivers are installed automatically in a matter of seconds. Step 4 - Finish installation You will be informed if the drivers are installed correctly. Click on Finish button to end installation process. v7 mikroProg Suite™ for PIC® L NA IO • RE WA FT SO • • • • • • • • • • • • • • • • • MIK ROC ILERS , MI COMP KRO BA SIC ,M IK RO PA SC AL CO • • • • • • • • • • • • S VER DRI EXAM PLE S • • • • • • www.mikroe.com www.libstock.com DVD://download/eng/software/development-tools/universal/ mikroprog/mikroprog_suite_for_pic_v225.zip • S TIC MA HE • • • • • • • • • • • • • PROGRAMM ERS A ND D EBU GG ER S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • • • • DS AR BO •• • • • • • • • RD S• • • •• • • • • • D EVELO PME UALS NT MAN BO A le on Produc D! IA ED M RO • • •• • • • SC • lab M IK Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. • Av ai Installation wizard - 6 simple steps RS LE PI M AD DI T On-board mikroProg™ programmer requires special programming software called mikroProg Suite™ for PIC®. This software is used for programming all of Microchip® microcontroller families, including PIC10, PIC12, PIC16, PIC18, dsPIC30/33, PIC24 and PIC32. Software has intuitive interface and SingleClick™ programming technology. To begin, first locate the installation archive on the Product DVD: PRODUCT DVD programming Programming software V tD After downloading, extract the package and double click the executable setup file, to start installation. Step 1 - Start Installation Step 3 - Install for All users or current user Step 5 - Installation in progress v7 Step 2 - Accept EULA and continue Step 4 - Choose destination folder Step 6 - Finish Installation page 15 programming mikroICD - In Circuit Debugger ™ What is Debugging? Every developer comes to a point where he has to monitor the code execution in order to find errors in the code, or simply to see if everything is going as planed. This hunt for bugs or errors in the code is called debugging. There are two ways to do this: one is the software simulation, which enables you to simulate what is supposed to be happening on the microcontroller as your code lines are executed and the other, most reliable one, is monitoring the code execution on the MCU itself. And this latter one is called In-Circuit debugging. "In-Circuit" means that it is the real deal - code executes right on the target device. How do I use the debugger? When you build your project for debugging, and program the microcontroller with this HEX file, you can start the debugger using [F9] command. Compiler will change layout to debugging view, and a blue line will mark where code execution is currently paused. Use debugging toolbar in the Watch Window to guide the program execution, and stop anytime. Add the desired variables to Watch and monitor their values. Complete guide to using mikroICD™ with your compiler is provided within the EasyPIC Fusion™ v7 package. mikroICD ™ bugger in-circuit de Figure 5-3: mikroICD™ manual explains debugging thoroughly What is mikroICD™? The on-board mikroProg™ programmer supports mikroICD™ - a highly effective tool for a Real-Time debugging on hardware level. The mikroICD™ debugger enables you to execute your program on the host PIC microcontroller and view variable values, Special Function Registers (SFR), RAM, CODE and EEPROM memory along with the mikroICD™ code execution on hardware. Whether you are a beginner, or a professional, this powerful tool, with intuitive interface and convenient set of commands will enable you to track down bugs quickly. mikroICD™ is one of the fastest, and most reliable debugging tools on the market. Supported Compilers All MikroElektronika compilers, mikroC, mikroBasic and mikroPascal for PIC®, dsPIC® and PIC32® natively support mikroICD™. Specialized mikroICD DLL module allows compilers to exploit the full potential of fast hardware debugging. Along with compilers, make sure to install the appropriate programmer drivers and mikroProg Suite for PIC® programming software, as described on pages 14 and 15. page 16 Figure 5-4: mikroC PRO for PIC32® compiler in debugging view, with SFR registers in Watch Window v7 Here is a short overview of which debugging commands are supported in mikroElektronika compilers. You can see what each command does, and what are their shortcuts when you are in debugging mode. It will give you some general picture of what your debugger can do. Toolbar Icon Command Name Shortcut Description Start Debugger [F9] Starts Debugger. Run/Pause Debugger [F6] Run/Pause Debugger. Stop Debugger [Ctrl + F2] Stops Debugger. Step Into [F7] Executes the current program line, then halts. If the executed program line calls another routine, the debugger steps into the routine and halts after executing the first instruction within it. Step Over [F8] Executes the current program line, then halts. If the executed program line calls another routine, the debugger will not step into it. The whole routine will be executed and the debugger halts at the first instruction following the call. Step Out [Ctrl + F8] Executes all remaining program lines within the subroutine. The debugger halts immediately upon exiting the subroutine. Run To Cursor [F4] Executes the program until reaching the cursor position. Toggle Breakpoint [F5] Toggle breakpoints option sets new breakpoints or removes those already set at the current cursor position. Show/Hide breakpoints [Shift+F4] Shows/Hides window with all breakpoints Clears breakpoints [Shift+Ctrl+F5] Delete selected breakpoints Jump to interrupt [F2] Opens window with available interrupts (doesn't work in mikroICD™ mode) v7 page 17 programming mikroICD™ commands connectivity Input/Output Group One of the most distinctive features of EasyPIC Fusion™ v7 are it’s Input/Output PORT groups. They add so much to the connectivity potential of the board. Everything is grouped together Figure 6-1: I/O group contains PORT header, tri-state pull PORT headers, PORT buttons and PORT LEDs next to each other and grouped up/down DIP switch, buttons and LEDs all in one place together. It makes development easier, and the entire EasyPIC Fusion™ v7 cleaner and well organized. We have also provided an additional PORT headers on the right side of the board, so you can access any pin you want from that side of the board too. Tri-state pull-up/down DIP switches RF13 RF12 RF5 RF4 RF3 RF2 RF1 RF0 N O RF1 RF3 RF5 RF13 CN16 VCC-3.3V LD51 T49 T50 RF0 T48 RN51 10K RF0 LD50 RF1 T47 RN50 10K RF1 LD49 RF2 T46 RN49 10K RF2 LD48 RF3 LD47 RN48 10K RF3 T42 RN47 10K RF4 LD46 RF5 RF13 T41 RN46 10K RF4 LD42 RF12 LD41 RN42 10K RF5 RN41 10K RF12 J7 RF0 RF2 RF4 RF12 VCC-3.3V CN13 SW7 SW15 RF13 J6 VCC-3.3V _ RF1 RF3 RF5 RF13 8 220 RF0 RF2 RF4 RF12 +1 2 3 4 5 6 7 8 7 R27 220 PORTF_LED 6 SW10 5 R26 4 _ VCC-3.3V VCC BUTTON PRESS LEVEL GND UP PULL DOWN 3 +1 2 3 4 5 6 7 8 Button press level tri-state DIP switch is used to determine which logic level will be applied to port pins when buttons are pressed 4k7 2 PORTF_LEVEL DATA BUS 1 Figure 6-2: Tri-state DIP switch on PORTF Tri-state DIP switches, like SW7 on Figure 6-3, are used to enable 4K7 pull-up or pull-down resistor on any desired port pin. Each of these switches has three states: 1. middle position disables both pull-up and pull-down feature from the PORT pin 2. up position connects the resistor in pull-up state to the selected pin 3. down position connects the resistor in pull-down state to the selected PORT pin. T51 Figure 6-3: Schematic of the single I/O group connected to microcontroller PORTF page 18 v7 connectivity Headers Buttons LEDs With enhanced connectivity as one of the key features of EasyPIC Fusion™ v7, we have provided two connection headers for each PORT. I/O PORT group contains one male IDC10 header (like CN13 Figure 6-3). There is one more IDC10 header available on the right side of the board, next to DIP switches (like CN16 on Figure 6-3). These headers can be used to connect accessory boards with IDC10 female sockets. LED (Light-Emitting Diode) is a highly efficient electronic 78 77 76 75 RE4 light source. When 74 73 72 71 SMD LED connecting LEDs, 70 69 68 67 66 65 it is necessary to 64 63 62 61 place a current 60 59 SMD resistor 58 57 limiting resistor in 56 55 limiting current 54 53 through the LED series so that LEDs are provided with the current value specified by the manufacturer. The current varies from 0.2mA to 20mA, depending on the type of the LED and the manufacturer. The EasyPIC Fusion™ v7 board uses low-current LEDs with typical current consumption of 0.2mA or 0.3mA. Board contains 68 LEDs which can be used for visual indication of the logic state on PORT pins. An active LED indicates that a logic high (1) is present on the pin. In order to enable PORT LEDs, it is Figure 6-6: SW15.1 necessary to enable the through SW15.8 corresponding DIP switch switches are used to on SW15 (Figure 6-6). enable PORT LEDs The logic state of all microcontroller digital inputs may be changed using push buttons. Tristate DIP switch Figure 6-5: Button press SW10 is available level DIP switch (tri-state) for selecting which logic state will be applied to corresponding MCU pin when button is pressed, for each I/O port separately. If you, for example, place SW10.6 in VCC position, then pressing of any push button in PORTF I/O group will apply logic one to the appropriate microcontroller pin. The same goes for GND. If DIP switch is in the middle position neither of two logic states will be applied to the appropriate microcontroller pin. You can disable pin protection 220ohm resistors by placing jumpers J6 and J7, which will connect your push buttons directly to VCC or GND. Be aware that doing so you may accidentally damage MCU in case of wrong usage. Reset Button Figure 6-4: IDC10 male headers enable easy connection with mikroElektronika accessory boards v7 In the far upper right section of the board, there is a RESET button, which can be used to manually reset the microcontroller. page 19 connectivity mikroBUS sockets ™ Easier connectivity and simple configuration are imperative in modern electronic devices. Success of the USB standard comes from it’s simplicity of usage and high and reliable data transfer rates. As we in mikroElektronika see it, Plug-and-Play devices with minimum settings are the future in embedded world too. This is why our engineers have come up with a simple, but brilliant pinout with lines that most of today’s accessory boards require, which almost completely eliminates the need of additional hardware settings. We called this new standard the mikroBUS™. EasyPIC Fusion™ v7 supports mikroBUS™ with two on-board sockets. As you can see, there are no additional DIP switches, or jumper selections. Everything is already routed to the most appropriate pins of the microcontroller sockets. mikroBUS™ host connector Each mikroBUS™ host connector consists of two 1x8 female headers containing pins that are most likely to be used in the target accessory board. There are three groups of communication pins: SPI, UART and I2C communication. There are also single pins for PWM, Interrupt, Analog input, Reset and Chip Select. Pinout contains two power groups: +5V and GND on one header and +3.3V and GND on the other 1x8 header. mikroBUS™ pinout explained AN - Analog pin RST - Reset pin CS - SPI Chip Select line SCK - SPI Clock line MISO - SPI Slave Output line MOSI - SPI Slave Input line +3.3V - VCC-3.3V power line GND - Reference Ground PWM - PWM output line INT - Hardware Interrupt line RX - UART Receive line TX - UART Transmit line SCL - I2C Clock line SDA - I2C Data line +5V - VCC-5V power line GND - Reference Ground DATA BUS RB8 RC1 RC2 SCK MISO MOSI VCC-3.3V AN RST CS SCK MISO MOSI 3.3V GND 1 PWM INT RX TX SCL SDA 5V GND RD0 RE8 RF4 RF5 RA2 RA3 VCC-5V RB9 RC3 RC4 SCK MISO MOSI VCC-3.3V AN RST CS SCK MISO MOSI 3.3V GND 2 PWM INT RX TX SCL SDA 5V GND RD1 RE9 RF12 RF13 RA2 RA3 VCC-5V Figure 7-1: mikroBUS™ connection schematic Integrate mikroBUS™ in your design mikroBUS™ is not made to be only a part of our development boards. You can freely place mikroBUS™ host connectors in your final PCB designs, as long as you clearly mark them with mikroBUS™ logo and footprint specifications. For more information, logo artwork and PCB files visit our web site: http://www.mikroe.com/mikrobus page 20 v7 connectivity Opto click™ BEE click™ BlueTooth click™ WiFi PLUS click™ GPS click™ Click Boards are plug-n-play! ™ mikroElektronika portfolio of over 200 accessory boards is now enriched by an additional set of mikroBUS™ compatible Click Boards™. Almost each month several new Click boards™ are released. It is our intention to provide the community with as much of these boards as possible, so you will be able to expand your EasyPIC Fusion™ v7 with additional functionality with literally LightHz click™ DAC click™ v7 zero hardware configuration. Just plug and play. Visit the Click boards™ web page for the complete list of available boards: http://www.mikroe.com/click/ DIGIPOT click™ SHT1x click™ THERMO click™ page 21 The UART (universal asynchronous receiver/trans mitter) is one of the most common ways of exchanging data between the MCU and peripheral components. It is a serial protocol with separate transmit and receive lines, and can be used for full-duplex communication. Both sides must be initialized with the same baud rate, otherwise the data will not be received correctly. Enabling USB-UART A L NA IO RE WA FT SO • • • • • • • • • EXAM PLE S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • S TIC MA HE • • • DS AR BO •• • • • • • • • RD S• • • •• • • • • • D EVELO PME UALS NT MAN BO A le on Product D! M IK • • •• • • • SC • lab • DV C7 100nF E1 10uF U2 6 7 8 TXD OSCO DTR# OSCI RTS# TEST VCCIO AGND RXD NC RI# CBUS0 GND CBUS1 FT232RL GND NC DSR# VCC DCD# RESET# CTS# GND CBUS4 3V3OUT CBUS2 USBDM CBUS3 USBDP 28 27 26 25 24 23 22 21 20 19 18 17 16 15 VCC-3.3V VCC-3.3V R14 2K2 R15 4K7 RX-LED1 TX-LED1 RX TX LD69 LD70 CN22 VCC 1 D- 2 D+ 3 R18 1K0 GND 4 USB B FTDI1-D_N FTDI1-D_P US B UA RT A CONNECTOR N O • 5 page 22 Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. VCC-5V VCC-5V FT232RL • • • • 4 Figure 8-1: USB-UART A connection schematic PROGRAMM ERS A ND D EBU GG ER S 3 SW12 • • • • • • • • • 2 DATA BUS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 S VER DRI 1 TX-FTDI1 RX-FTDI1 • • • • • • ai VCC-3.3V RF5 RF4 • C6 100nF CO • VCC-5V BA SIC ,M IK RO PA SC AL PRODUCT DVD www.mikroe.com www.libstock.com Av VCC-3.3V DVD://download/eng/software/development-tools/ universal/ftdi/vcp_drivers.zip • • • • • • • • • MIK ROC ILERS , MI COMP KRO • USB-UART A communication is being done through a FT232RL controller, USB connector (CN22), and microcontroller UART module. To establish this connection, you must connect RX and TX lines of the FT232RL to the appropriate pins of the microcontroller. This selection is done using DIP switches SW12.1 and SW12.2. In order to enable USB-UART A communication you must push SW12.1 and SW12.2 to ON position. This connects the RX and TX lines to RF5 and RF4 microcontroller pins. • • • • • • • • • RS LE PI M AD DI T Modern PC computers, laptops and notebooks are no longer equipped with RS-232 connectors and UART controllers. They are nowadays replaced with USB connectors and USB controllers. Still, certain technology enables UART In order to use USB-UART A module on EasyPIC Fusion™ v7, communication to be done via USB connection. Controllers such as FT232RL from FTDI convert you must first install FTDI drivers on your computer. Drivers UART signals to the appropriate USB standard. can be found on Product DVD: IA ED M RO communication USB-UART A R21 2K2 C11 100nF v7 communication USB-UART B If you need to use more than one USB-UART in your application, you have another USB-UART B connector available on the board too. Both available USB-UART modules can operate at the same time, because they are routed to separate microcontroller pins. Enabling USB-UART B USB-UART B communication is being done through a FT232RL controller, USB connector (CN23) and microcontroller UART module. To establish this connection, you must connect RX and TX lines of the FT232RL to the appropriate pins of the microcontroller. This selection is done using DIP switches SW12.3 and SW12.4 or SW12.5 and SW12.6. In order to use USB-UART B module on EasyPIC Fusion™ v7, you must first install FTDI drivers on your computer. Drivers can be found on Product DVD: AD DI T • • • • • • • • • EXAM PLE S S VER DRI • S TIC MA HE • • • • • • • • • • • • • PROGRAMM ERS A ND D EBU GG ER S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • • • • IA ED M RO DS AR BO •• • • • • • • • RD S• • • •• • • • • • D EVELO PME UALS NT MAN BO A le on Product D! M IK • • •• • • • SC • lab • Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. DV E6 10uF VCC-3.3V VCC-3.3V R29 2K2 R30 4K7 N O VCC-5V 2 3 4 5 6 7 8 Figure 9-1: USB-UART B connection schematic 1 2 3 4 5 6 7 8 9 10 11 12 13 14 U4 TXD OSCO DTR# OSCI RTS# TEST VCCIO AGND RXD NC RI# CBUS0 GND CBUS1 FT232RL GND NC DSR# VCC DCD# RESET# CTS# GND CBUS4 3V3OUT CBUS2 USBDM CBUS3 USBDP FT232RL 28 27 26 25 24 23 22 21 20 19 18 17 16 15 RX VCC 1 D- TX 2 D+ 3 RX-LED2 TX-LED2 LD73 LD74 R37 1K0 FTDI2-D_N FTDI2-D_P GND 4 USB B US B UA RT B CONNECTOR CN23 TX-FTDI2 RX-FTDI2 TX-FTDI2 RX-FTDI2 SW12 v7 CO • • • • • • C25 100nF 1 DATA BUS PRODUCT DVD VCC-5V VCC-3.3V RF13 RF12 BA SIC ,M IK RO PA SC AL • ai VCC-5V C24 100nF • • • • • • • • • MIK ROC ILERS , MI COMP KRO • DVD://download/eng/software/development-tools/ universal/ftdi/vcp_drivers.zip • • • • • • • • • • VCC-3.3V RE WA FT SO www.mikroe.com www.libstock.com Av In order to enable USB-UART B communication, you must push SW12.3 and SW12.4 or SW12.5 and SW12.6 to ON position. This connects the RX and TX lines to appropriate microcontroller pins. L NA IO RS LE PI M When using either USB-UART A or USBUART B, make sure to disconnect all devices and additional boards that could interfere with the signals and possibly corrupt the data being sent or received. R38 2K2 C26 100nF page 23 communication USB HOST USB is the acronym for Universal Serial Bus. This is a very popular industry standard that defines cables, connectors and protocols used for communication and power supply between computers and other devices. EasyPIC Fusion™ v7 contains USB HOST connector (CN24) for USB Standard Type A plug, which enables microcontrollers that support USB communication to establish a connection with the target device (eg. USB Keyboard, USB Mouse, etc). USB host also provides the necessary 5V power supply to the target via TPS2041B IC. Detection whether USB device is connected to HOST connector can be done through VBUS line. You can enable or disable USB device power supply connected to HOST via SW14.7 switch. N O VCC-3.3V 1 3 R34 47K 4 R36 VCC-5V 10K 5 6 7 RB5 USB-PSW 4 8 SW14 5 R32 2K2 LD71 OC U5 EN R31 4K7 OC GND IN OUT LD72 ON 3 CN24 2 1 VCC 1 TPS2041B E9 10uF E10 10uF D1 BAT43 USB-VBUS Figure 10-1: USB host connection schematic page 24 US B HOS T CONNECTOR 2 VCC-3.3V VCC-5V R40 R41 220 10K Q2 BC846 USB-D_N D- 2 USB-D_P D+ 3 GND 4 USB A DATA BUS v7 communication USB device US B DEV ICE CONNECTOR EasyPIC Fusion™ v7 also contains USB DEVICE connector (CN26) which enables microcontrollers that support USB communication to establish a connection with the target host (eg. PC, Laptop, etc). It lets you build a slave USB device (HID, Composite, Generic, etc.). Connector supports USB Standard Type B plug. Detection whether USB device is connected to HOST can be done through VBUS line. This line is connected directly to microcontroller pin. When connected to HOST, dedicated amber-colored power LED will light up as well. This VCC line cannot be used for powering the board. It's only used for detecting connection. CN26 1 VCC 2 3 D- D_N D+ D_P 4 GND 220 R50 27 R53 27 D2 BAT43 USB-VBUS USB-D_N USB-D_P ON LD76 USB B GND R48 R58 4K7 DATA BUS GND Figure 11-1: USB device connection schematic v7 page 25 communication Ethernet communication R63 10K R44 LED2 1K LD75 LED2 VCC-3.3V FP3 A2 K2 TD+ R49 51 CT TD- R54 51 A1 CT K1 TX_N RX_P RD+ RD- R55 51 RJ45 LED1 LD77 TX_P R46 51 C32 10nF RX_N C33 10nF R60 LED1 TX_N RX_N LED1 1 3 5 7 9 11 13 15 17 19 21 23 25 1K Figure 12-1: Ethernet connection schematic page 26 2 TX_P 4 RX_P 6 LED2 8 10 12 14 16 18 20 22 24 26 MCU CARD SOCKET CONNECTOR ETHERNET CN25 Ethernet is a popular computer networ king technology for local area networks (LAN). Systems communicating over Ethernet divide a stream of data into individual packets called frames. Each frame contains source and destination addresses and error-checking data so that damaged data can be detected and retransmitted. EasyPIC Fusion™ v7 features standard RJ-45 connector which enables microcontrollers that support Ethernet communication to establish a connection with a computer, router or other devices. All four Ethernet lines (TPOUT+, TPOUT-, TPIN+ and TPIN-) are routed directly to the MCU card socket and cannot be accessed via PORT headers. Additional signalization LEDs (green and yellow) are provided on the board next to RJ-45 connector. Ethernet MCU cards Ethernet communication (TX_P, TX_N, RX_P and RX_N) and signalization lines (LED1, LED2) are routed directly to the MCU card socket and can be used only with a Ethernet MCU card (100-pin TQFP PT ETHERNET , Page 11). v7 communication CAN communication VCC-3.3V R57 10 TX-CAN RX-CAN 1 2 3 4 U7 D GND Vdd R Rs CANH CANL Vref 8 7 6 5 VCC-3.3V CANH C34 100nF CANL CN28 N O SN65HVD230 1 2 DATA BUS 3 4 5 Figure 13-1: CAN connection schematic 6 7 RG1 RG0 8 SW12 v7 Controller Area Network (CAN or CAN bus) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer. CAN is a message-based protocol, designed specifically for automotive applications but now also used in other areas such as industrial automation and medical equipment. EasyPIC Fusion™ v7 is equipped with SN65HVD230 – a 3.3V CAN Transceiver and a pair of screw terminals which provide microcontrollers with integrated CAN controller with the necessary physical interface for CAN communication. Make sure to correctly connect negative and positive differential communication lines before using this module. Enabling CAN Figure 13-2: enabling CAN communication In order to enable CAN communi cation, you must push SW12.7 (RG1) and SW12.8 (RG0) to ON position. This connects the TX and RX lines to appropriate microcontroller pins. page 27 multimedia Audio I/O It's hard to imagine modern multimedia devices without high quality audio reproduction modules. Sounds and music are almost as important as graphical user interfaces. Along with other multimedia modules, EasyPIC Fusion™ v7 contains high-end stereo VS1053 audio codec. It features Ogg Vorbis/MP3/AAC/WMA/FLAC/WAV/MIDI audio decoder, as well as an PCM/IMA ADPCM/Ogg Vorbis encoder on a single chip. Board also contains two stereo audio connectors for interfacing with standard 3.5mm stereo audio jacks. VS1053 receives the input bit stream through a serial input bus, which it listens to as a system slave. The input stream is decoded and passed through a digital volume control to an 18-bit oversampling, multi-bit, sigma-delta Digital to Analog Converter (DAC). The decoding is controlled via a serial control bus. In addition to the basic decoding, it is possible to add application specific features like DSP effects to the user RAM memory. You can build music players, audio recording devices, internet Figure 14-2: radio player applications, and much Enabling more. audio codec Enabling Audio I/O C1 R VCC-3.3V GBUF L Figure 14-1: Audio IN/OUT connection schematic VCC-1.8V VCC-3.3V 48 47 46 45 44 43 42 41 40 39 38 37 R8 100k VS1053 GPIO4 GND GPIO1 GPIO0 XTEST CVDD3 SO SI SCLK TX RX GPIO5 36 35 34 33 32 31 30 29 28 27 26 25 R9 27 R16 10K MICP R13 1K C8 1uF C9 E2 100pF 10uF CN21 E3 10uF R17 1K C10 1uF MICROPHONE R19 1K SCK MISO MOSI 4 RG12 RG13 RG14 RG15 5 C13 22pF 3 12.288MHz 2 6 7 8 page 28 R11 1K MICN 1 DATA BUS VCC-3.3V 1M X1 C12 22pF C2 10nF C4 10nF PH_MISO PH_MOSI PH_SCK VCC-3.3V N O R22 In order to use Audio I/O module, you must connect data and Audio control lines of the microcontroller with the VS1053 audio codec. To do this, push SW13.1–SW13.3 and SW13.5–SW13.8 switches to ON position. This will connect SPI data lines with SCK, MISO and MOSI microcontroller pins, and audio control lines and chip select with RG12, RG13, RG14 and RG15 pins. R7 20 MP3-CS# MP3-DCS R20 100K R6 20 C3 47nF 13 14 15 16 17 18 19 20 21 22 23 24 GPIO MP3-DREQ MCP/LN1 MICN XRESET DGND0 CVDD0 IOVDD0 CVDD1 DREQ GPIO2 GPIO3 GPIO6 GPIO7 PHONEJACK R5 10 GPIO 1 2 3 4 5 6 7 8 9 10 11 12 DCS/BSYNC XDCS/BSYNC IOVDD1 VDD1 CO VC0 DGND1 GND1 TALO XTAL0 TALI XTAL1 OVDD2 IOVDD2 GND2 DGND2 GND3 DGND3 GND4 DGND4 CS XCS VDD2 CVDD2 MICP MICN MP3-RST# LN LN2 AGND AGND3 LEF LEFT AVDD AVDD2 RCA RCAP AVDD AVDD1 GBU GBUF AGND AGND2 AGND AGND1 RIGH RIGHT AVDD AVDD0 AGND AGND0 U1 R3 10 R GBUF R4 10K commu nication lines CN19 R1 10 L 1uF SW13 PH_SCK PH_MISO PH_MOSI MP3-DREQ MP3-RST# MP3-CS# MP3-DCS VCC-3.3V 1 E4 C14 10uF 100nF C18 100nF C19 C15 100nF 100nF C20 C16 100nF 1uF 2 3 U3 IN OUT GND EN ADJ AP7331-ADJ VCC-1.8V 5 4 R23 100K R24 R25 27K4 E5 C21 C17 C22 C23 10uF 100nF 100nF 100nF 100nF 1K v7 multimedia microSD card slot VCC-MMC VCC-3.3V PH_SCK PH_MISO PH_MOSI 3 FERRITE E13 10uF SCK MISO MOSI 4 5 6 C30 100nF 2 FP2 N O Enabling microSD 1 VCC-MMC 7 8 RD12 RD13 PH_MISO SD-CD# 6 GND R56 27 SD-CS# SD-CD# 5 microS D CA RD S LOT PH_SCK 4 7 CD 1 2 4 5 6 7 3 CS Din +3.3V SCK GND Dout R51 10K SD-CS# PH_MOSI 2 MICROSD 8 In order to access microSD card, you must enable SPI communication lines using SW13.1 – SW13.3 DIP switches as well as Chip Select (CS) and Card Detect (CD) lines using SW14.1 and SW14.2 switches. R52 10K N O SW13 CN27 1 v7 FP2 DATA BUS G Secure Digital (SD) is a non-volatile memory card format developed for use in portable devices. It comes in different packages and memory capacities. It is mostly used for storing large amounts of data. EasyPIC Fusion™ v7 features the microSD card slot. The microSD form factor is the smallest card format currently available. It uses standard SPI user interface with minimum additional electronics, mainly used for stabilizing communication lines which can be significantly distorted at high transfer rates. Special ferrite is also provided to compensate the voltage and current glitch that can occur when pushing-in and pushing-out microSD card into the socket. SW14 Figure 15-1: microSD card slot connection schematic page 29 multimedia TFT display 320x240 pixels One of the most powerful ways of presenting data and interacting with users is through color displays and touch panel inputs. This is a crucial element of any multimedia device. EasyPIC Fusion™ v7 features TFT color 320x240 pixel display. It is a 2.83" display with LED back-light, featuring HX8347D controller. Enabling TFT display BCK_LIGHT BPWM RD9 RG6 RD10 RE0 RE1 RE2 RE3 RE4 RE5 RE6 RE7 RD7 VCC-5V RD5 RD4 BPWM Figure 16-1: TFT display connection schematic R62 20 CN32 VCC-3.3V BCK_PWM 20 PMRD PMWR GND VCC NC RS NC CS D0 D1 D2 D3 D4 D5 D6 D7 RST NC +5V BPWM 1 Q5 BC846 R64 1K R66 Each pixel is capable of showing 262.144 different colors. It is connected to microcontroller using standard 8080 parallel 8-bit interface, with additional control lines. Board features back-light driver which besides standard mode can also be driven with PWM signal in order to regulate brightness in range from 0 to 100%. Figure 16-2: Turn on switches SW11.1 and SW11.2 to enable backlight and PWM signal from microcontroller. 4K7 TFT display is enabled using SW11.1–SW11.2 DIP switches. Back-light can be enabled in two different ways: N O VCC-5V 1 2 RD2 1. It can be turned on with full brightness using SW11.1 switch. 2. Brightness level can be determined with PWM signal from the microcontroller, allowing you to write custom back-light controlling software. This back-light mode is enabled when both SW11.1 and SW11.2 switches are in ON position. BCK_LIGHT BCK_PWM 3 4 5 6 7 8 21 DATA BUS page 30 24 XR YU XL YD SW11 GLCD-TFT SOCKET v7 Touch panel is a glass panel whose surface is covered with two layers of resistive material. When the screen is pressed, the outer layer is pushed onto the inner layer and appropriate controllers can measure that pressure and pinpoint its location. This is how touch panels can be used as an input devices. EasyPIC Fusion™ v7 is multimedia Touch Panel controller equipped with touch panel controller and connector for 4-wire resistive touch panels. It can very accurately register pressure at a specific point, representing the touch coordinates in the form of analog voltages, which can then be easily converted to X and Y values. Touch panel comes as a part of TFT 320x240 display. Enabling Touch panel Figure 17-1: Touch Panel controller and connection schematic CN32 1 VCC-3.3V 20 PMRD PMWR GND VCC NC RS NC CS D0 D1 D2 D3 D4 D5 D6 D7 RST NC +5V BPWM Figure 17-2: Turn on switches 5 through 8 on SW11 to enable Touch panel controller E14 10uF C43 300K 47nF TOP 47nF 21 24 XR YU XL YD C44 300K 3 R77 N O VCC-3.3V 2 BOTTOM RIGHT TOP LEFT 6 7 8 RIGHT TOP LEFT BOTTOM GLCD-TFT SOCKET 5 LEFT 4 v7 R70 1 Touch panel is enabled using SW11.5, SW11.6, SW11.7 and SW11.8 switches. They connect TOP and LEFT lines of the touch panel with PB14 and RB15 analog inputs, and BOTTOM and RIGHT with PB2 and PB3 digital outputs on microcontroller sockets. Make sure to disconnect other peripherals, LEDs and additional pull-up or pull-down resistors from the interface lines so they do not interfere with signal/data integrity. DATA BUS VCC-3.3V RB2 RB3 RB14 RB15 SW11 page 31 When working with multi media applications it is far more intuitive to use a single joystick than several different push buttons that are more far apart. This is more natural for users and they can browse through on-screen menus, or even play games much easier. EasyPIC Fusion™ v7 features navigation switch with five different positions: Up, Down, Left, Right and Center. Each of those acts as a button, and is connected to one of the following microcontrollers pins: RA4, RA5, RA6, RA7, RA1 (respectively). Before using the navigation switch, it is necessary to pull-up mentioned microcontroller pins using tri-state DIP switches located in I/O groups. After pressing the navigation switch in desired direction, associated microcontroller pins are connected to GND, which can be detected in user software. Figure 18-2: Navigation switch is an intuitive solution for browsing through on-screen menus. DATA BUS RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 multimedia Navigation switch KEY1 RA4 UP 1 4 RA1 CENTER 2 5 RA6 LEFT 3 6 RIGHT DOWN RA7 RA5 UP PULL DOWN +1 2 3 4 5 6 7 8 _ SW2 R83 220 VCC-3.3V Figure 18-1: Navigation switch connection schematic. Pull-up resistors should be enabled during operation page 32 v7 Piezoelectricity is the charge which accumulates in certain solid materials in response to mechanical pressure, but also providing the charge to the piezo electric material causes it to physically deform. One of the most widely used applications of piezoelectricity is the production of sound generators, called piezo buzzers. Piezo buzzer is an electric component that comes in different shapes and sizes, which can be used to create sound waves when provided with analog electrical signal. EasyPIC Fusion™ v7 comes with piezo buzzer which can be connected to RD3 microcontroller pin. Connection is established using SW14.8 DIP switch. Buzzer is driven by transistor Q1 (Figure 19-1). Microcontrollers can create sound by generating a PWM (Pulse Width Modulated) signal – a square wave signal, which is nothing more than a sequence of logic zeros and multimedia Piezo Buzzer ones. Frequency of the square signal determines the pitch of the generated sound, and duty cycle of the signal can be used to increase or decrease the volume in the range from 0% to 100% of the duty cycle. You can generate PWM signal using hardware capture-compare module, which is usually available in most microcontrollers, or by writing a custom software which emulates the desired signal waveform. Supported sound frequencies Piezo buzzer’s resonant frequency (where you can expect it's best performance) is 3.8kHz, but you can also use it to create sound in the range between 2kHz and 4kHz. VCC-5V TOP VIEW N O R28 1K 1 DATA BUS PERSPECTIVE VIEW 3 4 5 6 N O 2 3 51 62 73 84 N O 51 62 73 84 N O 4 Freq = 3kHz, Duty BUZZER R35 R28 10K 1K Freq = 3kHz, Duty BUZZER R35 PZ1 Q1 BUZZER Cycle = 50% BC846 PZ1 Q1 BUZZER Cycle = 80% BC846 5 10K Freq = 3kHz, Duty Cycle Q1 = 20% 6 7 8 BUZZER R35 10K BC846 v7 RD3 8 1 BUZZER VCC-5V TOP VIEW 7 Figure 19-1: Piezo VCC-5V to RD3 buzzer connected R28 microcontroller pin PZ1 R28 1K Enabling Piezo Buzzer 2 VCC-5V 1K PZ1 BUZZER SW14 BUZZER R35 Q1 BC846 10K TOP VIEW PERSPECTIVE VIEW TOP VIEW PERSPECTIVE VIEW PERSPECTIVE VIEW Freq = 3kHz, Volume = 50% Freq = 3kHz, Volume = 80% Freq = 3kHz, Volume = 20% How to make it sing? Buzzer starts "singing" when you provide PWM signal from the microcontroller to the buzzer driver. The pitch of the sound is determined by the frequency, and amplitude is determined by the duty cycle of the PWM signal. In order to use the on-board Piezo Buzzer in your application, you first have to connect the transistor driver of piezo buzzer to the appropriate microcontroller pin. This is done using SW14.8 DIP switch which connects it to RD3 pin. Figure 19-2: push SW14.8 to ON position to connect Piezo buzzer to RD3 page 33 other modules DS1820 - Digital Temperature Sensor DS1820 is a digital temperature sensor that uses 1-wire® interface for it’s operation. It is capable of measuring temperatures within the range of -55 to 128°C, and provides ±0.5°C accuracy for temperatures within the range of -10 to 85°C. It requires 3V to 5.5V power supply for stable operation. It takes maximum of 750ms for the DS1820 to calculate temperature with 9-bit resolution. 1-wire® serial communication enables data to be transferred over a single communication line, while the process itself is under the control of the master microcontroller. The advantage of such communication is that only one microcontroller pin is used. Multiple sensors can be connected on the same line. All slave devices by default have a unique ID code, which enables the master device to easily identify all devices sharing the same interface. Board provides a separate socket (TS1) for the DS1820. Communication line with the microcontroller is selected using SW11.3 DIP switch (ON position). GND VCC-3.3V Figure 20-2: DS1820 correctly placed in socket Figure 20-3: Enabled SW11.3 DIP switch VCC-3.3V 2 ™ DS1820 3 C41 100nF RA0 4 5 6 7 Figure 20-4: DS1820 connected to RA0 pin 8 page 34 VCC 1 EasyPIC Fusion v7 enables you to establish 1-wire® communication between DS1820 and the microcontroller over RA0 pin. The connection is done placing SW11.3 DIP switch to ON position (Figure 20-4). When placing the sensor in the socket make sure that half-circle on the board silkscreen markings matches the rounded part of the DS1820 sensor. If you accidentally connect the sensor the other way, it may be permanently damaged. Make sure to disconnect other peripherals, LEDs and additional pull-up or pull-down resistors from the interface lines in order not to interfere with signal/data integrity. DQ R33 4K7 N O Figure 20-1: DS1820 socket DATA BUS Enabling DS1820 Sensor SW11 v7 The LM35 is a low-cost precision integrated-circuit temperature sensor, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. It has a linear +10.0 mV/°C scale factor and less than 60 μA current drain. As it draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in still air. EasyPIC Fusion™ v7 enables you to get analog readings from the LM35 sensor in restricted temperature range from +2ºC to other modules LM35 - Analog Temperature Sensor +150ºC. Board provides a separate socket (TS2) for the LM35 sensor in TO-92 plastic packaging. Readings are done with microcontroller using single analog input line, which is selected with DIP switch SW11.4. Switch connects the sensor with RB0 microcontroller pin. DATA BUS Enabling LM35 Sensor Figure 21-2: LM35 correctly placed in socket VOUT GND Figure 21-3: Enabled SW11.4 DIP switch R79 220 N O Figure 21-1: LM35 socket VCC 2 3 RB0 4 5 6 7 8 v7 1 EasyPIC Fusion™ v7 enables you to get analog readings from the LM35 sensor using RB0 microcontroller pin. The selection of this line is done placing SW11.4 DIP switch to ON position (Figure 21-4). When placing the sensor in the socket make sure that half-circle on the board silkscreen markings matches the rounded part of the LM35 sensor. If you accidentally connect the sensor the other way, it can be permanently damaged and you might need to replace it with another one. During the readings of the sensor, make sure that no other device uses the selected analog line, because it may interfere with the readings. SW11 LM35 C29 100nF Figure 21-4: LM35 connected to RB0 pin page 35 other modules Serial Flash Memory Flash memory is a non-volatile storage chip that can be electrically erased and reprogrammed. It was developed from EEPROM (electrically erasable programmable read-only memory) and must be erased in fairly large blocks before these can be rewritten with new data. The high density NAND type must also be programmed and read in (smaller) blocks, or pages, while the NOR type allows a single machine word (byte) to be written or read independently. Flash memories come in different sizes and supporting different clock speeds. They are mostly used for mass storage, as in USB Flash Drives, which are very popular today. Enabling Serial Flash EasyPIC Fusion™ v7 features M25P80 serial Serial Flash Memory which uses SPI communication interface and has 8 Mbits of available memory, organized as 16 sectors, each containing 256 pages. Each page is 256 bytes wide. Thus, the whole memory can be viewed as consisting of 4096 pages, or 1,048,576 bytes. Maximum clock frequency for READ instructions is 40MHz. What is SPI? In order to connect Serial Flash Memory to the microcontroller you must enable SW13.1, SW13.2, SW13.3 and SW13.4 switches. This connects SPI lines to SCK, MISO, MOSI and RD14 (CS) microcontroller pins. The Serial Peripheral Interface Bus or SPI bus is a synchronous serial data link standard that operates in full duplex mode. It consists of four lines MISO (Master Input Slave Output), MOSI (Master Output Slave Input), SCK (Clock) and CS (Chip Select). Devices communicate in master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines. VCC-3.3V DATA BUS N O 1 2 3 VCC-3.3V SCK MISO MOSI RD14 4 FLASH-CS# PH_MISO 7 8 page 36 27 1 2 3 4 U6 CS SDO WP GND 25P80 6 SW13 R39 100K R43 5 C27 100nF PH_SCK PH_MISO PH_MOSI FLASH-CS# VCC-3.3V VCC HOLD SCK SDI 8 7 6 5 Figure 22-1: Schematic of Serial Flash Memory module PH_MOSI PH_SCK v7 I C EEPROM EEPROM is short for Electrically Erasable Programmable Read Only Memory. It is usually a secondary storage memory in devices containing data that is retained even if the device looses power supply. EEPROMs come with parallel or serial interface to the master device. Because of the ability to alter single bytes of data, EEPROM devices are used to store personal preference and configuration data in a wide spectrum of consumer, automotive, telecommunication, medical, industrial, and PC applications. Enabling I2C EEPROM Figure 23-2: Activate SW14.3 and SW14.4 or SW14.5 and SW14.6 switches In order to connect I2C EEPROM to the microcontroller you must enable SW14.3 and SW14.4 or SW14.5 and SW14.6 switches. 2K2 pull-up resistors necessary for I2C communication are already provided on SDA and SCL lines once switches are turned on. Prior to using EEPROM in your application, make sure to disconnect other peripherals, LEDs and additional pull-up or pulldown resistors from the interface lines in order not to interfere with signal/data integrity. EasyPIC Fusion™ v7 supports serial EEPROM which uses I2C communication interface and has 1024 bytes of available memory. EEPROM itself supports single byte or 16-byte (page) write and read operations. Data rates are dependent of power supply voltage, and go up to 400 kHz for 3.3V power supply. What is I2C? I2C is a multi-master serial single-ended bus that is used to attach low-speed peripherals to computer or embedded systems. I²C uses only two open-drain lines, Serial Data Line (SDA) and Serial Clock (SCL), pulled up with resistors. SCL line is driven by a master, while SDA is used as bidirectional line either by master or slave device. Up to 112 slave devices can be connected to the same bus. Each slave must have a unique address. VCC-3.3V N O DATA BUS other modules 2 VCC-3.3V VCC-3.3V 1 2 3 RA2 RA3 VCC-3.3V 4 5 C36 100nF 6 EEPROM-SCL EEPROM-SDA EEPROM-SCL EEPROM-SDA 1 2 3 4 U9 7 A0 A1 A2 VSS VCC WP SCL SDA 8 24AA01 EEPROM 8 7 6 5 R72 2K2 R73 2K2 EEPROM-SCL EEPROM-SDA Figure 23-1: Schematic of I2C EEPROM module SW14 v7 page 37 other modules ADC inputs Digital signals have two discrete states, which are decoded as high and low, and interpreted as logic 1 and logic 0. Analog signals, on the other hand, are continuous, and can have any value within defined range. A/D converters are specialized circuits which can convert analog signals (voltages) into a digital representation, usually in form of an integer number. The value of this number is linearly dependent on the input voltage value. Most microcontrollers nowadays internally have A/D converters connected to one or more input pins. Some of the most important parameters of In order to connect the output of the A/D converters are conversion potentiometer P1 to RB0, RB1, RB4, RB8 time and resolution. Conversion or RB9 analog microcontroller inputs, you time determines how fast can an have to place the jumper J8 in the desired analog voltage be represented in form of position. By moving the potentiometer a digital number. This is an important parameter knob, you can create voltages in range if you need fast data acquisition. The other parameter from GND to VCC. is resolution. Resolution represents the number of discrete steps that supported voltage range can be divided into. It determines the sensitivity of the A/D converter. Resolution is represented in maximum number of bits that resulting number occupies. Most microcontrollers have 10-bit resolution, meaning that maximum value of conversion can be represented with 10 bits, which converted to integer is 210=1024. This means that supported voltage range, for example from 0-3.3V, can be divided into 1024 discrete steps of about 3.222mV. EasyPIC Fusion™ v7 provides an interface in form of potentiometer for simulating analog input voltages that can be routed to any of the 5 supported analog input pins. Enabling ADC inputs DATA BUS P1 RB0 RB1 RB4 RB8 RB9 R42 VCC-3.3V E18 10uF 220 Figure 24-1: Schematic of ADC input 10K J8 C28 100nF page 38 v7 EasyMx PRO™ v7 for Stellaris® contains GND pins located in different sections of the board, which allow you to easily connect oscilloscope GND reference when you monitor signals on microcontroller pins, or signals of on-board modules. 1 1 GND is located just below power supply section. 2 GND is located below the micro SD section. 3 GND is located just above PORTG/L Input/Output Group. 1 2 3 2 3 Figure 25-1: three oscilloscope GND pins are conveniently positioned so different parts of the board can be reached with an oscilloscope probe v7 page 39 other modules Additional GNDs What’s Next? You have now completed the journey through each and every feature of EasyPIC Fusion™ v7 board. You got to know it’s modules, organization, supported microcontrollers, programmer and debugger. Now you are ready to start using your new board. We are suggesting several steps which are probably the best way to begin. We invite you to join thousands of users of EasyPIC™ brand. You will find very useful projects and tutorials and can get help from a large ecosystem of users. Welcome! Compiler You still don’t have an appropriate compiler? Locate dsPIC®/PIC24® or PIC32® compiler that suits you best on the Product DVD provided with the package: DVD://download/eng/software/compilers/ • • • • • • • • • • • • • • • • • • MIK ROC ILERS , MI COMP KRO BA SIC ,M IK RO PA SC AL • • • • • • • • • • • • • • • • S VER DRI EXAM PLE S CO • PRODUCT DVD • AD DI T RE WA FT SO RS LE PI M Choose between mikroC, mikroBasic and mikroPascal and download fully functional demo version, so you can begin building your dsPIC®/ PIC24® and PIC32® applications. L NA IO www.mikroe.com www.libstock.com • S TIC MA HE • • • • • • • • • • • • • PROGRAMM ERS A ND D EBU GG ER S BOARDS • • • • • • • • • SSORY ACCE • • • • • • • • • • • • DS AR BO •• • • • • • • • RD S• • • •• • • • • • D EVELO PME UALS NT MAN BO A • • •• • • • SC • Support Once you have chosen your compiler, and since you already got the board, you are ready to start writing your first projects. We have equipped our compilers with dozens of examples that demonstrate the use of each and every feature of the EasyPIC Fusion™ v7 board, and all of our accessory boards as well. This makes an excellent starting point for your future projects. Just load the example, read well commented code, and see how it works on hardware. Browse through the compiler Examples path to find the following folder: If you want to find answers to your questions on many interesting topics we invite you to visit our forum at http://www.mikroe.com/forum and browse through more than 150 thousand posts. You are likely to find just the right information for you. On the other hand, if you want to download free projects and libraries, or share your own code, please visit the Libstock website. With user profiles, you can get to know other programmers, and subscribe to receive notifications on their code. We all know how important it is that we can rely on someone in moments when we are stuck with our projects, facing a deadline, or when we just want to ask a simple, basic question, that’s pulling us back for a while. We do understand how important this is to people and therefore our Support Department is one of the pillars upon which our company is based. MikroElektronika offers Free Tech Support to the end of product lifetime, so if something goes wrong, we are ready and willing to help! D! IA ED M RO Community http://www.libstock.com/ M IK le on Product Projects \Development Systems\ page 40 lab • Av ai Copyright ©2012 Mikroelektronika. All rights reserved. MikroElektronika, MikroElektronika logo and other MikroElektronika trademarks are the property of MikroElektronika. All other trademarks are the property of their respective owners. Unauthorized copying, hiring, renting, public performance and broadcasting of this DVD is strictly prohibited. DV http://www.mikroe.com/esupport/ v7 notes v7 page 41 notes page 42 v7 DISCLAIMER All the products owned by MikroElektronika are protected by copyright law and international copyright treaty. Therefore, this manual is to be treated as any other copyright material. No part of this manual, including product and software described herein, must be reproduced, stored in a retrieval system, translated or transmitted in any form or by any means, without the prior written permission of MikroElektronika. The manual PDF edition can be printed for private or local use, but not for distribution. Any modification of this manual is prohibited. MikroElektronika provides this manual ‘as is’ without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties or conditions of merchantability or fitness for a particular purpose. MikroElektronika shall assume no responsibility or liability for any errors, omissions and inaccuracies that may appear in this manual. In no event shall MikroElektronika, its directors, officers, employees or distributors be liable for any indirect, specific, incidental or consequential damages (including damages for loss of business profits and business information, business interruption or any other pecuniary loss) arising out of the use of this manual or product, even if MikroElektronika has been advised of the possibility of such damages. MikroElektronika reserves the right to change information contained in this manual at any time without prior notice, if necessary. HIGH RISK ACTIVITIES The products of MikroElektronika are not fault – tolerant nor designed, manufactured or intended for use or resale as on – line control equipment in hazardous environments requiring fail – safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines or weapons systems in which the failure of Software could lead directly to death, personal injury or severe physical or environmental damage (‘High Risk Activities’). MikroElektronika and its suppliers specifically disclaim any expressed or implied warranty of fitness for High Risk Activities. TRADEMARKS The Mikroelektronika name and logo, the Mikroelektronika logo, mikroC™, mikroBasic™, mikroPascal™, mikroProg™, mikromedia™, EasyPIC™, workStation™, Click boards™ and mikroBUS™ are trademarks of Mikroelektronika. All other trademarks mentioned herein are property of their respective companies. All other product and corporate names appearing in this manual may or may not be registered trademarks or copyrights of their respective companies, and are only used for identification or explanation and to the owners’ benefit, with no intent to infringe. Copyright © MikroElektronika™, 2012, All Rights Reserved. v7 page 43 If you want to learn more about our products, please visit our website at www.mikroe.com If you are experiencing some problems with any of our products or just need additional information, please place your ticket at www.mikroe.com/esupport If you have any questions, comments or business proposals, do not hesitate to contact us at [email protected] EasyPIC FUSION v7 Manual ver. 1.01 0 100000 021934