SK-FM3-176PMC-TFT SK-FM4-120PMC-TFT Version 1.0, MSc 1 © 2013 Spansion Inc. Warranty and Disclaimer The use of the deliverables (deliverables shall include, but not limited to, software, application examples, hardware, target boards, evaluation boards, starter kits, schematics, engineering samples of IC’s etc.) is subject to the terms and conditions of Spansion LLC and its affiliates (“SPANSION”) as set out below and in (i) the terms and conditions of the License Agreement and/or the Sale and Purchase Agreement and/or any other agreement under which deliverables have been delivered, (ii) the technical descriptions and (iii) all accompanying written materials. 1. Please note that the deliverables are intended for and must only be used for test applications in an evaluation laboratory environment. 2. The software deliverables are provided on an as-is basis without charge and are subject to alterations. It is the user’s obligation to fully test the software in its environment and to ensure proper functionality, qualification and compliance with component specifications. 3. Regarding hardware deliverables, the following limited warranty shall apply: Except as otherwise provided in the following paragraphs, for a period of one (1) year from date of shipment to customer (“Warranty Period”), SPANSION warrants the hardware deliverables (i) are free of defects in material and workmanship, and (ii) conform to SPANSION applicable data sheet specifications (available at www.spansion.com or upon request). This warranty does not extend beyond the first purchaser of the deliverables. The liability of SPANSION under this warranty is limited, at SPANSION’s option, solely to repair the deliverable, to send replacement deliverable, or to make an appropriate credit adjustment or refund in an amount not to exceed the original purchase price actually paid for the deliverable returned to SPANSION. SPANSION’S warranty obligations are conditioned upon the following: (a) SPANSION is promptly notified in writing by customer during the applicable warranty period of any defect or nonconformance in the deliverable, (b) customer obtains authorization from SPANSION to return the defective deliverable, (c) the defective deliverable is returned to SPANSION in accordance with SPANSION’S shipping instructions set forth below, and (d) SPANSION’S examination of such deliverable discloses to its satisfaction that any defect or nonconformance actually existed and was not caused by improper use or operation outside of the data sheet specifications for the deliverable, abuse, negligence, improper installation, accident, loss or damage in transit, or unauthorized repair or alteration by a person other than SPANSION. Customer shall ship such defective deliverable to SPANSION via SPANSION’S carrier, collect. Risk of loss will transfer to SPANSION when the defective deliverable is provided to SPANSION’S carrier. If customer fails to adhere to these warranty returns guidelines, customer shall assume all risk of loss and shall pay for all freight to SPANSION’S specified location. This warranty shall not apply to any deliverables that have been repaired or altered, except those which have been repaired or altered by SPANSION. The aforementioned provisions do not extend the original warranty period of any deliverable that has either been repaired or replaced by Seller. THESE WARRANTIES ARE IN LIEU OF ALL OTHER WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, AND ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. SPANSION NEITHER ASSUMES NOR AUTHORIZES ANY OTHER PERSON TO ASSUME FOR IT ANY OTHER LIABILITIES. THE FOREGOING CONSTITUTES CUSTOMER’S SOLE AND EXCLUSIVE REMEDY FOR THE FURNISHING OF DEFECTIVE OR NONCONFORMING DELIVERABLES. 4. The following limitation of liability shall apply for all deliverables EXCEPT FOR DAMAGES FOR BODILY INJURY OR DEATH, SPANSION SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, RELIANCE, OR CONSEQUENTIAL DAMAGES, RELIANCE DAMAGES, AND/OR PUNITIVE, OR EXEMPLARY DAMAGES, WHETHER ANY SUCH DAMAGES ARE BASED ON CONTRACT, TORT OR ANY OTHER LEGAL THEORY, AND WHETHER OR NOT SPANSION HAS BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES, AND NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. REGARDLESS OF THE BASIS ON WHICH CUSTOMER IS ENTITLED TO CLAIM DAMAGES FROM SPANSION (INCLUDING FUNDAMENTAL BREACH, NEGLIGENCE, MISREPRESENTATION, OR OTHER CONTRACT OR TORT CLAIM), SPANSION ENTIRE LIABILITY IN ANY CALENDAR YEAR, REGARDLESS OF THE NUMBER OF CLAIMS, SHALL NOT EXCEED FIFTY PERCENT (50%) OF THE TOTAL AMOUNT PAID BY CUSTOMER TO SPANSION FOR THE DELIVERABLES SOLD IN SUCH CALENDAR YEAR. 5. Should one of the above stipulations be or become invalid and/or unenforceable, the remaining stipulations shall stay in full effect. 6. The contents of this document are subject to change by SPANSION without a prior notice, thus contact SPANSION about the latest one. This board and its deliverables must only be used for test applications in an evaluation laboratory environment. 2 © 2013 Spansion Inc. Please download latest version of this readme via http://www.spansion.com or request direct download link via [email protected] 3 © 2013 Spansion Inc. Index Contents Features Quick Start Hardware − Pinlist SK-FM3-176PMC-TFT − Pinlist SK-FM4-120PMC-TFT − Jumper Settings − Jumper List 4 Tools − Serial Port Viewer − USB Wizard − TFT Wizard − Serial Programming − USB Programming Debugging with CMSIS-DAP (On-Board USB to JTAG) Examples Debugging IAR (EWARM) Board API Debugging Keil TFT Driver Appendix © 2013 Spansion Inc. − Support/Contact Features 5 © 2013 Spansion Inc. Features Assembly Options The FM3 & FM4 TFT direct drive solution evaluation board is available with two assembly options: − SK-FM3-176PMC-TFT − SK-FM4-120PMC-TFT 6 © 2013 Spansion Inc. Features 7 SK-FM3-176PMC-TFT SK-FM4-120PMC-TFT MCU FM3 MB9BFD18TPMC FM4 MB9BF568RPMC Flash (internal) 1MByte 1MByte RAM (internal) 128KByte 128KByte Flash (External) 4MBit x 16-Bit (8MByte) Flash 4MBit x 16-Bit (8MByte) Flash RAM (External) 1MBit x 16-Bit (2MByte) SRAM 1MBit x 16-Bit (2MByte) SRAM Frequency 4MHz crystal, PLL max. 144MHz 4MHz crystal, PLL max. 160MHz EDT 40-pin FPC connector yes yes 40-pin TFT connector (RM 1mm) yes yes Pins available for user interaction 22 5 Multicon (I2C, UART or SPI) 2 2 Capacitive touch buttons 7 6 In-Circuit Flash programming UART, USB, JTAG UART, USB, JTAG RS232 interface yes yes USB to serial converter yes yes USB to JTAG converter (CMSIS-DAP) yes yes JTAG interface (20-pin) yes yes CAN interface yes yes USB OTG connector (USB-Mini) - yes USB Host (Type-A) and Device (Type-B) yes - 10/100MBit Ethernet (via MII) yes - © 2013 Spansion Inc. Features Features SK-FM3-176PMC-TFT MB9BFD18TPMC Mikrocontroller Family 2x Multicon (I2C, UART or SPI) 1MB Flash, 128KB RAM on-chip 7 capacitive touch buttons (assembly option for 7 mechanical buttons) 1MBit x 16-Bit (2MByte) on-board SRAM In-Circuit Flash programming (UART, USB, JTAG) 4MBit x 16-Bit (8MByte) on-board Flash 4 MHz main crystal, 144MHz Main Clock (via internal PLL) USB to serial converter (Type-B connector) 8-9V unregulated external DC power supply USB to JTAG converter (CMSIS-DAP) On-board 5.0V and 3.3V voltage regulator CAN interface (SUB-D9 connector) Power-LED USB Host (Type-A) and Device (Type-B) connectors Reset button, Reset LED EDT 40-pin FPC connector (TFT connector) Fujitsu/Spansion 40-pin TFT connector 22 pins available for user interaction 8 RS232 interface (SUB-D9 connector) © 2013 Spansion Inc. 10/100MBit Ethernet (via MII) JTAG interface (20-pin) RoHS compliant CE conform Features Features SK-FM4-120PMC-TFT MB9BF568RPMC Mikrocontroller Family 2x Multicon (I2C, UART or SPI) 1MB Flash, 128KB RAM on-chip 6 capacitive touch buttons (assembly option for 6 mechanical buttons) 1MBit x 16-Bit (2MByte) on-board SRAM 1 mechanical button 4MBit x 16-Bit (8MByte) on-board Flash In-Circuit Flash programming (UART, USB, JTAG) 4 MHz main crystal, 160MHz Main Clock (via internal PLL) RS232 interface (SUB-D9 connector) 8-24V unregulated external DC power supply USB to serial converter (Type-B connector) On-board 5.0V and 3.3V voltage regulator USB to JTAG converter (CMSIS-DAP) Power-LED CAN interface (SUB-D9 connector) Reset button, Reset LED USB Host (Type-A) and Device (Type-B) connectors EDT 40-pin FPC connector (TFT connector) Fujitsu 40-pin TFT connector 5 pins available for user interaction 9 © 2013 Spansion Inc. JTAG interface (20-pin) RoHS compliant CE conform Contents Contents Front View Side View ESD Box CD ROM USB Cable FFC0.50A40.120M M Shielded SK-FMx-xxxPMC-TFT TFT: G-ET0350G0DM6 ESD Box 10 © 2013 Spansion Inc. SK-FMx-xxxPMC-TFT Flat Cable TFT Quick Start 11 © 2013 Spansion Inc. Quick Start Register Please register to have access to capacitive touch technology and source code of the examples − Send eMail to: [email protected] (Subject: SK-FMx-xxxPMC-TFT Examples Registration) − Specify: Name Company Address eMail Address Telephone Number Application / Intended purpose (optional) − You will get a passcode to install examples required 12 © 2013 Spansion Inc. Quick Start First Run Connect Power Supply 9V to Evaluation Board − The pre-programmed software will be started − The pre-programmed software can be used to quickly check all peripherals − Please have a look in the Quick Start chapter for examples 13 © 2013 Spansion Inc. Quick Start Download Examples For flashing firmware following steps are necessary − Install Drivers for on-board USB to JTAG + UART adaptor and programming − There are two options to flash firmware: UART or USB UART • Install FLASH MCU Programmer (software/flashprogrammer_serial/setup.exe) • Connect via X17 and remove JP1 • See chapter Serial Programming USB • Install USB DIRECT Programmer (software/flashprogrammer_usb/setup.exe) • Connect via X13 or X12 (not X16) and set JP1 • See chapter USB Programming − Copy & extract example to your hard drive 14 © 2013 Spansion Inc. Quick Start Start Debugging For debbuging following steps are necessary − Install Drivers for on-board USB to JTAG + UART adaptor and programming − Download preferred IDE IAR Embedded Workbench ARM Keil µVision − Copy & extract example to your hard drive − Connect USB to JTAG + UART adaptor with your PC (X16) (optional any other JTAG adaptor eg. JLINK can be connected at X18) − Open *.eww file (IAR EWARM) or *.uvproj (Keil µVision) (see also Structure of TFT Evaluation Board Example) 15 © 2013 Spansion Inc. Hardware 16 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (1/8) Pin 17 Function Description 1 VCC VCC 2 PA0/RTO20_0/TIOA08_0/FRCK1_0 Multicon 1 3 PA1/RTO21_0/TIOA09_0/IC10_0 Unused Pin available at X1 4 PA2/RTO22_0/TIOA10_0/IC11_0 Unused Pin available at X1 5 PA3/RTO23_0/TIOA11_0/IC12_0 Unused Pin available at X1 6 PA4/RTO24_0/TIOA12_0/IC13_0/RX0_2/INT03_0 CAN 7 PA5/RTO25_0/TIOA13_0/TX0_2/INT10_2 CAN 8 P05/TRACED0/TIOA05_2/SIN4_2/INT00_1 Multicon 2 9 P06/TRACED1/TIOB05_2/SOT4_2/INT01_1 Multicon 2 10 P07/TRACED2/ADTG_0/SCK4_2 Unused Pin available at X1 11 P08/TRACED3/TIOA00_2/CTS4_2 Unused Pin available at X1 12 P09/TRACECLK/TIOB00_2/RTS4_2/DTTI2X_0 Unused Pin available at X1 13 P50/INT00_0/AIN0_2/SIN3_1/RTO10_0/IC20_0/MOEX_0 Flash / SRAM Output Enable 14 P51/INT01_0/BIN0_2/SOT3_1/RTO11_0/IC21_0/MWEX_0 Flash / SRAM Write Enable 15 P52/INT02_0/ZIN0_2/SCK3_1/RTO12_0/IC22_0/MDQM0_0 Multicon 1 16 P53/SIN6_0/TIOA01_2/INT07_2/RTO13_0/IC23_0/MDQM1_0 Multicon 1 17 P54/SOT6_0/TIOB01_2/RTO14_0/MALE_0 Unused Pin available at X1 18 P55/SCK6_0/ADTG_1/RTO15_0/MRDY_0 Unused Pin available at X1 19 P56/SIN1_0/INT08_2/TIOA09_2/DTTI1X_0/MNALE_0 USB1 (Host overcurrent detection) 20 P57/SOT1_0/TIOB09_2/INT16_1/MNCLE_0 Ethernet 21 P58/SCK1_0/TIOA11_2/INT17_1/MNWEX_0 Unused Pin available at X1 22 P59/SIN7_0/RX1_1/TIOB11_2/INT09_2/MNREX_0 Unused Pin available at X1 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (2/8) Pin 18 Function Description 23 P5A/SOT7_0/TX1_1/TIOA13_1/INT18_1/MCSX0_0 External Flash Chip Enable (CS 0) 24 P5B/SCK7_0/TIOB13_1/INT19_1/MCSX1_0 SDRAM / SRAM Chip Enable (CS 1) 25 P5C/TIOA06_2/INT28_0/IC20_1 Unused Pin available at X1 26 P5D/TIOB06_2/INT29_0/DTTI2X_1 Unused Pin available at X1 27 VSS VSS 28 P30/AIN0_0/TIOB00_1/INT03_2 TFT Data 0 29 P31/BIN0_0/TIOB01_1/SCK6_1/INT04_2 TFT Data 1 30 P32/ZIN0_0/TIOB02_1/SOT6_1/INT05_2 TFT Data 2 31 P33/INT04_0/TIOB03_1/SIN6_1/ADTG_6 TFT Data 3 32 P34/FRCK0_0/TIOB04_1/TX0_1 TFT Data 4 33 P35/IC03_0/TIOB05_1/RX0_1/INT08_1 TFT Data 5 34 P36/IC02_0/SIN5_2/INT09_1/TIOA12_2/MCSX2_0 TFT Data 6 35 P37/IC01_0/SOT5_2/INT10_1/TIOB12_2/MCSX3_0 TFT Data 7 36 P38/IC00_0/SCK5_2/INT11_1/MCLKOUT_0 TFT Data 8 37 P39/DTTI0X_0/ADTG_2 TFT Data 9 38 P3A/RTO00_0/TIOA00_1 TFT Data 10 39 P3B/RTO01_0/TIOA01_1 TFT Data 11 40 P3C/RTO02_0/TIOA02_1 TFT Data 12 41 P3D/RTO03_0/TIOA03_1 TFT Data 13 42 P3E/RTO04_0/TIOA04_1 TFT Data 14 43 P3F/RTO05_0/TIOA05_1 TFT Data 15 44 VSS VSS © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (3/8) Pin 19 Function Description 45 VCC VCC 46 P40/TIOA00_0/RTO10_1/INT12_1 TFT CSYNC Signal 47 P41/TIOA01_0/RTO11_1/INT13_1 TFT DE Signal 48 P42/TIOA02_0/RTO12_1 TFT Clock Signal 49 P43/TIOA03_0/RTO13_1/ADTG_7 TFT Background Dimming Signal 50 P44/TIOA04_0/RTO14_1 TFT HSYNC Signal 51 P45/TIOA05_0/RTO15_1 TFT VSYNC Signal 52 C C-Pin 53 VSS VSS 54 VCC VCC 55 P46/X0A 32KHz Crystal 56 P47/X1A 32KHz Crystal 57 INITX Reset 58 P48/DTTI1X_1/INT14_1/SIN3_2 UART3 RX 59 P49/TIOB00_0/IC10_1/AIN0_1/SOT3_2 UART3 TX 60 P4A/TIOB01_0/IC11_1/BIN0_1/SCK3_2/MADATA00_0 External Bus Address Line 0 61 P4B/TIOB02_0/IC12_1/ZIN0_1/MADATA01_0 External Bus Address Line 1 62 P4C/TIOB03_0/IC13_1/SCK7_1/AIN1_2/MADATA02_0 External Bus Address Line 2 63 P4D/TIOB04_0/FRCK1_1/SOT7_1/BIN1_2/MADATA03_0 External Bus Address Line 3 64 P4E/TIOB05_0/INT06_2/SIN7_1/ZIN1_2/MADATA04_0 External Bus Address Line 4 65 P70/TX0_0/TIOA04_2/MADATA05_0 External Bus Address Line 5 66 P71/RX0_0/INT13_2/TIOB04_2/MADATA06_0 External Bus Address Line 6 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (4/8) Pin 20 Function Description 67 P72/SIN2_0/INT14_2/AIN2_0/MADATA07_0 External Bus Address Line 7 68 P73/SOT2_0/INT15_2/BIN2_0/MADATA08_0 External Bus Address Line 8 69 P74/SCK2_0/ZIN2_0/MADATA09_0 External Bus Address Line 9 70 P75/SIN3_0/ADTG_8/INT07_1/MADATA10_0 External Bus Address Line 10 71 P76/SOT3_0/TIOA07_2/INT11_2/MADATA11_0 External Bus Address Line 11 72 P77/SCK3_0/TIOB07_2/INT12_2/MADATA12_0 External Bus Address Line 12 73 P78/AIN1_0/TIOA15_0/MADATA13_0 External Bus Address Line 13 74 P79/BIN1_0/TIOB15_0/INT23_1/MADATA14_0 External Bus Address Line 14 75 P7A/ZIN1_0/INT24_1/MADATA15_0 External Bus Address Line 15 76 P7B/TIOB07_0/INT10_0 Multicon 2 77 P7C/TIOA07_0/INT11_0 Unused Pin available at X1 78 P7D/TIOA14_1/FRCK2_1/INT12_0 Unused Pin available at X1 79 P7E/TIOB14_1/IC21_1/INT24_0 Unused Pin available at X1 80 P7F/TIOA15_1/IC22_1/INT25_0 Unused Pin available at X1 81 PF0/TIOB15_1/SIN1_2/INT13_0/IC23_1 Multicon 2 82 PF1/TIOA08_1/SOT1_2/INT14_0 Multicon 2 83 PF2/TIOB08_1/SCK1_2/INT15_0 Multicon 2 84 PE0/MD1 MD1 = VSS 85 MD0 MD0 (Low = RUN, High = PROG.) 86 PE2/X0 4MHz Crystal 87 PE3/X1 4MHz Crystal 88 VSS VSS © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (5/8) Pin 21 Function Description 89 VCC VCC 90 P10/AN00/MCSX7_0 Touch Header 91 P11/AN01/SIN1_1/INT02_1/RX1_2/FRCK0_2/MCSX6_0 Touch Header / Touch Button SW1 92 P12/AN02/SOT1_1/TX1_2/IC00_2/MCSX5_0 Touch Header / Touch Button SW2 93 P13/AN03/SCK1_1/IC01_2/MCSX4_0 Touch Header / Touch Button SW3 94 P14/AN04/SIN0_1/INT03_1/IC02_2/MAD00_0 Touch Header / Touch Button SW4 95 P15/AN05/SOT0_1/IC03_2/MAD01_0 External Bus Address Line 1 96 P16/AN06/SCK0_1/INT20_1/MAD02_0 External Bus Address Line 2 97 P17/AN07/SIN2_2/INT04_1/MAD03_0 External Bus Address Line 3 98 P18/AN08/SOT2_2/INT21_1/MAD04_0 External Bus Address Line 4 99 P19/AN09/SCK2_2/INT22_1/MAD05_0 External Bus Address Line 5 100 P1A/AN10/SIN4_1/INT05_1/TIOA13_2/IC00_1/MAD06_0 External Bus Address Line 6 101 P1B/AN11/SOT4_1/INT25_1/TIOB13_2/IC01_1/MAD07_0 External Bus Address Line 7 102 P1C/AN12/SCK4_1/INT26_1/TIOA14_2/IC02_1/MAD08_0 External Bus Address Line 8 103 P1D/AN13/CTS4_1/INT27_1/TIOB14_2/IC03_1/MAD09_0 External Bus Address Line 9 104 P1E/AN14/RTS4_1/INT28_1/TIOA15_2/DTTI0X_1/MAD10_0 External Bus Address Line 10 105 P1F/AN15/ADTG_5/INT29_1/TIOB15_2/FRCK0_1/MAD11_0 External Bus Address Line 11 106 AVCC VCC 107 AVRH VCC 108 AVSS VSS 109 VSS VSS 110 PB0/AN16/TIOA09_1/SIN7_2/INT16_0 Touch Header / Touch Button SW5 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (6/8) Pin 22 Function Description 111 PB1/AN17/TIOB09_1/SOT7_2/INT17_0 Touch Header / Touch Button SW6 112 PB2/AN18/TIOA10_1/SCK7_2/INT18_0 Touch Header / Touch Button SW7 113 PB3/AN19/TIOB10_1/INT19_0 Touch Header 114 PB4/AN20/TIOA11_1/SIN0_2/INT20_0 Touch Header 115 PB5/AN21/TIOB11_1/SOT0_2/INT21_0/AIN2_2 Touch Header 116 PB6/AN22/TIOA12_1/SCK0_2/INT22_0/BIN2_2 Touch Header 117 PB7/AN23/TIOB12_1/INT23_0/ZIN2_2 Touch Header 118 P29/AN24/MAD12_0 External Bus Address Line 12 119 P28/AN25/ADTG_4/INT09_0/RTO05_1/MAD13_0 External Bus Address Line 13 120 P27/AN26/INT02_2/RTO04_1/MAD14_0 External Bus Address Line 14 121 P26/AN27/SCK2_1/RTO03_1/MAD15_0 External Bus Address Line 15 122 P25/AN28/SOT2_1/TX1_0/RTO02_1/MAD16_0 External Bus Address Line 16 123 P24/AN29/SIN2_1/INT01_2/RX1_0/RTO01_1/MAD17_0 External Bus Address Line 17 124 P23/AN30/SCK0_0/TIOA07_1/RTO00_1 Touch Header 125 P22/AN31/SOT0_0/TIOB07_1/ZIN1_1 UART0 TX 126 P21/SIN0_0/INT06_1/BIN1_1 UART0 RX 127 P20/INT05_0/CROUT_0/UHCONX1/AIN1_1/MAD18_0 External Bus Address Line 18 128 PF6/FRCK2_0/NMIX USB1 (Host VBUS enable) 129 USBVCC1 USBVCC1 = VCC 130 P82/UMP1 USB1 (D+) 131 P82/UDP1 USB1 (D-) 132 VSS VSS © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (7/8) Pin 23 Function Description 133 VCC VCC 134 P00/TRSTX JTAG 135 P01/TCK JTAG / SWD 136 P02/TDI JTAG 137 P03/TMS JTAG / SWD 138 P04/TDO JTAG / SWD 139 P90/TIOB08_0/RTO20_1/INT30_0/MAD19_0 External Bus Address Line 19 140 P91/TIOB09_0/RTO21_1/INT31_0/MAD20_0 External Bus Address Line 20 141 P92/TIOB10_0/RTO22_1/SIN5_1/MAD21_0 External Bus Address Line 21 142 P93/TIOB11_0/RTO23_1/SOT5_1/MAD22_0 External Bus Address Line 22 143 P94/TIOB12_0/RTO24_1/SCK5_1/INT26_0/MAD23_0 Unused Pin available at X1 144 P95/TIOB13_0/RTO25_1/INT27_0/MAD24_0 Unused Pin available at X1 145 PC0/E_RXER0_RXDV1 Ethernet 146 PC1/E_RX03_RX11 Ethernet 147 PC2/E_RX02_RX10 Ethernet 148 PC3/E_RX01/TIOA06_1 Ethernet 149 PC4/E_RX00/TIOA08_2 Ethernet 150 PC5/E_RXDV0/TIOA10_2 Ethernet 151 PC6/E_MDIO0/TIOA14_0 Ethernet 152 PC7/E_MDC0/CROUT_1 Ethernet 153 PC8/E_RXCK0_REFCK Ethernet 154 PC9/E_COL0 Ethernet © 2013 Spansion Inc. Hardware Pin-List SK-FM3-176PMC-TFT (8/8) Pin 24 Function Description 155 PCA/E_CRS0 Ethernet 156 ETHVCC ETHVCC = VCC 157 VSS VSS 158 PCB/E_COUT Unused Pin available at X1 159 PCC/E_MDIO1 Unused Pin available at X1 160 PCD/E_TCK0_MDC1 Ethernet 161 PCE/E_TXER0_TXEN1/RTS4_0/TIOB06_1 Unused Pin 162 PCF/E_TX03_TX11/CTS4_0/TIOB08_2 Ethernet 163 PD0/E_TX02_TX10/SCK4_0/TIOB10_2/INT30_1 Ethernet 164 PD1/E_TX01/SOT4_0/TIOB14_0/INT31_1 Ethernet 165 PD2/E_TX00/SIN4_0/TIOA03_2/INT00_2 Ethernet 166 PD3/E_TXEN0/TIOB03_2 Ethernet 167 P62/E_PPS0_PPS1/SCK5_0/ADTG_3 Unused Pin available at X1 168 P61/SOT5_0/TIOB02_2/UHCONX0 USB0 (D+ 1,5k pullup) 169 P60/SIN5_0/TIOA02_2/INT15_1 USB0 (VBUS detection) 170 PF3/TIOA06_0/SIN6_2/INT06_0/AIN2_1 Multicon 1 171 PF4/TIOB06_0/SOT6_2/INT07_0/BIN2_1 Multicon 1 172 PF5/SCK6_2/INT08_0/ZIN2_1 Multicon 1 173 USBVCC0 USBVCC0 = VCC 174 P80/UDM0 USB0 (D-) 175 P81/UDP0 USB0 (D+) 176 VSS VSS © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (1/6) Pin 25 Function Description 1 VCC VCC 2 P50/CTS4_0/AIN0_2/RTO10_0/INT00_0/MADATA00_0 External Bus Address Line 0 3 P51/RTS4_0/BIN0_2/RTO11_0/INT01_0/MADATA01_0 External Bus Address Line 1 4 P52/SCK4_0/ZIN0_2/RTO12_0/MADATA02_0 External Bus Address Line 2 5 P53/TIOA1_2/SOT4_0/RTO13_0/MADATA03_0 External Bus Address Line 3 6 P54/TIOB1_2/SIN4_0/RTO14_0/INT02_0/MADATA04_0 External Bus Address Line 4 7 P55/ADTG_1/SIN6_0/RTO15_0/INT07_2/MADATA05_0 External Bus Address Line 5 8 P56/SOT6_0/DTTI1X_0/INT08_2/MADATA06_0 External Bus Address Line 6 9 P57/SCK6_0/MADATA07_0 External Bus Address Line 7 10 P58/SIN4_2/AIN1_0/INT04_2/MADATA08_0 External Bus Address Line 8 11 P59/RX1_1/SOT4_2/BIN1_0/INT07_1/MADATA09_0 External Bus Address Line 9 12 P5A/TX1_1/SCK4_2/ZIN1_0/MADATA10_0 External Bus Address Line 10 13 P5B/CTS4_2/MADATA11_0 External Bus Address Line 11 14 P30/TIOB0_1/RTS4_2/INT15_2/WKUP1/MADATA12_0 External Bus Address Line 12 15 P31/TIOB1_1/SIN3_1/INT09_2/MADATA13_0 External Bus Address Line 13 16 P32/TIOB2_1/SOT3_1/INT10_1/MADATA14_0 External Bus Address Line 14 17 P33/ADTG_6/TIOB3_1/SCK3_1/INT04_0/MADATA15_0 External Bus Address Line 15 18 P34/TX0_1/TIOB4_1/FRCK0_0/MNALE_0 CAN 19 P35/RX0_1/TIOB5_1/IC03_0/INT08_1/MNCLE_0 CAN 20 P36/SIN5_2/IC02_0/INT09_1/MNWEX_0 Multicon 1 21 P37/SOT5_2/IC01_0/INT05_2/MNREX_0 Multicon 1 22 P38/SCK5_2/IC00_0/INT06_2 Multicon 1 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (2/6) Pin 26 Function Description 23 P39/ADTG_2/DTTI0X_0/RTCCO_2/SUBOUT_2/MSDCLK_0 SDRAM CLK 24 P3A/TIOA0_1/AIN0_0/RTO00_0/MSDCKE_0 SDRAM CKE 25 P3B/TIOA1_1/BIN0_0/RTO01_0/MRASX_0 SDRAM RAS 26 P3C/TIOA2_1/ZIN0_0/RTO02_0/MCASX_0 SDRAM CAS 27 P3D/TIOA3_1/RTO03_0/MAD00_0 SDRAM AD0 28 P3E/TIOA4_1/RTO04_0/MAD01_0 External Bus Address Line 1 29 P3F/TIOA5_1/RTO05_0/MAD02_0 External Bus Address Line 2 30 VSS VSS 31 VCC VCC 32 P40/TIOA0_0/RTO10_1/INT12_1 TFT CSYNC Signal 33 P41/TIOA1_0/RTO11_1/INT13_1 TFT DE Signal 34 P42/TIOA2_0/RTO12_1/MSDWEX_0 SDRAM WE 35 P43/ADTG_7/TIOA3_0/RTO13_1/MCSX8_0 TFT Background Dimming Signal 36 P44/TIOA4_0/RTO14_1/DA0 TFT HSYNC Signal 37 P45/TIOB0_0/RTO15_1/DA1 Multicon 1 38 INITX Reset 39 P46/X0A 32KHz Crystal 40 P47/X1A 32KHz Crystal 41 P48/VREGCTL Unused Pin available at X1 42 P49/VWAKEUP Touch Header / Touch Button SW7 43 VBAT VBAT 44 C C-Pin © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (3/6) Pin 27 Function Description 45 VSS VSS 46 VCC VCC 47 P4B/TIOB1_0/SCS7_1/MAD03_0 External Bus Address Line 3 48 P4C/TIOB2_0/SCK7_1/AIN1_2/MAD04_0 External Bus Address Line 4 49 P4D/TIOB3_0/SOT7_1/BIN1_2/INT13_2/MAD05_0 External Bus Address Line 5 50 P4E/TIOB4_0/SIN7_1/ZIN1_2/FRCK1_1/INT11_1/WKUP2/MAD06_0 External Bus Address Line 6 51 P70/TX0_0/TIOA4_2/AIN0_1/IC13_1 Multicon 2 52 P71/RX0_0/TIOB4_2/BIN0_1/IC12_1/INT15_1 Multicon 2 53 P72/TIOA6_0/SIN2_0/ZIN0_1/IC11_1/INT14_2 Multicon 2 54 P73/TIOB6_0/SOT2_0/IC10_1/INT03_2 Multicon 2 55 P74/SCK2_0/DTTI1X_1 Multicon 2 56 PE0/MD1 MD1 = VSS 57 MD0 MD0 (Low = RUN, High = PROG.) 58 PE2/X0 4MHz Crystal 59 PE3/X1 4MHz Crystal 60 VSS VSS 61 VCC VCC 62 P10/AN00/RX1_2/SIN1_1/FRCK0_2/INT02_1/MAD07_0 External Bus Address Line 7 63 P11/AN01/TX1_2/SOT1_1/IC00_2/MAD08_0 External Bus Address Line 8 64 P12/AN02/SCK1_1/IC01_2/RTCCO_1/SUBOUT_1/MAD09_0 External Bus Address Line 9 65 P13/AN03/SIN0_1/IC02_2/INT03_1/MAD10_0 External Bus Address Line 10 66 P14/AN04/SOT0_1/IC03_2/MAD11_0 External Bus Address Line 11 © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (4/6) Pin 28 Function Description 67 P15/AN05/SCK0_1/MAD12_0 External Bus Address Line 12 68 P16/AN06/SIN2_2/INT14_1/MAD13_0 External Bus Address Line 13 69 P17/AN07/SOT2_2/WKUP3/MAD14_0 External Bus Address Line 14 70 AVCC VCC 71 AVSS VSS 72 AVRL VSS 73 AVRH VCC 74 P18/AN08/SCK2_2/MAD15_0 External Bus Address Line 15 75 P19/AN09/SIN4_1/IC00_1/INT05_1/MAD16_0 External Bus Address Line 16 76 P1A/AN10/SOT4_1/IC01_1/MAD17_0 External Bus Address Line 17 77 P1B/AN11/SCK4_1/IC02_1/MAD18_0 External Bus Address Line 18 78 P1C/AN12/CTS4_1/IC03_1/MAD19_0 External Bus Address Line 19 79 P1D/AN13/RTS4_1/DTTI0X_1/MAD20_0 External Bus Address Line 20 80 P1E/AN14/ADTG_5/FRCK0_1/MAD21_0 External Bus Address Line 21 81 P1F/ADTG_4/TIOB6_2/RTO05_1 Unused Pin available at X1 82 P27/TIOA6_2/RTO04_1/INT02_2 Multicon 1 83 P26/TIOB5_0/SCK2_1/RTO03_1 Unused Pin available at X1 84 P25/TX1_0/TIOA5_0/SOT2_1/RTO02_1 TFT VSYNC Signal 85 P24/RX1_0/SIN2_1/RTO01_1/INT01_2 Multicon 1 86 P23/AN15/TIOA7_1/SCK0_0/RTO00_1/MAD22_0 External Bus Address Line 22 87 P22/CROUT_0/AN16/TIOB7_1/SOT0_0/ZIN1_1 UART0 TX 88 P21/AN17/SIN0_0/BIN1_1/INT06_1/MAD23_0 UART0 RX © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (5/6) Pin 29 Function Description 89 P20/AN18/AIN1_1/INT05_0/MAD24_0 Touch Header / Touch Button SW1 90 VSS VSS 91 VCC VCC 92 P0E/TIOB5_2/SCS6_1/IC13_0/S_CLK_0/MDQM1_0 SDRAM UDQM 93 P0D/TIOA5_2/SCK6_1/IC12_0/S_CMD_0/MDQM0_0 SDRAM LDQM 94 P0C/TIOA6_1/SOT6_1/IC11_0/S_DATA1_0/MALE_0 TFT Clock Signal 95 P0B/TIOB6_1/SIN6_1/IC10_0/INT00_1/S_DATA0_0/MCSX0_0 96 P0A/SIN1_0/FRCK1_0/INT12_2/S_DATA3_0/MCSX1_0 External Flash Chip Enable (CS 0) SDRAM / SRAM Chip Enable (CS 1) 97 P09/AN19/TRACED0/TIOA3_2/SOT1_0/S_DATA2_0/MCSX5_0 Touch Header / Touch Button SW2 98 P08/AN20/TRACED1/TIOB3_2/SCK1_0/MCSX4_0 Touch Header / Touch Button SW3 99 P07/AN21/TRACED2/TIOA0_2/SCK7_0/MCLKOUT_0 Touch Header / Touch Button SW4 100 P06/AN22/TRACED3/TIOB0_2/SOT7_0/MCSX3_0 Touch Header / Touch Button SW5 101 P05/AN23/ADTG_0/TRACECLK/SIN7_0/INT01_1/MCSX2_0 Touch Header / Touch Button SW6 102 P04/TDO/SWO JTAG / SWD 103 P03/TMS/SWDIO JTAG / SWD 104 P02/TDI/MCSX6_0 JTAG 105 P01/TCK/SWCLK JTAG / SWD 106 P00/TRSTX/MCSX7_0 JTAG 107 VSS VSS 108 P68/TIOB7_2/SCK3_0/INT00_2 Unused Pin available at X1 109 P67/TIOA7_2/SOT3_0 UART3 TX 110 P66/ADTG_8/SIN3_0/INT11_2 UART3 RX © 2013 Spansion Inc. Hardware Pin-List SK-FM3-120PMC-TFT (6/6) Pin 30 Function Description 111 P65/TIOB7_0/SCK5_1 Unused Pin available at X1 112 P64/TIOA7_0/SOT5_1/INT10_2 Multicon 2 113 P63/CROUT_1/RX0_2/SIN5_1/INT03_0/S_CD_0/MWEX_0 Flash / SRAM Write Enable 114 P62/ADTG_3/TX0_2/SIN5_0/INT04_1/S_WP_0/MOEX_0 Flash / SRAM Output Enable 115 P61/UHCONX0/TIOB2_2/SOT5_0/RTCCO_0/SUBOUT_0 USB0 (D+ 1,5k pullup) 116 P60/TIOA2_2/SCK5_0/NMIX/WKUP0/MRDY_0 USB0 (VBUS detection) 117 USBVCC USBVCC0 = VCC 118 P80/UDM0 USB0 (D-) 119 P81/UDP0 USB0 (D+) 120 VSS VSS © 2013 Spansion Inc. Hardware Connectors SK-FM3-176PMC-TFT CAN UART [ X5 ] Power [ J3 ] 40-pin TFT Connector [ J4 ] EDT TFT Connector [ X2 ] VCC [ X7 ] ADCs [ X3 ] 5V [ X4 ] GND CMSIS-DAP [ X1 ] GPIOs [ X14 ] Multicon 2 [ X11 ] Multicon 1 [ X18 ] JTAG [ X19 ] Ethernet 31 [ X13 ] USB [ X15 ] USB1 © 2013 Spansion Inc. [ X16 ]USB to UART + JTAG Hardware Connectors SK-FM3-120PMC-TFT CAN UART [ X5 ] Power [ J3 ] 40-pin TFT Connector [ J4 ] EDT TFT Connector [ X2 ] VCC [ X7 ] ADCs [ X3 ] 5V [ X4 ] GND CMSIS-DAP [ X1 ] GPIOs [ X14 ] Multicon 2 [ X11 ] Multicon 1 [ X18 ] JTAG [ X12 ] USB0 [ X16 ]USB to UART + JTAG 32 © 2013 Spansion Inc. Hardware Jumper Settings Top Side & Backlight dimming SOT UART Setting *1 MCUVCC USB Programming JP31 JP1 JP32 JP2 JP34 JP33 Backlight enable *1 UART Settings UART0 = RS232 UART3 = USB (default) JP31 JP32 0 U 0 U SIN UART Setting *1 R 3 R 3 UART3 = RS232 UART0 = USB JP31 JP32 0 U 0 U R 3 R 3 Prog. CMSIS-DAP JP30 33 © 2013 Spansion Inc. Hardware Jumper Settings Back Side & TFT data source JP35 JP36 JP37 CAN powering JP17 JP16 FRAM SDA, SCL, WP JP48 EDT TFT power control JP22 JP21 JP29 JP52 Connect ADCs to X7 JP38 JP39 JP40 JP41 JP42 JP43 JP44 JP45 JP46 JP47 JP49 JP50 JP51 JP3 JP4 JP5 JP6 JP8 JP7 JP10 JP9 JP12 JP11 JP14 JP13 JP15 FRAM Address JP53 JP54 JP55 JP56 JP57 Multicon 2 JP58 JP20 JP18 JP19 34 © 2013 Spansion Inc. Multicon 1 Connect ADCs to buttons Hardware Jumper Settings Back Side Schematic Symbol PCB Layout Cut to open Schematic Symbol PCB Layout Solder to close 35 © 2013 Spansion Inc. Hardware Jumper List JP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 36 Function USB Programming (closed) / UART Programming (open) MCUVCC Use ADC at X7 (AN01 for FM3, AN18 for FM4) Use ADC at X7 (AN02 for FM3, AN19 for FM4) Use ADC at X7 (AN03 for FM3, AN20 for FM4) Use ADC at X7 (AN04 for FM3, AN21 for FM4) Use ADC at X7 (AN16 for FM3, AN22for FM4) Use ADC at X7 (AN17 for FM3, AN23 for FM4) Use ADC at X7 (AN18 for FM3) Use ADC at X7 (AN19 for FM3) Use ADC at X7 (AN20 for FM3) Use ADC at X7 (AN21 for FM3) Use ADC at X7 (AN22 for FM3) Use ADC at X7 (AN23 for FM3) Use ADC at X7 (AN30 for FM3) Power CAN VCC Power CAN GND Multicon 1 I2C SCL Pullup Multicon 1 I2C SDA Pullup Multicon 1 Sin Multicon 1 I2C SCL Pullup Multicon 1 I2C SDA Pullup Fram WP FRAM SDA FRAM A2 FRAM A1 FRAM SCL FRAM A0 Multicon 2 Sin Programming Mode Spansion CMSIS-DAP © 2013 Spansion Inc. Default open closed open open open open open open open open open open open open open open open closed closed open closed closed closed closed open open closed open open open JP Function Default 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 UART SOT Selection: UART0=RS232, UART3=USB UART SIN Selection: UART0=RS232, UART3=USB Backlight enable Backlight dimming TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) EDT TFT Power on-off TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) TFT Data Source (1-2 = Port3 [only FM3], 2-3 = External Bus) Use SW1 Use SW2 Use SW3 Use SW4 Use SW5 Use SW6 Use SW7 0-R, U-3 0-R, U-3 open open 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 2-3 1-2 soldered 2-3 2-3 2-3 closed closed closed closed closed closed closed Examples 37 © 2013 Spansion Inc. Examples Structure of TFT Evaluation Board Example sk-fmx-xxxpmc-tft_<example>-vxx − common 38 TftScene.ftw source files for FM3 and FM4 TFT Wizard Scene File − gui_data pictures, animations, etc. in original format − sk-fm3-176pmc-tft_<example> MCU Template Structure for FM3 assembly option − sk-fm4-120pmc-tft_<example> MCU Template Structure for FM4 assembly option © 2013 Spansion Inc. Examples MCU Template Structure mbxxfxxxx_template-vxx − Common − Example ARM mb9bfd1xt_template.uvproj ARM/Keil µVision project file • output\release\*.hex Compiled and linked firmware Atollic • − 39 Example project for ARM µVision including startup file, linker and compiler settings • Common files (MCU headerfile, etc.) Example project for Atollic TrueStudio Including startup file, linker and compiler settings .project IAR Example project for IAR Embedded Workbench including startup file, linker and compiler settings • mb9bfd1xt_template.eww IAR Embedded Workbench Workspace File • output\release\exe\*.srec Compiled and linked firmware source Readme.txt © 2013 Spansion Inc. Source files Readme file Examples Register Please register to have access to capacitive touch technology and source code of the examples − Send eMail to: [email protected] (Subject: SK-FMx-xxxPMC-TFT Examples Registration) − Specify: Name Company Address eMail Address Telephone Number Will Capacitive Touch be used in future applications (YES/NO) Application / Intended purpose (optional) − You will get a passcode to install examples required 40 © 2013 Spansion Inc. Examples Overview Install examples as source code to harddrive (registration required): examples/setup.exe Examples can be used with 32KByte code size limitation at IAR. For Keil µVision and Atollic, the full licensed version is needed SK-FM3-176PMC-TFT − examples/fm3/mb9bfd1xt_template-v16.zip MCU Template Project − examples/sk-fm3-176pmc_tft_demo-v10.srec TFT Example / Demo (Fractal, Clock, TFT Wizard) − examples/sk-fm3-176pmc_tft_clock-v10.srec TFT Example: Clock − examples/sk-fm3-176pmc_tft_tftwizard-v10.srec TFT Example: TFT Wizard SK-FM4-120PMC-TFT 41 − examples/fm4/mb9bf56xr_template-v12.zip MCU Template Project − examples/sk-fm4-120pmc_tft_demo-v10.srec TFT Example / Demo (Fractal, Clock, TFT Wizard) − examples/sk-fm4-120pmc_tft_clock-v10.srec TFT Example: Clock − examples/sk-fm4-120pmc_tft_tftwizard-v10.srec (*.srec = precompiled firmware) TFT Example: TFT Wizard © 2013 Spansion Inc. Board API 42 © 2013 Spansion Inc. Board API Content Configure Board Peripherals RTC Buttons (SW1..SW7) CAN (X10) GPIOs (X1) Not part of board API FRAM − ETHERNET (X19) (only SK-FM3-176PMC-TFT) Multicon 1,2 (X11, X14) − USB (X12, X13, X15) SRAM − TFT (J3, J4) NOR Flash − NOR Flash (Spansion lld) Systick UART (X16 / X17) 43 © 2013 Spansion Inc. Board API Configure Board Peripherals boardconfig.h In boardconfig.h peripherals can be turned on/off or features can be set Example UART: BOARD_UART BOART_UART_CH BOART_UART_SPEED ON 0 115200 Example boardconfig.h #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define 44 BOARD_MULTICON BOARD_MULTICON1_MODE BOARD_MULTICON2_MODE BOARD_FRAM BOARD_TFTDRIVER BOARD_SYSTICK BOARD_GPIOX1 BOARD_SRAM BOARD_NORFLASH BOARD_TFT BOARD_BUTTON BOARD_UART BOART_UART_CH BOART_UART_SPEED BOARD_CAN BOARD_CAN_BAUDRATE BOARD_RTC BOARD_ETHERNET BOARD_USB © 2013 Spansion Inc. ON MulticonUnknown MulticonI2C ON ON ON ON ON ON ON ON ON 0 115200 ON BTR_500k_08_62_1 ON ON ON Board API Driving Buttons (SW1..SW7) Include „board.h“ (button.h) Enable GPIO usage via „boardconfig.h“ #define BOARD_BUTTON ON Board_Init(); must be called in main() Example, check if button is pressed: If (BUTTON_SW1_PRESSED()) { while(BUTTON_ANY_PRESSED()); // wait while any button is pressed /* do someething */ } Example read out pressed buttons uint8_t u8PressedButtons; u8PressedButtons = BUTTON_GET_MASK(); 45 © 2013 Spansion Inc. buttons.h / buttons.c Board API Driving GPIOs (X1) gpiox1.h / gpiox1.c Include „board.h“ (gpiox1.h) Enable GPIO usage via „boardconfig.h“ #define BOARD_GPIOX1 ON Board_Init(); must be called in main() Following Routines can be used: − x = bitmask of GPIOs to be set of FM3: PIN5..26, FM4: PIN5..9; PIN5 = bit0 GPIOX1_SET(x); // set pin GPIOX1_GET(x); // get pin GPIOX1_SETDDR(x); // set data direction (1 = out, 0 = in) GPIOX1_SETPFR(x); // PFR register (1 = peripheral, 0 = GPIO) GPIOX1_SETPCR(x); // Pullup-Enable (1 = Enabled, 0 = Disabled) 46 © 2013 Spansion Inc. Board API Driving FRAM fram.h / fram.c Include „board.h“ (multicon.h + fram.h) Enable GPIO usage via „boardconfig.h“ #define BOARD_MULTICON #define BOARD_FRAM ON ON Board_Init(); must be called in main() Following routines can be used: void Fram_Write(uint16_t u16Address, uint8_t u8Data); void Fram_WritePage(uint16_t u16Address, uint8_t* pu8Data, uint16_t u16DataLength); uint8_t Fram_Read(uint16_t u16Address); void Fram_ReadPage(uint16_t u16Address, uint8_t* pu8Data, uint16_t u16DataLength); 47 © 2013 Spansion Inc. Board API Multicon 1,2 (X11, X14) multicon.h / multicon.c Include „board.h“ (multicon.h + fram.h) Enable GPIO usage via „boardconfig.h“ #define BOARD_MULTICON ON Board_Init(); must be called in main() Usage of Multicon can be preconfigured via „boardconfig.h“ : /* Can be MulticonUnknown, MulticonI2C, MulticonSpi, MulticonUart */ #define BOARD_MULTICON1_MODE MulticonUnknown #define BOARD_MULTICON2_MODE MulticonI2C Following routines can be used: /* n = 1 or 2 */ MULTICONn_INIT(mode); /* mode = MulticonUnknown, MulticonI2C, MulticonSpi, MulticonUart */ MULTICONn_I2CSTART(data); MULTICONn_I2CSENDBYTE(data); MULTICONn_I2CCONTINUESENDBYTE(data); MULTICONn_I2CWRITESTOP(); MULTICONn_I2CREADSTOP(); MULTICONn_I2CRCEIVEBYTE(); MULTICONn_UARTINIT(baudrate); /* MULTICONn_INIT(MulticonUart); must be called before */ MULTICONn_UARTHASDATA(); MULTICONn_SENDBYTE(x); MULTICONn_GETBYTE(x); 48 © 2013 Spansion Inc. Board API SRAM sram.h / sram.c Include „board.h“ (sram.h) Enable SRAM usage via „boardconfig.h“ #define BOARD_SYSTICK ON Board_Init(); must be called in main() Read SRAM uint16_t u16Data; uint32_t u32Offset = 1; u16Data = *((volatile uint16_t*)(0x68000000 + u32Offset*2)); Write SRAM Uint16_t u16Data = 0x1234; Uint32_t u32Offset = 1; *((volatile uint16_t*)(0x68000000 + u32Offset*2)) = u16Data; 49 © 2013 Spansion Inc. Board API Systick (1/2) boardsystick.h / boardsystick.c Include „board.h“ (boardsystick.h) Enable systick usage via „boardconfig.h“ #define BOARD_SYSTICK ON Board_Init(); must be called in main() Example, wait ms BoardSystick_WaitMs(1000); // wait 1 second Example measure time (up to 4 parallel measurements) uint32_t u32Measure; // variable to store measured time in ms BoardSystick_StartMeasure(&u32Measure); /* do something */ BoardSystick_StopMeasure(&u32Measure); 50 © 2013 Spansion Inc. Board API Systick (2/2) Example Tasks void MyTask(void) { /* do something */ } int32_t Main(void) { BoardSystick_AddTask(MyTask,100); //task called every ms while(...) { ... } BoardSystick_RemoveTask(MyTask); //remove task } Definition Uptime typedef struct stc_board_uptime { volatile uint32_t u32MSeconds; volatile uint32_t u32Seconds; volatile uint32_t u32Minutes; volatile uint32_t u32Hours; volatile uint32_t u32Days; } stc_board_uptime_t; extern volatile uint32_t u32BoardMsTick; extern stc_board_uptime_t stcBoardUptime; 51 © 2013 Spansion Inc. boardsystick.h / boardsystick.c Board API RTC boardrtc.h / boardrtc.c Include „board.h“ (boardrtc.h) Enable RTC usage via „boardconfig.h“ #define BOARD_RTC ON Board_Init(); must be called in main() Example set time stc_boardrtc_datetime_t myTime; myTime.u8Second = 0; ///< Second (Format 0...59) myTime.u8Minute = 2; ///< Minutes (Format 0...59) myTime.u8Hour = 1; ///< Hour (Format 0...23) myTime.u8Day = 1; ///< Day (Format 1...31) myTime.u8DayOfWeek = 0; ///< Day of the week (Format 0...6) myTime.u8Month = 1; ///< Month (Foramt 1...12) myTime.u8Year = 13; ///< Year (Format 1...99) + 2000 BoardRtc_SetTime(&myTime); Get Time stc_boardrtc_datetime_t myTime; BoardRtc_GetTime(&myTime); 52 © 2013 Spansion Inc. Board API UART (X16 / X17) uart.h / uart.c Include „board.h“ (uart.h) Enable UART usage via „boardconfig.h“ BOARD_UART BOART_UART_CH BOART_UART_SPEED ON 0 115200 Board_Init(); must be called in main() Following API is available boolean_t Uart_Init(uint8_t u8Uart, uint32_t Baudrate); void Uart_Putch(uint8_t u8Uart, char_t c); boolean_t Uart_HasData(uint8_t u8Uart); boolean_t Uart_DefaultHasData(void); void putch(char_t c); char_t Uart_Getch(uint8_t u8Uart); char_t getch(void); void Uart_Puts(uint8_t u8Uart, char_t* String); int puts(const char_t* String); void puthex(uint32_t n, uint8_t digits); void putdec(uint32_t x); unsigned long ASCIItobin(uint8_t k); void receive_line(void); int receive_line_echo(int *cnt); int scan_line(char_t *str) ; unsigned long Inputhex(uint8_t digits); 53 © 2013 Spansion Inc. Board API CAN (X10) boardcan.h / boardcan.c Include „board.h“ (uart.h) Enable CAN usage via „boardconfig.h“ #define BOARD_CAN #define BOARD_CAN_BAUDRATE ON BTR_500k_08_62_1 Board_Init(); must be called in main() Following API is available boolean_t BoardCan_Deinit(uint8_t u8CanChannel); boolean_t BoardCan_Init(uint8_t u8CanChannel, uint32_t u32Baudrate); boolean_t BoardCan_SetRxBuffer(uint8_t u8CanChannel, uint8_t u8Buffer, uint32_t u32Id, boolean_t bIrq, uint32_t u32Mask); boolean_t BoardCan_SendMessage(uint8_t u8CanChannel, uint8_t u8Buffer, uint32_t u32Id, uint8_t* pu8Buffer); int BoardCan_GetRxBuffer(uint8_t u8CanChannel); int BoardCan_ReadMessage(uint8_t u8CanChannel, uint8_t u8Buffer, uint32_t* pu32Id, uint8_t* pu8Buffer); 54 © 2013 Spansion Inc. FMColor - TFT Driver 55 © 2013 Spansion Inc. FMColor How to connect a TFT TFTs can be connected in two different ways: − TFT connected to external bus − TFT connected to GPIOs For internal RAM maximum resolution is 320x240 with 8-bit color at devices with minimum 96KByte RAM External SRAM can be used to reach 16-bit color with a resolution of up to 480x272 (8-bit or 16-bit external bus supported) GPIO MCU TFT VRAM Video RAM internal, TFT connected via Ext.-Bus or GPIO 56 © 2013 Spansion Inc. MCU Ext.-Bus TFT MCU Ext.-Bus TFT VRAM VRAM Video RAM at Ext.-Bus, TFT connected via Ext.-Bus Video RAM at Ext.-Bus, TFT connected via GPIO FMColor Software Modules The TFT implementation consists of three modules: − TFT Driver − TFT Objects − TFT UART UART API Object API TftUart TftObjects Graphics API tftsettings.h Graphics API User Settings tftio.h TftDriver tftdisplays.h Base Timer 57 © 2013 Spansion Inc. Base Timer DMAC Preconfigured TFTs Hardware Abstraction Layer FMColor Software Modules The TFT implementation consists of three modules: − TFT Driver − TFT Objects − TFT UART UART API Object API TftUart TftObjects Graphics API tftsettings.h Graphics API User Settings tftio.h TftDriver tftdisplays.h Base Timer 58 © 2013 Spansion Inc. Base Timer DMAC Preconfigured TFTs Hardware Abstraction Layer FMColor TFT Driver The TFT driver handles generation of TFT timings and draws data from video RAM (RAM) to the TFT Different headerfiles defining TFT type and used GPIOs to drive the TFT Simple graphic routines helping to draw standard geometrics like lines, circles, rectangles tftsettings.h Graphics API User Settings tftio.h TftDriver tftdisplays.h Base Timer 59 © 2013 Spansion Inc. Base Timer DMAC Preconfigured TFTs Hardware Abstraction Layer FMColor Used Peripherals For driving the TFT, two Base Timers and one DMA channel is used − Base Timer A generates display clock DCLK − Base Timer B generates the HSYNC timing Base Timer A Base Timer B Duty Interrupt Duty Cycle Interrupt Cycle − The DMA writes parallel data to the TFT and is started for the visible area of the TFT and stops after TFT_WIDTH cycles Data DMA 60 © 2013 Spansion Inc. TFT_WIDTH cycles FMColor TFT Driver – HSYNC Timing (summery) HSYNC – Cycle (= Backporch + Display width + Frontporch) HSYNC - Backporch HSYNC – Display width HSYNC - Frontporch DCLK TFT HSYNC Timing HSYNC Data Dummy D0 D1 Dx Dummy Base Timer A Base Timer B Duty Interrupt Duty Cycle Data DMA 61 © 2013 Spansion Inc. TFT_WIDTH cycles Cycle Interrupt Peripheral Timing FMColor TFT Driver – VSYNC Timing VSYNC – Cycle (= Backporch + Display width + Frontporch) VSYNC- Backporch VSYNC VSYNC- Display height / lines VSYNC – Frontporch HSYNC Idle (DMA off) 62 © 2013 Spansion Inc. TFT filled via DMA Idle (DMA off) FMColor TFT Driver – Display Buildup The TFT can be updated during the TFT invisible areas when the bus is free x y Bus Free VSYNC BACKPORCH update video content allowed 1 2 3 ... 2 3 ... Bus Used by DMA Display Area HSYNC BACKPORCH HSYNC FRONTPORCH VSYNC FRONTPORCH 63 © 2013 Spansion Inc. do not read or write video RAM from main application Bus Free update video content allowed FMColor tftsettings.h (1/2) tftsettings.h The tftsettings.h file is used to specify TFT related settings (dimension, frequency, timing, etc.) The tftsettings.h file can contain settings for known TFTs or for customized settings Example known TFT (ET0350G0DM6, 16-bit color) (TFT_DISPLAY_TYPE_ET0350G0DM6 defined in tftdislays.h) #ifndef __TFTSETTINGS_H__ #define __TFTSETTINGS_H__ #define #define #define #define #define TFT_MODE TFT_ORIENTATION TFT_DISPLAY_TYPE TFT_RGB_MODE TFT_COLOR_SIZE #endif 64 © 2013 Spansion Inc. TFT_MODE_HSYNC_VSYNC TFT_ORIENTATION_0 TFT_DISPLAY_TYPE_ET0350G0DM6 TFT_RGB_MODE_BGR565 16ul FMColor tftsettings.h (2/2) tftsettings.h Example custom TFT #ifndef __TFTSETTINGS_H__ #define __TFTSETTINGS_H__ #define #define #define #define #define TFT_MODE TFT_ORIENTATION TFT_DISPLAY_TYPE TFT_RGB_MODE TFT_COLOR_SIZE #define #define #define #define #define #define #define #define #define #define TFT_PIXEL_RATE TFT_WIDTH TFT_HEIGHT TFT_HSYNC_CYCLE TFT_HSYNC_BACKPORCH TFT_HSYNC_FRONTPORCH TFT_HSYNC_DISPLAYAREA TFT_VSYNC_BACKPORCH TFT_VSYNC_FRONTPORCH TFT_VSYNC_DISPLAYAREA #endif 65 © 2013 Spansion Inc. TFT_MODE_HSYNC_VSYNC TFT_ORIENTATION_0 TFT_DISPLAY_TYPE_USERDEFINED TFT_RGB_MODE_BGR565 16ul 5000000UL 320 240 408 68 20 TFT_WIDTH 18 4 TFT_HEIGHT FMColor tftio.h (1/3) tftio.h The tftio.h headerfile is used to configure the hardware connection of the TFT − HSYNC Pin (Example for SK-FM3-176PMC-TFT) #define TFT_CODE_PIN_HSYNC_INIT bFM3_GPIO_PFR4_P4 = 0;\ bFM3_GPIO_DDR4_P4 = 1 #define TFT_CODE_PIN_HSYNC_SET bFM3_GPIO_PDOR4_P4 = 1 #define TFT_CODE_PIN_HSYNC_CLEAR bFM3_GPIO_PDOR4_P4 = 0; #define TFT_HSYNC_BASETIMER 0 − VSYNC Pin (Example for SK-FM3-176PMC-TFT) #define TFT_CODE_PIN_VSYNC_INIT bFM3_GPIO_PFR4_P5 = 0;\ bFM3_GPIO_DDR4_P5 = 1 #define TFT_CODE_PIN_VSYNC_SET bFM3_GPIO_PDOR4_P5 = 1 #define TFT_CODE_PIN_VSYNC_CLEAR bFM3_GPIO_PDOR4_P5 = 0 66 © 2013 Spansion Inc. FMColor tftio.h (2/3) tftio.h − Data Port (Example for SK-FM3-176PMC-TFT) #define TFT_CODE_PORT_DATA_INIT /* external bus interface used */ #define TFT_PORT_DATA_ADDRESS &u16Dummy //write into dummy address − Reset Pin (Example for SK-FM3-176PMC-TFT) #define TFT_CODE_PIN_RESET_INIT /* no reset connected */ #define TFT_CODE_PIN_RESET_SET /* no reset connected */ #define TFT_CODE_PIN_RESET_CLEAR /* no reset connected */ − ENB / DE Pin (Example for SK-FM3-176PMC-TFT) #define TFT_CODE_PIN_ENB_INIT bFM3_GPIO_PFR4_P1 = 0;\ bFM3_GPIO_DDR4_P1 = 1 #define TFT_CODE_PIN_ENB_SET bFM3_GPIO_PDOR4_P1 = 1 #define TFT_CODE_PIN_ENB_CLEAR bFM3_GPIO_PDOR4_P1 = 0 67 © 2013 Spansion Inc. FMColor tftio.h (3/3) tftio.h − DCLK Pin (Example for SK-FM3-176PMC-TFT) 68 #define TFT_CODE_PIN_DCLK_INIT bFM3_GPIO_PFR4_P2 = 0x1;\ bFM3_GPIO_DDR4_P2 = 0x1;\ bFM3_GPIO_PDOR4_P2 = 0x1;\ FM3_GPIO->EPFR04 |= (1 << 18) #define TFT_PIN_DCLK_ISSET (bFM3_GPIO_PDIR4_P2 == 1) #define TFT_DCLK_BASETIMER 2 #define TFT_DMAC 0 © 2013 Spansion Inc. FMColor API: Tft_Init tft.c / tft.h Used to initiate TFT module Example − Initiate TFT with internal RAM Definition void Tft_Init( color_t* pu8RamAddress ); color_t pTftBuffer[TFT_WIDTH * TFT_HEIGHT]; Tft_Init(pTftBuffer); − Initiate TFT with external RAM #define EXTRAM_ADDRESS 0x61000000 Tft_Init((color_t*)EXTRAM_ADDRESS); Parameter pu8RamAddress Returns none 69 © 2013 Spansion Inc. RAM Address FMColor API: Tft_SetPaintBuffer Used to set new paint buffer tft.c / tft.h Example − Initiate paint buffer with internal RAM Definition void Tft_SetPaintBuffer( color_t* pu8RamAddress ); color_t pTftBuffer[TFT_WIDTH * TFT_HEIGHT]; Tft_SetPaintBuffer(pTftBuffer); − Initiate paint buffer with external RAM #define EXTRAM_ADDRESS 0x61000000 Tft_SetPaintBuffer((color_t*)EXTRAM_ADDRESS); Parameter pu8RamAddress Returns none 70 © 2013 Spansion Inc. RAM Address FMColor API: Tft_GetPaintBuffer Used to get paint buffer Definition color_t* Tft_GetPaintBuffer(); Parameter none Returns RAM Address 71 © 2013 Spansion Inc. tft.c / tft.h Example − Get paint buffer color_t* pTftBuffer; pTftBuffer = Tft_GetPaintBuffer(); FMColor API: Tft_SetDisplayBuffer Used to set new display buffer tft.c / tft.h Example − Initiate paint buffer with internal RAM Definition void Tft_SetDisplayBuffer( color_t* pu8RamAddress ); color_t pTftBuffer[TFT_WIDTH * TFT_HEIGHT]; Tft_SetDisplayBuffer(pTftBuffer); − Initiate paint buffer with external RAM #define EXTRAM_ADDRESS 0x61000000 Tft_SetDisplayBuffer((color_t*)EXTRAM_ADDRESS) ; Parameter pu8RamAddress Returns none 72 © 2013 Spansion Inc. RAM Address FMColor API: Tft_GetDisplayBuffer Used to get display buffer Definition color_t* Tft_GetDisplayBuffer(); Parameter none Returns RAM Address 73 © 2013 Spansion Inc. tft.c / tft.h Example − Get displaybuffer color_t* pTftBuffer; pTftBuffer = Tft_GetDisplayBuffer(); FMColor API: Tft_GetTftSettings Get orientation, width and height of TFT Definition stc_tft_settings_t Tft_GetTftSettings(); Parameter none Returns Orientation, width and height 74 © 2013 Spansion Inc. tft.c / tft.h Example − Get orientation, width and height uint16_t o,w,h; o = Tft_GetTftSettings().u16Orientation; w = Tft_GetTftSettings().u16Width; h = Tft_GetTftSettings().u16Height; FMColor API: Tft_Clear Used to clear TFT with a color void Tft_Clear( color_t color ); Parameter Fill color Returns none 75 Example − Clear TFT with white color Definition color tft.c / tft.h © 2013 Spansion Inc. Tft_Clear(RGB(0xFF,0xFF,0xFF)); FMColor API: Tft_ReadRam Used to readout rectangle of data tft.c / tft.h Example − Readout rect at 10,10 with size 10,50 Definition Tft_ReadRam( uint16_t uint16_t uint16_t uint16_t color_t* ); u16X, u16Y, u16Width, u16Height, pBuffer x y Parameter u16X u16Y u16Width u16height pBuffer x position y position width height buffer to write data Returns none 76 © 2013 Spansion Inc. Color_t pBuffer[10*50]; Tft_ReadRam(10,10,10,50,pBuffer); FMColor API: Tft_DrawBuffer Used to readout rectangle of data Definition Tft_DrawBuffer( uint16_t u16X, uint16_t u16Y, uint16_t u16Width, uint16_t u16Height, uint8_t u8Orientation, color_t* pBuffer ); tft.c / tft.h Example − Write data rect at 10,10 with size 10,50 x y Parameter u16X x position u16Y y position u16Width width u16height height u8Orientation 0,90,180,270 pBuffer buffer to write data Returns none 77 © 2013 Spansion Inc. Color_t pBuffer[10*50]; Tft_DrawBuffer(10,10,10,50,0,pBuffer); FMColor API: Tft_DrawPixel Used to set pixel tft.c / tft.h Example − draw pixel at 10,10 color red Definition Void Tft_DrawPixel( uint16_t u16X, uint16_t u16Y, color_t color, ); x y Parameter u16X u16Y color x position y position color Returns none 78 © 2013 Spansion Inc. Tft_DrawPixel(10,10,RGB(0xFF,0,0)); FMColor API: Tft_GetPixel Used to get color of pixel tft.c / tft.h Example − get pixel at 10,10 (color red) Definition color_t Tft_GetPixel( uint16_t u16X, uint16_t u16Y, ); x y Parameter u16X u16Y x position y position Returns color_t color of pixel 79 © 2013 Spansion Inc. color_t c = Tft_GetPixel(10,10); FMColor API: Tft_DrawLine tft.c / tft.h Used to draw line Example − draw red line from 10,10 to 60,10 Definition void Tft_DrawLine( uint16_t u16X0, uint16_t u16Y0, uint16_t u16X1, uint16_t u16Y1, color_t color ); x y Parameter u16X0 u16Y0 u16X0 u16Y0 Color x position y position x position y position color Returns none 80 © 2013 Spansion Inc. of of of of point point point point A A B B Tft_DrawLine(10,10,60,10,RGB(0xFF,0,0)); FMColor API: Tft_DrawRect Used to draw rect Definition void Tft_DrawRect( uint16_t u16X, uint16_t u16Y, uint16_t u16Width, uint16_t u16Height, color_t Color ); tft.c / tft.h Example − draw red rect from 10,10 with size 60,10 x y Parameter u16X u16Y u16Width u16Height Color x position from left y position from top width height color Returns none 81 © 2013 Spansion Inc. Tft_DrawRect(10,10,60,10,RGB(0xFF,0,0)); FMColor API: Tft_DrawFilledRect Used to draw filled rect Definition void Tft_DrawFilledRect( uint16_t u16X, uint16_t u16Y, uint16_t u16Width, uint16_t u16Height, color_t Color ); tft.c / tft.h Example − draw red filled rect from 10,10 with size 60,10 x y Parameter u16X u16Y u16Width u16Height Color x position from left y position from top width height color Returns none 82 © 2013 Spansion Inc. Tft_DrawFilledRect(10,10,60,10,RGB(0xFF,0,0)); FMColor API: Tft_DrawCircle Used to draw circle Definition void Tft_DrawCircle( uint16_t u16X, uint16_t u16Y, uint16_t u16R, color_t Color ); tft.c / tft.h Example − draw red filled circle at 10,10 with radius 5 x y Parameter u16X u16Y u16R Color x position y position radius color Returns none 83 © 2013 Spansion Inc. Tft_DrawCircle(10,10,5,RGB(0xFF,0,0)); FMColor API: Tft_DrawFilledCircle Used to draw filled circle tft.c / tft.h Example − draw red circle at 10,10 with radius 5 Definition void Tft_DrawFilledCircle( uint16_t u16X, uint16_t u16Y, uint16_t u16R, color_t Color ); x y Parameter u16X u16Y u16R Color x position y position radius color Returns none 84 © 2013 Spansion Inc. Tft_DrawFilledCircle(10,10,5,RGB(0xFF,0,0)); FMColor API: Tft_DrawChar Used to draw char Definition uint16_t Tft_DrawChar( uint16_t u16X, uint16_t u16Y, char_t cChar, color_t Color, color_t BackgroundColor ); Parameter u16X x position from left u16Y y position from top cChar char to write Color front color BackgroundColor back color Returns X position of right corner 85 © 2013 Spansion Inc. tft.c / tft.h Example − draw red char at 10,10 with transparent background x y A return value Tft_DrawChar(10,10,’A’,RGB(0xFF,0,0), TFT_COLOR_TRANSPARENT); FMColor API: Tft_DrawText Used to draw char Definition uint16_t Tft_ Tft_DrawText( uint16_t u16X, uint16_t u16Y, char_t* pcString, color_t Color, color_t BackgroundColor ); Parameter u16X x position from left u16Y y position from top cChar char to write Color front color BackgroundColor back color Returns X position of right corner 86 © 2013 Spansion Inc. tft.c / tft.h Example − draw red char at 10,10 with transparent background x y Hello World return value Tft_DrawText(10,10,”Hello World”, RGB(0xFF,0,0), TFT_COLOR_TRANSPARENT); FMColor Software Modules The TFT implementation consists of three modules: − TFT Driver − TFT Objects − TFT UART UART API Object API TftUart TftObjects Graphics API tftsettings.h Graphics API User Settings tftio.h TFT Driver tftdisplays.h Base Timer 87 © 2013 Spansion Inc. Base Timer DMAC Preconfigured TFTs Hardware Abstraction Layer FMColor TFT Objects tftobjects.c / tftobjects.h The TFT Objects Module is used to draw static and dynamic content synchronized with the buildup of TFT Main Application - edit values of objects - execute code TFT Objects - manage objects - initiate paint routines synced with TFT Paint Routine - update changed values The module provides different objects for building HMIs (buttons, checkbox, text, etc.) For interaction with the user, mouse and touch routines are added 88 © 2013 Spansion Inc. FMColor TFT Objects - How to draw contents synchronously Objects can be drawn static or dynamic. Main Application Paint Routine − Static Objects Change Value Request Object Redraw ... Redraw Object − Dynamic Objects Change Value ... Redraw Object Change Value ... 89 © 2013 Spansion Inc. Redraw Object tftobjects.c / tftobjects.h FMColor TFT Objects – Object Management tftobjects.c / tftobjects.h The object management is done with a list of objects Object Object Object previous next previous next previous next Objects can be: − Added (object will be automatic redrawn while adding) − Removed − Redrawn (object will be automatic redrawn while adding) 90 © 2013 Spansion Inc. FMColor TFT Objects – Object Management Clear object list void TftObjects_RemoveAllObjects(void); Add new object void TftObjects_AddObject(stc_tftobjects_object_t* pstcObject); Remove specific object void TftObjects_RemoveObject(stc_tftobjects_object_t* pstcObject); Redraw object void TftObjects_Redraw(stc_tftobjects_object_t* pstcObject); Redraw all objects void TftObjects_RedrawAll(void); 91 © 2013 Spansion Inc. tftobjects.c / tftobjects.h FMColor TFT Objects - Scenes tftobjects.c / tftobjects.h With different object lists, different scenes can be created − Example: 92 Scene 1 Scene 2 Scene 3 Remove All Objects Remove All Objects Remove All Objects Add Object A Add Object D Add Object G Add Object B Add Object E Add Object H Add Object C Add Object F Add Object I © 2013 Spansion Inc. FMColor TFT Objects - Parts 93 tftobjects.c / tftobjects.h Static Pictures / Images Animations Fixed Text Progress Bars Buttons Check Boxes Gauges Timers (Events synchronized with the TFT) Cursor (USB Mouse, Capacitive Touch, Remote Control) © 2013 Spansion Inc. FMColor TFT Objects - Creation tftobjects.c / tftobjects.h For object creation, placement and resource data conversion the TFT Wizard can be used Convert Resources Initialize Objects Arrange Objects Create Object List TFT Scene The TFT Wizard creates a TFT scene with the same name as its configuration file. With it all objects values will be initialized, resources will be linked and objects will be added to a new objects list 94 © 2013 Spansion Inc. FMColor TFT Objects – Object Definition tftobjects.c / tftobjects.h A Tft Object is defined as following structure struct stc_tftobjects_object { en_tftobjects_object_type_t enType; stc_tft_location_t stcLocation; stc_tft_size_t stcSize; color_t ForeColor; color_t ForeColorDisabled; color_t BackColor; boolean_t bVisible; boolean_t bEnabled; tftobjects_mousedown_func_ptr_t pfnMouseDownCallback; tftobjects_mouseup_func_ptr_t pfnMouseUpCallback; tftobjects_mousemove_func_ptr_t pfnMouseMoveCallback; tftobjects_mousemove_func_ptr_t pfnMouseEnterCallback; tftobjects_mousemove_func_ptr_t pfnMouseLeaveCallback; tftobjects_clicked_func_ptr_t pfnMouseClickedCallback; tftobjects_paint_func_ptr_t pfnPaintCallback; uint32_t u32RedrawInterval; uint32_t u32RedrawCounter; void* pstcObject; color_t* pRedrawBuffer; stc_tftobjects_object_t* pstcPrevObject; stc_tftobjects_object_t* pstcNextObject; } stc_tftobjects_object_t; 95 © 2013 Spansion Inc. ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< object type x,y location width, height fore color fore color disabled back color visible enabled callback mouse down callback mouse up callback mouse move callback mouse enter callback mouse leave callback mouse clicked paint task redraw interval, 0 for static must be initialized 0 additional settings if not used, initialized NULL must be initialized NULL must be initialized NULL FMColor TFT Objects – Object Example (1/2) tftobjects.c / tftobjects.h A TFT Object must be configured and added to the list of objects in a scene Example (object value initialization) stc_tftobjects_object_t stcMyObject = { enTypeObjectsTypeCustom, {10,10}, {50,50}, RGB(0,0,0), RGB(0xAA,0xAA,0xAA), RGB(0xFF,0xFF,0xFF), TRUE, TRUE, NULL, NULL, NULL, NULL, NULL, NULL, MyObjectPaint , 1000, 0, NULL, NULL, NULL, NULL, }; 96 © 2013 Spansion Inc. ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< ///< object type x,y location width, height fore color fore color disabled back color visible enabled callback mouse down callback mouse up callback mouse move callback mouse enter callback mouse leave callback mouse clicked paint task redraw interval, 0 for static must be initialized 0 additional settings if not used, initialized NULL must be initialized NULL must be initialized NULL FMColor TFT Objects – Object Example (2/2) Example (complete): #include ”tft.h” #include ”tftobjects.h” void MyObjectPaint(stc_tftobjects_object_t* pstcHandle); stc_tftobjects_object_t stcMyObject = {/* see object value initialization */ }; void MyObjectPaint(stc_tftobjects_object_t* pstcHandle) { Tft_DrawCircle(pstcHandle->pstcLocation.u16X, pstcHandle->pstcLocation.u16Y, pstcHandle->pstcSize.u16Width / 2, pstcHandle->ForeColor); } void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyObject); while(1); // loop forever, do other stuff } 97 © 2013 Spansion Inc. tftobjects.c / tftobjects.h FMColor TFT Objects – Pictures and Images Example (object value initialization like standard object) stc_tftobjects_object_t stcMyPicture = { enTftObjectsTypePicture, ... NULL, 0, ... &stcAdvancedSettingsMyPicture ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete) #include ”tft.h” #include ”tftobjects.h” stc_tftobjects_picture_t stcAdvancedSettingsMyPicture = { (color_t*)pbackground320x240_jpg, //< pBuffer (as const data) "background320x240.jpg", //< pFileName }; stc_tftobjects_object_t stcMyPicture = {/* see object value initialization */ }; void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyPicture); while(1); // loop forever, do other stuff } 98 © 2013 Spansion Inc. tftobjects.c / tftobjects.h FMColor TFT Objects – Animations tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyAnimation = { enTftObjectsTypeAnimation, ... NULL, 100, ... &stcAdvancedSettingsMyAnimation ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete) #include ”tft.h” #include ”tftobjects.h” stc_tftobjects_picture_t stcAdvancedSettingsMyAnimation = { 11, //< u8Count 0, //< u8CurrentPosition pEye, //< pAnimationData "eye.gif", //< pFileName }; stc_tftobjects_object_t stcMyAnimation = {/* see object value initialization */ }; void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyAnimation); while(1); // loop forever, do other stuff } 99 © 2013 Spansion Inc. FMColor TFT Objects – Fixed Text tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyText = { enTftObjectsTypeFixedText, ... NULL, 0, ... ”Hello World” ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete) #include ”tft.h” #include ”tftobjects.h” stc_tftobjects_object_t stcMyText = {/* see object value initialization */ }; void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyText); while(1); // loop forever, do other stuff } 100 © 2013 Spansion Inc. FMColor TFT Objects – Progressbar tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyProgressBar = { enTftObjectsTypeProgressbar, ... NULL, 1000, ... &stcMyProgressBarAdditionalSettings ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete) #include ”tft.h” #include ”tftobjects.h” stc_tftobjects_processbar_t stcMyProgressBarAdditionalSettings = { 0, //< u32Min 100, //< u32Max 0, //< u32Pos 100, //< u32PosOld }; stc_tftobjects_object_t stcMyProgressBar = {/* see object value initialization */ }; void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyProgressBar); while(1) // loop forever, do other stuff { stcMyProgressBarAdditionalSettings.u32Pos++; // update processbar } } 101 © 2013 Spansion Inc. FMColor TFT Objects – Buttons tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyButton = { enTftObjectsTypeButton, ... NULL, 0, ... &stcMyButtonAdditionalSettings ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete 1/2) #include ”tft.h” #include ”tftobjects.h” void ButtonClicked(stc_tftobjects_object_t* pstcHandle, stc_tft_location_t* pstcLocation); stc_tftobjects_button_t stcMyButtonAdditionalSettings = { ”Hello”, //< pcText FALSE, //< bPressed FALSE, //< bPressedOld; ButtonClicked, //< pfnButtonClickedCallback; RGB(0xFF,0,0) //< BackColorPressed }; stc_tftobjects_object_t stcMyButton = {/* see object value initialization */ }; void ButtonClicked(stc_tftobjects_object_t* pstcHandle, stc_tft_location_t* pstcLocation); { Tft_DrawCircle(10,10,5,RGB(0xFF,0,0)); } 102 © 2013 Spansion Inc. FMColor TFT Objects – Buttons tftobjects.c / tftobjects.h Example (complete 2/2) void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyButton); while(1); // loop forever, do other stuff } The example draws a red circle at 10,10 with radius 5 after the button was pressed by a USB mouse click for example 103 © 2013 Spansion Inc. FMColor TFT Objects – Checkboxes tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyCheckbox = { enTftObjectsTypeCheckBox, ... NULL, 0, ... &stcMyButtonAdditionalSettings ... }; ///< object type ///< paint task ///< redraw interval, 0 for static ///< additional settings Example (complete) #include ”tft.h” #include ”tftobjects.h” void CheckboxClicked(stc_tftobjects_object_t* pstcHandle, stc_tft_location_t* pstcLocation); stc_tftobjects_button_t stcMyCheckboxAdditionalSettings = { ”Make me red”, //< pcText FALSE, //< bPressed FALSE, //< bPressedOld; ButtonClicked, //< pfnButtonClickedCallback; FALSE //< bChecked; }; stc_tftobjects_object_t stcMyCheckbox = {/* see object value initialization */ }; void CheckboxClicked(stc_tftobjects_object_t* pstcHandle, stc_tft_location_t* pstcLocation); { stcMyCheckboxAdditionalSettings.bChecked = ! stcMyCheckboxAdditionalSettings.bChecked; Tft_DrawCircle(10,10,5,RGB(0xFF,0xFF,0xFF)); if (stcMyCheckboxAdditionalSettings.bChecked) Tft_DrawCircle(10,10,5,RGB(0xFF,0,0)); } 104 © 2013 Spansion Inc. FMColor TFT Objects – Checkboxes tftobjects.c / tftobjects.h Example (complete 2/2) void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyCheckbox); while(1); // loop forever, do other stuff } The example draws a red circle at 10,10 with radius 5 after checkbox was pressed by a USB mouse click for example 105 © 2013 Spansion Inc. FMColor TFT Objects – Timers tftobjects.c / tftobjects.h Example (object value initialization like standard object) stc_tftobjects_object_t stcMyProcessBar = { enTftObjectsTypeTimer, ... MyTimerProc, 1000, ... }; ///< object type ///< paint task ///< redraw interval, 0 for static Example (complete) #include ”tft.h” #include ”tftobjects.h” void MyTimerProc(stc_tftobjects_object_t* pstcHandle); stc_tftobjects_object_t stcMyTimer = {/* see object value initialization */ }; void MyTimerProc(stc_tftobjects_object_t* pstcHandle); { /* periodically draw red circle */ Tft_DrawCircle(10,10,5,RGB(0xFF,0,0)); } void MyScene_Init(void) { TftObjects_RemoveAllObjects(); TftObjects_AddObject(&stcMyTimer); while(1); // loop forever, do other stuff } 106 © 2013 Spansion Inc. FMColor TFT Objects – Cursors tftobjects.c / tftobjects.h The cursor is drawn automatically − To use tftobjects with USB mouse, set following define in tftobjects.h: #define TFTOBJECTS_USE_USBMOUSE 1 − If other pointing devices are used, following procedures can be used: Create mouse move event void TftObjects_CallMouseMove(stc_tft_location_t* pstcLocation); Create mouse button down event void TftObjects_CallMouseDown(stc_tft_location_t* pstcLocation); Create mouse button up event void TftObjects_CallMouseUp(stc_tft_location_t* pstcLocation); 107 © 2013 Spansion Inc. FMColor Software Modules The TFT implementation consists of three modules: − TFT Driver − TFT Objects − TFT UART UART API Object API TftUart TftObjects Graphics API tftsettings.h Graphics API User Settings tftio.h TFT Driver tftdisplays.h Base Timer 108 © 2013 Spansion Inc. Base Timer DMAC Preconfigured TFTs Hardware Abstraction Layer FMColor TFT UART This module emulates a console at the TFT Following procedures are available void void void void void void TftUart_Init(void); TftUart_SetBackgroundColor(color_t color); TftUart_SetColor(color_t color); TftUart_Cls(void); TftUart_PutChar(char_t c); TftUart_PutString(char_t *String); This module is useful for debugging purposes only 109 © 2013 Spansion Inc. Serial Port Viewer & Terminal 110 © 2013 Spansion Inc. Serial Port Viewer & Terminal Spansion Serial Port Viewer This Windows based tool is used to view existing com ports. The program appears as a tray icon next to the Windows clock in the taskbar. Via right-click for existing com ports a terminal window can be opened. Please download latest version at http://www.spansion.com or request direct download link via [email protected] Start installation from CDROM software/serialportviewer/setup.exe 111 © 2013 Spansion Inc. USB Configuration Tool 112 © 2013 Spansion Inc. USB Configuration Tool Spansion USB Wizard Available at http://www.spansion.com or contact [email protected] for direct download link 113 © 2013 Spansion Inc. USB Configuration Tool Spansion USB Wizard Microcontroller Template IDE Settings Evaluation Board Support Special Components Linker Settings Compiler Settings Assembler Settings Startup Settings USB Pin Configuration LED Buttons UART USB Application / Example © 2013 Spansion Inc. Host / Device Virtual Com Port Mouse The USB Wizard combines different settings and configurations into an example 114 USB Application (API) LibUSB Custom TFT Wizard 115 © 2013 Spansion Inc. FMColor TFT Objects - Creation tftobjects.c / tftobjects.h For object creation, placement and resource data conversion the TFT Wizard can be used Convert Resources Initialize Objects Arrange Objects Create Object List TFT Scene The TFT Wizard creates a TFT scene with the same name as its configuration file. With it all objects values will be initialized, resources will be linked and objects will be added to a new objects list Start Installation from CDROM: software/tftwizard/setup.exe Please download latest version at http://www.spansion.com or request direct download link via [email protected] 116 © 2013 Spansion Inc. TFT Wizard Spansion TFT Wizard Create new scene 6 − (1) Select source path 2 3 − (2) Add new objects 4 − (3) Arrange objects 5 right-click at objects, to delete or change layer 1 − (4) Change global settings Open Existing Background Color Orientation TFT Size − (5) Edit object properties − (6) Save & Create TFT Scene 117 © 2013 Spansion Inc. − (5) Load Scene − Change Scene − (5) Save & Create TFT Scene Examples Structure of TFT Evaluation Board Example sk-fmx-xxxpmc-tft_<example>-vxx − common source files for FM3 and FM4 TftScene.ftw TFT Wizard Scene File − gui_data pictures, animations, etc. in original format − sk-fm3-176pmc-tft_<example> MCU Template Structure for FM3 assembly option − sk-fm4-120pmc-tft_<example> MCU Template Structure for FM4 assembly option The preconfigured TFT Scene can be found here 118 © 2013 Spansion Inc. Serial Programming 119 © 2013 Spansion Inc. Serial Programming How to use Flash MCU Programmer for FM3 / FM4 (1/2) Start the FLASH MCU Programmer (Install software/flashprogrammer_serial/setup.exe) Please download latest version via http://www.spansion.com or request direct download link via [email protected] (1) Select the target microcontroller − MB9BD18S/T (SK-FM3-176PMC-TFT) − MB9B568M/N/R (SK-FM4-120PMC-TFT) (2) Select the crystal frequency (4 MHz) (3) Via 'Open' button: Choose the binary file (*.hex, *.srec or *.mhx) in subfolder 'release' or 'exe'. (See also MCU Template Structure and Structure of TFT Evaluation Board Example) 120 © 2013 Spansion Inc. 1: Example project for ARM µVision including startup file, linker and compiler settings 2: Firmware output directory, contains firmware as *.hex file 3: Example project for Atollic TrueStudio including startup file, linker and compiler settings 4: Example project for IAR Embedded Workbench including startup file, linker and compiler settings 5: Firmware output directory, contains firmware as Motorola S-Record *.srec file 6: Source files directory Serial Programming How to use Flash MCU Programmer for FM3 / FM4 (2/2) Be sure JP1 is open Switch S1 to position "Prog." at the evaluation board Press Reset. The MCU is now in programming mode. Press 'Full Operation (D+E+B+P)' in the FLASH MCU Programmer Wait until the flash process had finished. Close the FLASH USB DIRECT Programmer Set switch S1 to position RUN Press Reset 121 © 2013 Spansion Inc. USB Programming 122 © 2013 Spansion Inc. USB Programming How to use USB Direct Programmer for FM3 / FM4 (1/2) Start the FLASH MCU Programmer (Install software/flashprogrammer_usb/setup.exe) Please download latest version via http://www.spansion.com or request direct download link via [email protected] (1) Select the target microcontroller − MB9BD18S/T (SK-FM3-176PMC-TFT) − MB9B568M/N/R (SK-FM4-120PMC-TFT) (2) Select the Com Port, the evaluation board was detected (3) Via 'Open' button: Choose the binary file (*.hex, *.srec or *.mhx) in subfolder 'release' or 'exe'. (See also MCU Template Structure and Structure of TFT Evaluation Board Example) 123 © 2013 Spansion Inc. 1: Example project for ARM µVision including startup file, linker and compiler settings 2: Firmware output directory, contains firmware as *.hex file 3: Example project for Atollic TrueStudio including startup file, linker and compiler settings 4: Example project for IAR Embedded Workbench including startup file, linker and compiler settings 5: Firmware output directory, contains firmware as Motorola S-Record *.srec file 6: Source files directory USB Programming How to use USB Direct Programmer for FM3 / FM4 (2/2) Be sure JP1 at the evaluation board is closed Switch S1 to position "Prog." at the evaluation board Connect evaluation board via USB (X12 or X13) Press Reset. The MCU is now in programming mode. Start the USB DIRECT Programmer Press 'Full Operation (D+E+B+P)' in the FUJITSU FLASH MCU Programmer Wait the flash process had finished. Close the FLASH Programmer Set switch S1 to position RUN Press Reset 124 © 2013 Spansion Inc. Debugging with CMSIS-DAP 125 © 2013 Spansion Inc. Debugging with CMSIS-DAP Definition (ARM-Webpage) CMSIS-DAP is the interface firmware for a Debug Unit that connects the Debug Port to USB. Debuggers, which execute on a host computer, connect via USB to the Debug Unit and to the Device that runs the application software. The Debug Unit connects via JTAG or SW to the target Device. ARM Cortex processors provide the CoreSight Debug and Trace Unit. CMSIS-DAP supports target devices that contain one or more Cortex processors. 126 © 2013 Spansion Inc. Debugging with CMSIS-DAP Additional Features Spansion CMSIS-DAP implementation offers − 1 channel JTAG or SWD (Single Wire Debug) − Additional 1 channel UART / RS232 JTAG / SWD & USB UART / RS232 127 © 2013 Spansion Inc. Debugging with CMSIS-DAP Install Drivers Install „ Drivers for CMSIS-DAP & Programming“ (software\drivers\setup.exe) 128 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in IAR EWARM (1) Navigate to project options: − via Files-List Right-click at the project Select „Options...“ − or via menu „Project“ Select „Options...“ See also Chapter Debugging (IAR EWARM) 129 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in IAR EWARM (2) Setup Project Debugger Options − (1) Navigate to Debugger 2 1 3 − (2) Select tab „Setup“ − (3) Select Driver „CMSIS-DAP“ 5 − (4) Select in „CMSIS-DAP“ − (5) Select tab „JTAG/SWD“ 6 4 − (6) Select SWD See also Chapter Debugging (IAR EWARM) 130 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in Keil µVision (1) Navigate to project options: − via Project Right-click at the project Select „Options...“ − or via menu „Project“ Select „Options...“ See also Chapter Debugging (Keil µVision) 131 © 2013 Spansion Inc. Debugging with CMSIS-DAP 1 Setup in Keil µVision (2) Setup Debug & Utilities − (1) Select tab „Debug“ 2 − (2) Select „CMSIS-DAP Debugger“ 3 − (3) Select tab „Utilities“ − (4) Select „CMSIS-DAP Debugger“ 4 See also Chapter Debugging (Keil µVision) 132 © 2013 Spansion Inc. Debugging (IAR EWARM) 133 © 2013 Spansion Inc. Debugging (IAR EWARM) IAR Development Tools (Software) EWARM-KS (Kickstart) Free download − 32K C/C++ Compiler, Assembler, IAR Embedded Workbench, Debugger/Simulator, no library support EWARM-EV (Evaluation) Free download − 30 day full verison of C/C++ Compiler, Assembler, IAR Embedded Workbench, Debugger/Simulator EWARM-BS (Base Line) − 256K C/C++ Compiler, Assembler, IAR Embedded Workbench, Debugger/Simulator EWARM (Full Version) − C/C++ Compiler, Assembler, IAR Embedded Workbench, Debugger/Simulator EWARM-CM (Cortex M Series) − C/C++ Compiler, Assembler, IAR Embedded Workbench, Debugger/Simulator 134 © 2013 Spansion Inc. Debugging (IAR EWARM) IAR Development Tools (Hardware) J-LINK ARM Lite − 20-Pin JTAG to USB adapter (only 3.3 Volt support) J-LINK (JTAG adapter for ARM) − 20-Pin JTAG to USB adapter J-TRACE for ARM Cortex M3 (JTAG trace adapter for ARM) − 20-Pin JTAG to USB adapter − 20-Pin JTAG ETM to USB adapter 135 © 2013 Spansion Inc. Debugging (IAR EWARM) Installation Download latest version of EWARM from IAR Website − EWARM 30-day Evaluation Version http://supp.iar.com/Download/SW/?item=EWARM-EVAL − EWARM 32K Kickstart Version http://supp.iar.com/Download/SW/?item=EWARM-KS32 Install EWARM Install J-LINK Debugger − Connect J-LINK to USB Port and follow installation advices Drivers: <Installation_Path>\IAR Systems\Embedded Workbench x.y\arm\drivers\Jlink\ x64 or x86 Start EWARM Workbench 136 © 2013 Spansion Inc. Debugging (IAR EWARM) Getting Started IAR Information Center − Getting Started − User Guides − Example Projects − Tutorials − Support − Release Notes − Can always be displayed by: Help → Information Center 137 © 2013 Spansion Inc. Debugging (IAR EWARM) Choose Example Project Choose Manufacturer − Use Fujitsu − Use MB9BF500 − Use IAR KSK-MB9BF506 − Open a project Browse to folder, if necessary 138 © 2013 Spansion Inc. Debugging (IAR EWARM) Main Window IAR Workbench − Workspace on left side of Workbench window Choose: View→Workspace, if hidden − Source files on right side of Workbench window as tabbed windows − Project can alternatively be opened by: File→Open→ Workspace→*.eww 139 © 2013 Spansion Inc. Debugging (IAR EWARM) Menu Bar 140 File Control Configuration Control (new, open, save, etc.) Build Control (e.g. RAM or ROM debugging) (compile, make, stop build) Edit Control Navigation Control Debug Control (cut, copy, paste, undo, redo) (Find, Bookmarks, File Navigation, etc.) (Breakpoint, start Debug w/ and w/o download) © 2013 Spansion Inc. Debugging (IAR EWARM) Workspace Window Project Name Sub Folder Modules Main Modules Module Includes Project Description Project Built Output 141 © 2013 Spansion Inc. Debugging (IAR EWARM) Making Project Use Make-Icon ( ), <F7> or Menu: Project→Make Check for no errors in Output window below Build errors are indicated by or in Output window and Source view 142 © 2013 Spansion Inc. Debugging (IAR EWARM) Download to Target and Start Debugging Use Icon, <Ctrl>-D, or Project→Download and Debug A new menu bar will occur on sucessful connection to target Reset Target Step Over Stop 143 © 2013 Spansion Inc. Step Out Step Into Run to Cursor Next Statement Run End Debugging Trace Control Debugging (IAR EWARM) Debug Windows Source Window − The Source windows do not change contents but get additional information Current line (PC): Halted on breakpoint: Halted on data break (example): Disassembly Window − Shows "pure" disassebly view − Shows mixed mode view 144 © 2013 Spansion Inc. Debugging (IAR EWARM) Debug Windows Memory Window − The Memory window is a tabbed part of the Output window Register View − Some Registers are grouped and can be unfolded 145 © 2013 Spansion Inc. Debugging (IAR EWARM) Debug Windows Breakpoint Window − The Breakpoint window is a tabbed part of the Output window − Breakpoints can be enabled and disabled in Source window 146 ( enabled, disabled) Breakpoint window ( enabled, disabled) © 2013 Spansion Inc. Debugging (IAR EWARM) Watch Windows Watch Windows − Watch Expressions/Variables have to be added by user and are updated by Halt/Breakpoint − Locals Functional local Expressions/Variables are added by Workbench itself, if PC is in function context − Statics Functional local Expressions/Variables are added by Workbench itself, if PC is in function context − Live Watch Expressions/Variables have to be added by user and are updated during runtime (with performance impact) − Auto Expressions/Variables are added by Workbench itself near the current PC in Halt/Breakpoint 147 © 2013 Spansion Inc. Debugging (IAR EWARM) Debug Windows Watch Windows − Quick Watch The Quick watch allows the user to calculate and recalculate expressions even with variables The drop down menu memorizes the last typed contents 148 © 2013 Spansion Inc. Debugging (IAR EWARM) Debug Windows Symbolic Memory − References the project Symbols to a memory view Call Stack − Can be displayed with or without called arguments − Last called function (current) is marked with green arrow, callers are below 149 © 2013 Spansion Inc. Debugging (IAR EWARM) Debug Windows Stack − Show current Stack context with local variables (if existing), including graphical stack usage (if enabled) Terminal I/O − Allows debug information printed-out via printf() function − Log can be output to a file Code Coverage − Shows the percentage of code covered by application run Needs ETM connection to Debugger (J-Trace) Profiling − Shows the number of calls of each project function by application run Activated by „Show details“ and/or „Autorefresh“ Symbols − Shows the project‘s symbols in a list with their address references 150 © 2013 Spansion Inc. Debugging (IAR EWARM) JTAG Connection JTAG Connection Type (J-LINK) − JTAG − Serial Wire Debugging (SWD) Chose: Options → General Options → Library Configuration → Library Low-Level Interface Implementation Check: - Via semihosting for JTAG and SWD - Via SWD for only SWD 151 © 2013 Spansion Inc. Debugging with CMSIS-DAP Definition (ARM-Webpage) CMSIS-DAP is the interface firmware for a Debug Unit that connects the Debug Port to USB. Debuggers, which execute on a host computer, connect via USB to the Debug Unit and to the Device that runs the application software. The Debug Unit connects via JTAG or SW to the target Device. ARM Cortex processors provide the CoreSight Debug and Trace Unit. CMSIS-DAP supports target devices that contain one or more Cortex processors. 152 © 2013 Spansion Inc. Debugging with CMSIS-DAP Additional Features Spansion CMSIS-DAP implementation offers − 1 channel JTAG or SWD (Single Wire Debug) − Additional 1 channel UART / RS232 JTAG / SWD & USB UART / RS232 153 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in IAR EWARM (1) Navigate to project options: − Via Files-List Right-click at the project Select „Options...“ − Or via menu „Project“ Select „Options...“ See also Chapter Debugging (IAR EWARM) 154 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in IAR EWARM (2) Setup Project Debugger Options − (1) Navigate to Debugger 2 1 3 − (2) Select tab „Setup“ − (3) Select Driver „CMSIS-DAP“ 5 − (4) Select in „CMSIS-DAP“ − (5) Select tab „JTAG/SWD“ 6 4 − (6) Select SWD See also Chapter Debugging (IAR EWARM) 155 © 2013 Spansion Inc. Debugging (IAR EWARM) JTAG Connection JTAG Connection Type (J-LINK) − JTAG − Serial Wire Debugging (SWD) Chose: Options → J-Link/J-Trace → Connection → Interface Check: - JTAG - SWD when semihosting was chosen - Only SWD (greyed) when SWD only was chosen 156 © 2013 Spansion Inc. Debugging (IAR EWARM) Simulator Mark Project File in Workspace Choose Project→Options Choose Simulator in Debugger Setup Start Simulator with usual 157 © 2013 Spansion Inc. Icon Debugging (Keil µVision) 158 © 2013 Spansion Inc. Debugging (Keil µVision) Keil Development Tools (Software) MDK-ARM-EVALUATION Free download − 32K C/C++ Compiler, Assembler, µVision IDE/Debugger/Simulator MDK-ARM-B (Basic Edition) − 256K C/C++ Compiler, Assembler, µVision IDE/Debugger/Simulator MDK-ARM (Standard Edition) − C/C++ Compiler, Assembler, µVision IDE/Debugger/Sim., RTX Kernel ULINK-ME − USB-JTAG adapter (only 3.3 Volt support) ULINK2 − USB-JTAG adapter ULINKpro − High-Speed debug and trace unit 159 © 2013 Spansion Inc. Debugging (Keil µVision) Installation Download latest version of µVision from KEIL Website − Evaluation Version https://www.keil.com/demo/eval/arm.htm Free download Registration required Install µVision Install ULINK-ME − Special installation is not needed, because ULINK-ME acts as a USB Human Interface Device (HID) and thus needs no extra USB driver Install ULINK Pro (optional) − ULINK Pro needs an own dedicated USB driver located in: <Installation Path>\Keil\ARM\ULINK Start µVision 160 © 2013 Spansion Inc. Debugging (Keil µVision) Getting started Choose Menu: Project→Open Project... − Browse to: <Installation Path>\Keil\ARM\Boards\Keil\MCB9BF500\Blinky − Choose Blinky.uvproj 161 © 2013 Spansion Inc. Debugging (Keil µVision) Main Window KEIL µVision − Project window on left side of IDE window Choose: View→Project Window if hidden − Source files on right side of IDE window as tabbed windows − Output window on bottom side of IDE window 162 © 2013 Spansion Inc. Debugging (Keil µVision) Menu Bars Menu Bar 1 − Can be moved in bar window area or set floating 163 File Control Navigation Control (new, open, save, etc.) (Bookmarks + search, etc.) (Text search, search in files, etc.) © 2013 Spansion Inc. Edit Control Debug Control (cut, copy, paste, etc) (indention, commenting) (Start/Stop Debug Session, set/remove/disable breakpoints, remove/disable all breakpoints) Project Window View IDE Configuration Debugging (Keil µVision) Menu Bars Menu Bar 2 − Can be moved in bar window area or set floating Configuration Build Control Manage Books, Control (Compile [Translate], File Extensions, (e.g. RAM or ROM Build, Rebuild, etc.) Environment debugging) Download to Target 164 © 2013 Spansion Inc. Target Options Manage MultiProject Workspace Debugging (Keil µVision) µVision Project Window Project Name Startup Code Subfolder Startup Code Source and Header Files Main Project Code Subfolder Main Project Code Source and Header Files Project Description Subfolder and Abstract File 165 © 2013 Spansion Inc. Debugging (Keil µVision) Making Project Making the Project − Use Rebuild Icon ( ) or Project→Rebuild all target files − Check for no errors in Output window below − Build errors are shown in Output window. Can be double-clicked by showing the source line with a blue arrow 166 © 2013 Spansion Inc. Debugging (Keil µVision) Start Debugging Download to target first, when MCU Flash does not contain the current application openend and built in the IDE − Use Download Icon ( ) or Menu: Flash→Download Start Debug Session − Use Start/Stop Debug Icon ( Session ) or Menu: Debug→Start/Stop Debug Ending Debug Session − Use same way as for starting debug session 167 © 2013 Spansion Inc. Debugging (Keil µVision) Debugging Icon Bar During a Debug Session there will be visible a new icon bar Reset Target Step Control (Step in, out, etc.) Start/ Stop Application 168 © 2013 Spansion Inc. Show Source/Code Line of current PC Show Windows (Command, Disassembly, Symbols, Registers, Call Stack) Show (multiple) Windows (Watch, Memory, Serial, Analysis, Trace, System Viewer) Tool Box (can be customized) Debug Restore Views Debugging (Keil µVision) Debug Windows Source View − The Source windows do not change contents but get additional information Active Breakpoint Disabled Breakpoint Current Program Counter Current Cursor Line of Source Code Code Lines with compiled Instructions (dark grey ) 169 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Disassembly View − Mixed mode is selectable and deselectable Active Breakpoint Disabled Breakpoint Current Program Counter Current Cursor Line of Code highlighted in yellow background ( ) 170 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Memory Window − Up to 4 Memory windows can be displayed in tabs − Memory is updated during runtime − Memory window tabs are shared with Watch windows Register View − Register view is a tab of the Project window − Changes are highlighted in dark blue text background − Register tree knots can be expanded 171 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Breakpoints − Not a Workspace window, but a Dialog window − Can opened by menu: Debug→Breakpoints... or <Ctrl>-B − Any changes can only be seen in Workspace after "Close" − Conditional expressions can be entered here 172 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Variable Windows (1) − Watch Windows Up to 2 Watch windows are sharing their tabs with e.g. Memory and Local views Updated during runtime Any changes are highlighted in dark blue text backround color Displayed values can be changed by user during break 173 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Variable Windows (1) − Watch Windows Up to 2 Watch windows are sharing their tabs with e.g. Memory and Local views Updated during runtime Any changes are highlighted in dark blue text backround color Displayed values can be changed by user during break 174 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Variable Windows (2) − Local View The local view shares the tab with e.g. Memory and Watch windows Any changes are highlighted in dark blue text backround color Displayed values can be changed by user during break 175 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Callstack − The Call Stack view shares its tab with the Variable and Memory window − It shows the current called function and their local environment − All displayed Call Stack values are not modifyable 176 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Symbol Window − The Symbol window shows all symbols of the user‘s project − It is sorted in tree form by dependence E.g. Project→Module→ Function→Symbol − Peripheral registers can also be displayed − Simulator VTREG can be displayed − Mouse-over a symbol shows its contents as a tool tip E.g.: 177 © 2013 Spansion Inc. AD_dbg = 0x01EB Debugging (Keil µVision) Debug Windows Terminal Windows − Up to 3 UART channels can be displayed − One direct printf view is supported (via ITM Viewer) 178 © 2013 Spansion Inc. Debugging (Keil µVision) Debug Windows Logic Analyzer − The IDE allows to display graphically the value of a variable − Adding a signal is as easy as adding to a Watch window − The Logic Analyzer is a tabbed window together with the Disassembly window 179 © 2013 Spansion Inc. Debugging (Keil µVision) Core Peripherals Nested Vectored Interrupt Controller − The NVIC settings for the Core Interrupts can be adjusted in a dialog window − Adjustments for: Enable/Pending Priority Interrupt Control & State Application Interrupt & Reset Control (PRIGROUP, ENDIANESS, ...) Vector Table Offset Software Interrupt Trigger 180 © 2013 Spansion Inc. Debugging (Keil µVision) Core Peripherals System Control Register (0xE000ED10) − Dialog window for setting bits for: SEVONPEND SLEEPDEEP SLEEPONEXIT Configuration Control Register (0xE000ED14) − Dialog window for setting bits for: NONBASETHRDENA USERSETMPEND UNALIGN_TRP DIV_0_TRP BFHFNMIGN 181 © 2013 Spansion Inc. Debugging (Keil µVision) Core Peripherals System Tick Timer (0xE000E010) − Dialog window for setting/watching: Control & Status Reload & Current value Calibration 182 © 2013 Spansion Inc. Debugging (Keil µVision) Core Peripherals Fault Reports − Dialog window for setting/watching: Memory Manage Faults Bus Faults Usage Faults Hard Faults Debug Faults 183 © 2013 Spansion Inc. Debugging (Keil µVision) Trace (ULINK ME) Trace via ITM − Simple Trace views via Instrumentation Trace Macro is supported by µLINK ME Records Exceptions Counters 184 © 2013 Spansion Inc. Debugging with CMSIS-DAP Definition (ARM-Webpage) CMSIS-DAP is the interface firmware for a Debug Unit that connects the Debug Port to USB. Debuggers, which execute on a host computer, connect via USB to the Debug Unit and to the Device that runs the application software. The Debug Unit connects via JTAG or SW to the target Device. ARM Cortex processors provide the CoreSight Debug and Trace Unit. CMSIS-DAP supports target devices that contain one or more Cortex processors. 185 © 2013 Spansion Inc. Debugging with CMSIS-DAP Additional Features Spansion CMSIS-DAP implementation offers − 1 channel JTAG or SWD (Single Wire Debug) − Additional 1 channel UART / RS232 JTAG / SWD & USB UART / RS232 186 © 2013 Spansion Inc. Debugging with CMSIS-DAP Setup in Keil µVision (1) Navigate to project options: − Via Project Right-click at the project Select „Options...“ − Or via menu „Project“ Select „Options...“ See also Chapter Debugging (Keil µVision) 187 © 2013 Spansion Inc. Debugging with CMSIS-DAP 1 Setup in Keil µVision (2) Setup Debug & Utilities − (1) Select tab „Debug“ 2 − (2) Select „CMSIS-DAP Debugger“ 3 − (3) Select tab „Utilities“ − (4) Select „CMSIS-DAP Debugger“ 4 See also Chapter Debugging (Keil µVision) 188 © 2013 Spansion Inc. Debugging (Keil µVision) ULINK Pro Trace via ETM − Check settings in menu: Flash→Configure Flash Tools... Tab:Debug enables ETM pins 189 © 2013 Spansion Inc. Debugging (Keil µVision) ULINK Pro Instruction Trace − Real Time Trace recording − Output can be filtered by several ETM and ITM events − Trace buffer is held in PC memory and transfered to µVision on break 190 © 2013 Spansion Inc. Debugging (Keil µVision) Trace Exceptions Exception Trace − Exception Trace has an own window, which can‘t be docked − Exception Types: System Exceptions User Exceptions (Interrupts) − Exception Trace: Count Total Time Several Points in Time: Min., Max., First, Last, etc. − Must be configured in: Debug→Debug Settings... Tab: Trace/Trace Events 191 © 2013 Spansion Inc. Debugging (Keil µVision) Event Counters Following counters are available: − Extra cycles per Instruction − Exception overhead cycles − Sleep cycles − Load store unit cycles − Folded instructions Counters count from 0 to 255 − Continue counting on overflow starting over from 0 Must be configured in: Debug→Debug Settings... Tab: Trace/Trace Events (Checkboxes) 192 © 2013 Spansion Inc. Debugging (Keil µVision) Performance Analyzer (ULINK Pro) Shows the execution of any function of an application in: − Number of calls − Execution time (absolute) − Execution time (percentage) It shares with a tab the Instruction Trace window and Code Coverage Module or function view is supported 193 © 2013 Spansion Inc. Debugging (Keil µVision) Code Coverage The Code Coverage shows the function execution by percentage of the function code It shares with a tab the Instruction Trace window and Performance view All or only a specific module can be chosen for display 194 © 2013 Spansion Inc. Debugging (Keil µVision) Simulator The Core Simulator can be selected by the menu: Flash→Configure Flash Tools... and then choosing Use Simulator Look & feel is like using ULINK debugger Controlable also with *.ini files 195 © 2013 Spansion Inc. Appendix 196 © 2013 Spansion Inc. Appendix Support / Contact eMail: [email protected] Website: http://www.spansion.com 197 © 2013 Spansion Inc. Appendix EU-Konformitätserklärung / EU declaration of conformity Hiermit erklären wir, Spansion International Inc., Germany Branch, Pittlerstrasse 47, 63225 Langen, Germany, dass dieses Board aufgrund seiner Konzipierung und Bauart sowie in den von uns in Verkehr gebrachten Ausführung(en) den grundlegenden Anforderungen der EU-Richtlinie 2004/108/EC „Elektromagnetische Verträglichkeit“ entspricht. Durch eine Veränderung des Boards (Hard- und/ oder Software) verliert diese Erklärung ihre Gültigkeit! We, Spansion International Inc., Germany Branch, Pittlerstrasse 47, 63225 Langen, Germany hereby declare that the design, construction and description circulated by us of this board complies with the appropriate basic safety and health requirements according to the EU Guideline 2004/108/EC entitled ’Electro-Magnetic Compatibility’. Any changes to the equipment (hardware and/ or software) will render this declaration invalid! Note: This evaluation board is a Class A product according to EN61326-1. It is intended to be used only in a laboratory environment and might cause radio interference when used in residential areas. In this case, the user must take appropriate measures to control and limit electromagnetic interference. All data and power supply lines connected to this starter kit should be kept as short as possible, with a maximum allowable length of 3m. Shielded cables should be used for data lines. As a rule of thumb, the cable length used when connecting external circuitry to the MCU pin header connectors for example should be less than 20cm. Longer cables may affect EMC performance and cause radio interference. 198 © 2013 Spansion Inc. Appendix Recycling Gültig für EU-Länder: − Gemäß der Europäischen WEEE-Richtlinie und deren Umsetzung in landesspezifische Gesetze nehmen wir dieses Gerät wieder zurück. − Zur Entsorgung schicken Sie das Gerät bitte an die folgende Adresse: Valid for European Union Countries: − According to the European WEEE-Directive and its implementation into national laws we take this device back. − For disposal please send the device to the following address: Spansion International Inc., Germany Branch c/o Fujitsu Semiconductor Warehouse/Disposal Monzastraße 4a D-63225 Langen This board is compliant with China RoHS 199 © 2013 Spansion Inc. www.spansion.com Spansion®, the Spansion logo, MirrorBit®, MirrorBit® Eclipse™ and combinations thereof are trademarks and registered trademarks of Spansion LLC in the United States and other countries. Other names used are for informational purposes only and may be trademarks of their respective owners. This document is for informational purposes only and subject to change without notice. Spansion does not represent that it is complete, accurate or up-to-date; it is provided “AS IS.” To the maximum extent permitted by law, Spansion disclaims any liability for loss or damages arising from use of or reliance on this document. 200 © 2013 Spansion Inc.