R EM MICROELECTRONIC - MARIN SA EMDB6812 EMDB6812 V1.1 MANUAL VERSION 1.0 CONTENTS 1. 2. INTRODUCTION ........................................................................................................................................ 2 HARDWARE DESCRIPTION ..................................................................................................................... 2 2.1 2.2 2.3 2.4 2.5 3. HARDWARE CONFIGURATION ............................................................................................................... 9 3.1 3.2 3.3 3.4 3.5 3.6 3.7 4. PARTS.....................................................................................................................................................................2 Hardware BOARD versionning ...............................................................................................................................3 DEMOBOARD DESCRIPTION ...............................................................................................................................3 2.3.1 Connector description ............................................................................................................................4 2.3.2 Demoboard Schematic ..........................................................................................................................6 SAMPLE BOARD DESCRIPTION ..........................................................................................................................7 2.4.1 SampleBoard schematic ........................................................................................................................7 Partlist......................................................................................................................................................................8 Power-Supply ..........................................................................................................................................................9 VPP/TEST ...............................................................................................................................................................9 Port A switches........................................................................................................................................................9 Port B leds .............................................................................................................................................................10 Oscillator................................................................................................................................................................10 Programming .........................................................................................................................................................10 Reset .....................................................................................................................................................................10 APPENDIX : DEMO APPLICATION ........................................................................................................ 11 4.1 4.2 4.3 4.4 4.5 Introduction............................................................................................................................................................11 Architecture ...........................................................................................................................................................11 4.2.1 Features ...............................................................................................................................................11 Function.................................................................................................................................................................11 Software ................................................................................................................................................................12 4.4.1 CPU operation Modes..........................................................................................................................12 4.4.2 Main loop..............................................................................................................................................12 4.4.3 RTC ......................................................................................................................................................13 4.4.4 Command GetTime, 0xA0 ...................................................................................................................14 4.4.5 Command SetTime, 0xA1....................................................................................................................14 4.4.6 Command SetTimer, 0xA2 ..................................................................................................................15 4.4.7 Command DisablePower, 0x80 ...........................................................................................................15 4.4.8 Command EnablePower, 0x81 ............................................................................................................16 4.4.9 Command SetPWM1, 0x82 .................................................................................................................16 4.4.10 Command SetPWM2, 0x83 .................................................................................................................16 4.4.11 Command SetOutputs, 0x84 ...............................................................................................................16 4.4.12 Command GetKeys, 0x90....................................................................................................................17 4.4.13 Command GetSVLD, 0x92 ..................................................................................................................17 HOST Application..................................................................................................................................................18 4.5.1 Setup ....................................................................................................................................................18 4.5.2 Commands ...........................................................................................................................................19 Copyright © 2004, EM Microelectronic-Marin SA 1 www.emmicroelectronic.com R EMDB6812 1. INTRODUCTION This document describes EMDB6812 Demoboard for EM6812 microcontroller. This board contains a Flash EM6812 microcontroller and additional parts to evaluate EM6812 product and test your application. You will be able to : - Program with external programmer the Flash EM6812 through the dedicated In-System-Programming connector or by On-Socket insertion mode - Evaluate or run your application with the help of the existing components assembled on the board (push-button, leds, buzzer, RS232 interface, switches) and open extensions (connectors, user area). 2. HARDWARE DESCRIPTION 2.1 PARTS The EMDB6812 is based on two PCBs : • • Main board (DemoBoard 6812) Socket for EM6812 Flash microcontroller (SampleBoard 6812) DemoBoard SampleBoard Copyright © 2004, EM Microelectronic-Marin SA 2 www.emmicroelectronic.com R EMDB6812 2.2 HARDWARE BOARD VERSIONNING DemoBoard V1.1 SampleBoard V1.0 2.3 DEMOBOARD DESCRIPTION PCB size : 160 mm x 100 mm S1 CON3 CON7 CON5 BATTERY … CON6 DIP1-8 SWITCH SELECTION DS9 S6 BUZ 1 DS1 USER AREA S7 CON1 DIP2-10 LEDS / BUZZER SELECTION U2 SOCKET S8 … CON8 BUZ 2 CON2 USER AREA S1…S6 DS1…DS8 BUZ1/BUZ2 DIP1-8 DIP2-10 BATTERY U2 DS9 S8 S7 CON1 CON2 CON3 & CON4 CON5 CON6 CON7 CON8 DS8 CON4 Free user area (2.54 mm and 1.27 mm) with power lines (GND and VDD_IN) 6 Push-Buttons connected to PA0…PA5 through DIP1-8 switches 8 Low-power red leds connected to PB0…PB7 through DIP2-10 switches Buzzers connected to PB0 through DIP2-10 switches Switches for S1…S6 connections (PA0…PA5), RX (PA6), TX (PA7) Switches for DS1…DS8 connections (PB0…PB7), Buzzers (PB0), pull-down (VPP_TEST) Battery socket (2032) Socket (DIL24) for Sample Board Low-power red led connected to EXT_VDD Switch for programming / application mode Reset Push-Button In-System-Programming connector User connections (Ground, Power, Reset, …) Port A, Port B user connector User connections (Ground, Power, Reset) DB9 connector for RS232 Power / Reset configuration connector External oscillator connections Copyright © 2004, EM Microelectronic-Marin SA 3 www.emmicroelectronic.com R EMDB6812 2.3.1 Connector description 2.3.1.1. CON1 In-System-Programming connector (compatibility Elnec programmer ISP cable) Header 2x5 male – 2.54 mm 1 2 3 4 5 6 7 8 9 10 Power X In X X Inout Power In Power Power VDD_IN N.C. RST_EXT N.C. N.C. SDIO GND SCLK GND VPP/TESTISP EM6812 VDD supply No Connect External reset No Connect No Connect Data IO program. Ground Clock program Ground VPP/TESTISP program. 2.3.1.2. CON2 User connector Header 1x8 male – 2.54 mm 1 2 3 4 5 6 7 8 Power Power In In In X Power Power GND VDD_EXT RST_EXT OSCIN_EXT OSCOUT_EXT N.C. VDD_IN GND Ground External VDD supply External reset External OSCIN connection External OSCOUT connection No Connect EM6812 VDD supply Ground 2.3.1.3. CON3, CON4 Port user connector Header 2x10 male – 2.54 mm 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Power Power Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Inout Power Power GND GND PA0 PB0 PA1 PB1 PA2 PB2 PA3 PB3 PA4 PB4 PA5 PB5 PA6 PB6 PA7 PB7 GND GND Copyright © 2004, EM Microelectronic-Marin SA Ground Ground Port A bit 0 Port B bit 0 Port A bit 1 Port B bit 1 Port A bit 2 Port B bit 2 Port A bit 3 Port B bit 3 Port A bit 4 Port B bit 4 Port A bit 5 Port B bit 5 Port A bit 6 Port B bit 6 Port A bit 7 Port B bit 7 Ground Ground 4 www.emmicroelectronic.com R EMDB6812 2.3.1.4. CON5 User connector Header 2x3 male – 2.54 mm 1 2 3 4 5 6 Power Power In Power Power X GND VDD_EXT RST_EXT VDD_IN GND N.C. Ground External VDD supply External reset EM6812 VDD supply Ground No Connect 2.3.1.5. CON6 RS232 User connector DB9 female 1 2 3 4 5 6 7 8 9 X Out In X Power X X X X N.C. TX RX N.C. GND N.C. N.C. N.C. N.C. No Connect RS232 Transmitter output RS232 Receiver input No Connect Ground No Connect No Connect No Connect No Connect 2.3.1.6. CON7 Configuration connector Header 2x7 male – 2.54 mm 1 2 3 4 5 6 7 8 9 10 11 12 19 20 Power Power Power Power Power Power In In Power Power Power Power Power Power GND GND VBAT VDD_IN VDD_EXT VDD_IN RST_EXT RESET_PAD VPP/TEST VPP/TESTISP VPP/TEST VPP/TESTISP GND GND Ground Ground Battery power supply EM6812 VDD supply External VDD supply EM6812 VDD supply External reset EM6812 reset EM6812 VPP/TEST VPP/TESTISP program. EM6812 VPP/TEST VPP/TESTISP program. Ground Ground 2.3.1.7. CON8 External oscillator connector Header 2x2 male – 2.54 mm 1 2 3 4 In In In In OSCOUT_EXT OSCOUT OSCIN_EXT OSCIN Copyright © 2004, EM Microelectronic-Marin SA External OSCOUT connection EM6812 OSCOUT connection External OSCIN connection EM6812 OSCIN connection 5 www.emmicroelectronic.com R EMDB6812 2.3.2 Demoboard Schematic Copyright © 2004, EM Microelectronic-Marin SA 6 www.emmicroelectronic.com R EMDB6812 2.4 SAMPLE BOARD DESCRIPTION PCB size : 35.56 mm x 24.88 mm Existing SampleBoard are one to one wired converter : • • DIL24 (600 mils width) to SOIC24(1.27 mm pitch – 300 mils body width) DIL24 (600 mils width) to TSSOP24 (0.65 mm pitch – 4.4mm body width) Each SampleBoard contains an EM6812 Flash Microcontroller and a Crystal 32768 Hz. 32768Hz EM6812 MCU 2.4.1 SampleBoard schematic Copyright © 2004, EM Microelectronic-Marin SA 7 www.emmicroelectronic.com R EMDB6812 2.5 PARTLIST Description Designator Footprint Value Battery Support for Typ 2032 BT1 BAT-2 Polarized Capacitor (Surface Mount) C1 2917 10uF Polarized Capacitor (Surface Mount) C2 1206 100nF Polarized Capacitor (Surface Mount) C3 1206 100nF Polarized Capacitor (Surface Mount) C4 1411 470nF Polarized Capacitor (Surface Mount) C5 1411 470nF Polarized Capacitor (Surface Mount) C6 1411 470nF Capacitor (Semiconductor SIM Model) C7 1206 100nF 470nF Constructor Ref Constructor KEYSTONE Capacitor (Semiconductor SIM Model) C8 1206 Header, 5-Pin, Dual row CON1 HDR2X5 Header, 8-Pin CON2 HDR1X8 Header, 3-Pin, Dual row CON5 HDR2X3 DB9, Right Angle CON6 DSUB1.385-2H9 Header, 7-Pin, Dual row CON7 HDR2X7 DIP Switch DIP1-8 DIP-16 Multicomp MCNDI-08S DIP Switch DIP2-10 DIP-20 Multicomp MCNDI-10S RED GaAs LED DS1 LED Temic TLMT3100 RED GaAs LED DS2 LED Temic TLMT3100 RED GaAs LED DS3 LED Temic TLMT3100 RED GaAs LED DS4 LED Temic TLMT3100 RED GaAs LED DS5 LED Temic TLMT3100 RED GaAs LED DS6 LED Temic TLMT3100 RED GaAs LED DS7 LED Temic TLMT3100 RED GaAs LED DS8 LED Temic TLMT3100 RED GaAs LED DS9 LED Temic TLMT3100 Header, 10-Pin, Dual row CON3 HDR2X10 Header, 10-Pin, Dual row CON4 HDR2X10 Header, 10-Pin, Dual row CON8 HDR2X10 Resistor R1 1206 27 Resistor R2 1206 27 Resistor R3 1206 27 Resistor R4 1206 27 Resistor R5 1206 100K Resistor R8 1206 100K Resistor R9 1206 47 Switch S1 SPST-2 ITT Canon KSC421J Switch S2 SPST-2 ITT Canon KSC421J Switch S3 SPST-2 ITT Canon KSC421J Switch S4 SPST-2 ITT Canon KSC421J Switch S5 SPST-2 ITT Canon KSC421J Switch S6 SPST-2 ITT Canon KSC421J Switch S7 SPST-2 ITT Canon KSC421J Switch S8 DPDTOS2020 ITT Canon OS202011MS2QN1 Low profil support 600 Mils DIL24 U2 DIP24 RS-232 Transceiver with AutoShutdown U3 SSO-G16/X.4 Maxim MAX3221CAE Copyright © 2004, EM Microelectronic-Marin SA 8 www.emmicroelectronic.com R EMDB6812 3. HARDWARE CONFIGURATION 3.1 POWER-SUPPLY EM6812 samples can be powered (VDD_IN) with two different sources : • • Battery : VBAT External Power-supply : VDD_EXT Selection is done with a jumper configuration on CON7 Battery configuration External configuration Jumper CON7-3 / CON7-4 ON OFF Jumper CON7-5 / CON7-6 OFF ON VBAT : • Requires CR2032 3V battery in socket BT1 • Can be measured on CON7-3 VDD_EXT : • Can be applied or measured on CON2-2 and CON5-2 • When applied will light on DS9 red led VDD_IN / IDD_IN: • VDD_IN is the operating power supply for the EM6812 • IDD_IN current measurement can be done by placing ammeter between CON7-3 / CON7-4 (Battery source) or CON7-5 / CON7-6 (External source) Notes : 1. For In-System-programming step refer to ISP programming application note for powersupply details. Safe operation procedure is to apply VDD_IN EM6812 from the programmer power-supply (CON1) : No other VBAT and VDD_EXT supplied and no load on the InSystem-Programming connections. 2. VDD_IN is connected to EM6812 VDD pin as the MAX3221 RS232 transceiver VCC (U3 + C2 capacitor) ! 3.2 VPP/TEST During programming sequence a jumper is needed on CON7-9 / CON7-10 or CON7-11 / CON7-12. This jumper does not need to be removed after programming. Optionally, an external pull-down can be connected on EM6812 TEST pin (Select ON for the DIP210 position 10). 3.3 PORT A SWITCHES S1…S6 switches can be connected to EM6812 Port A (Port A bit 0 … 5). Select ON for the corresponding DIP1-8 position (1…6). When the switch is activated, corresponding Port A bit is tied to ‘0’. RS232 transceiver (TX) can be connected to Port A bit 6. Select ON for the DIP1-8 position 7. RS232 transceiver (RX) can be connected to Port A bit 7. Select ON for the DIP1-8 position 8. Copyright © 2004, EM Microelectronic-Marin SA 9 www.emmicroelectronic.com R EMDB6812 3.4 PORT B LEDS DS1…DS8 leds can be connected to EM6812 Port B (Port B bit 0 … 7). Select ON for the corresponding DIP2-10 position (1…8). Buzzer (BUZ1 or BUZ2) can be connected to Port B bit 0. Select ON for the DIP2-10 position 9. 3.5 OSCILLATOR By default, a 32768Hz crystal is assembled on each SampleBoard. Optionally crystal capacitance can be added (2 empty footprints). For specific EM6812 modes, it can be necessary to use OSCIN/OSCOUT for other purpose. If necessary connect external signals on CON2-4 (OSCIN_EXT) or CON2-5 (OSCOUT_EXT) and place jumpers on CON8-1/CON8-2 or CON8-3/CON8-4. 3.6 PROGRAMMING During In-System-Programming it is recommended to isolate pins PB5 (SCLK) and PB7 (SDIO) from the application connections. Refer to ISP programming application note for details. A slide switch S8 selects the mode (programming or application) for both pins. For the current mode to be executed, you must ensure the appropriate switch position selection. 3.7 RESET A reset switch S7 reset the EM6812. It is also possible to add an external reset. This external reset (RST_EXT) must be applied on CON2-3 and must be enabled by adding a jumper on CON77/CON7-8. Copyright © 2004, EM Microelectronic-Marin SA 10 www.emmicroelectronic.com R EMDB6812 4. APPENDIX : DEMO APPLICATION 4.1 INTRODUCTION The goal is to run a typical User Front-end Controller which allows to keep the power consumption in standby mode at a minimum while RTC, Timer and Keyboard- handling are still fully working. Furthermore this controller shall serve as Power-On Reset, Battery Level Detector and IO Extension. Note: o = output i = input 4.2 ARCHITECTURE Microcontroller HOST_RX Host HOST_TX SWUART HOST_32k 32kHz HOST_PWR CTRL Keys Simulated by PC PWM SVLD Aux Outputs RTC / Timer 4.2.1 Features The Microcontroller has the following functions: • Power-On Reset • Serial Interface to the Host (Software UART) • RTC Timer • 32kHz digital clock output to the host • Power-Up of the Host • Battery Level Detector • Auxiliary Outputs • Key Inputs 4.3 FUNCTION When powering up the system, the Microcontroller is reset automatically, as soon as the ResetThreshold of its Power-On-Reset is reached. It will then initialize itself, Power-Up the Host, and enable the 32kHz Source which can be used by the Host. From now on, the Host can send commands via the serial interface to the Microcontroller to get/set the corresponding information. Available commands are: Copyright © 2004, EM Microelectronic-Marin SA 11 www.emmicroelectronic.com R EMDB6812 • • • • • • • • PowerDown, Powers down the Host (eg. if battery level too low) GetTime, Read the Time from the RTC SetTime, Set the RTC SetTimer, Set a Timer. As soon as it reaches zero, the Host is powered up. SetPWM (eg. PWM Outputs, can be used eg. for Led backlight) SetOutput, Set the Aux outputs GetKeys, Get the Key States GetEOL, get the Battery Level As soon as the Microcontroller detects that a key has been pressed, it sends the new key-State automatically to the Host! 4.4 SOFTWARE The Microprocessor has a Software-Half-Duplex UART incorporated which runs at 2400bps with 1 start-bit, 8 databits and 1 stopbit. Via this UART the following commands can be executed: • • • • • • • • 4.4.1 PowerDown GetTime SetTime SetTimer SetPWM (eg. For Led backlight) SetOutput GetKeys GetEOL CPU operation Modes The 32kHz Oscillator is always on for keeping accurate RTC timing The CPU clock is switched off during Idle mode During UART Reception/Transmission the Microcontroller uses the RC Oscillator, which runs at approximately 1MHz 4.4.2 Main loop PowerOn Reset Init Enable Host no RX on UART? Send echo no Valid command? Execute Cmd-Routine Copyright © 2004, EM Microelectronic-Marin SA 12 www.emmicroelectronic.com R EMDB6812 4.4.3 RTC IRQ 1Hz Inc vSec vSec > 59? no Inc vMin vMin > 59? no Inc vHrs vHrs > 59? no Inc vHrs Timer active? no Dec vTimer no VTimer = 0? Enable Host IRQ_1HZ END Copyright © 2004, EM Microelectronic-Marin SA 13 www.emmicroelectronic.com R EMDB6812 4.4.4 Command GetTime, 0xA0 Time is counted inside the microcontroller with a resolution of 1sec. The Host can set and read the time. TX RX Start 10000000 Cmd 10100000 Echo Hour Minutes Seconds 10100000 000ooooo 00oooooo 00oooooo Subroutine GetTime(void); GetTime Disable Interrupt Send Time to UART Enable Interrupt GetTime_End 4.4.5 Command SetTime, 0xA1 Time is counted inside the microcontroller with a resolution of 1sec. The Host can set and read the time. TX RX Start 10000000 Cmd 10100001 Echo Hour 000ooooo Minutes 00oooooo Seconds 00oooooo 10100001 Subroutine SetTime(void); SetTime Disable Interrupt Get Time from UART Enable Interrupt SetTime_End Copyright © 2004, EM Microelectronic-Marin SA 14 www.emmicroelectronic.com R EMDB6812 4.4.6 Command SetTimer, 0xA2 Before sending the Power-Down request to switch itself off, the Host can load the timer with a value between 1 and 255 seconds (0 is off). As soon as the timer reaches zero, the Microcontroller will start the Power-up sequence for the Host. TX RX Start 10000000 Cmd 10100010 Echo Timer Sec oooooooo 10100010 Subroutine SetTimer(void); SetTimer Get Timer value SetTimer_End 4.4.7 Command DisablePower, 0x80 Power down the Host. TX RX Start 10000000 Cmd 10000000 Echo 10000000 Subroutine DisablePower(void) ; DisablePower Disable 32kHz Output Set TX-Pin to 0 Disable Power-Pin DisablePower_End Copyright © 2004, EM Microelectronic-Marin SA 15 www.emmicroelectronic.com R EMDB6812 4.4.8 Command EnablePower, 0x81 Power up the Host. This command cannot be used in normal operation. Power-up is only executed, if Timer reaches 0 or an external key has been pressed. TX RX Start 10000000 Cmd 10000001 Echo 10000001 Subroutine EnablePower(void) ; EnablePower Enable Power-Pin Set TX-Pin to idle Enable 32kHz Output EnablePower_End 4.4.9 Command SetPWM1, 0x82 Sets the PWM output. 0 is off. Can be used for controlling for example a Led-Backlight. TX RX Start 10000000 Cmd 10000010 Echo PWM Val. oooooooo 10000010 4.4.10 Command SetPWM2, 0x83 Sets the PWM output. 0 is off. Can be used for controlling for example a Led-Backlight. TX RX Start 10000000 Cmd 10000011 Echo PWM Val. oooooooo 10000011 4.4.11 Command SetOutputs, 0x84 Set the Outputs. TX RX Start 10000000 Copyright © 2004, EM Microelectronic-Marin SA Cmd Echo 10000100 10000100 16 PWM Val. xxxxoooo www.emmicroelectronic.com R EMDB6812 Subroutine SetOutputs(void) ; SetOutputs Get value from UART Set Outputs SetOutputs_End 4.4.12 Command GetKeys, 0x90 Gets the state of the keys. TX RX Start 10000000 Cmd 10010000 Echo Key State 10010000 iiiiiiii As soon as a key is pressed, the Host is Powered up (if it was down) and the 2nd part of the message is send to the host automatically: TX RX Command Key State 10010000 iiiiiiii Subroutine GetKeys(void) ; GetKeys Call Enable_Power Send Key State GetKeys_End 4.4.13 Command GetSVLD, 0x92 Start a measurement of the Supply Voltage and return the result. 0x3f means, that there has an error occurred during measurement.. TX RX Start 10000000 Copyright © 2004, EM Microelectronic-Marin SA Cmd 10010010 Echo Key State 10010010 iiiiiiii 17 www.emmicroelectronic.com R EMDB6812 Subroutine GetSVLD(void) ; GetSVLD Start SVLD Measurement Send SVLD value to UART GetSVLD_End 4.5 HOST APPLICATION For testing the Microcontroller software, a MS-Windows based utility has been developed, which allows to send/receive the Host-Commands via serial COM-Ports. USB to RS232 converters are also supported. 4.5.1 Setup First you have to select the Com-Port you want to use. The Hardware has to be connected to the corresponding Com-Port by a 9pol serial cable. Wiring is 1:1 Copyright © 2004, EM Microelectronic-Marin SA 18 www.emmicroelectronic.com R EMDB6812 4.5.2 Commands Here you can send the different commands. Please note, that after sending the Powerdown command, the chip will no longer respond to serial-commands until you press one of the keys connected to the chip or the Timer in the micro controller has been active and reached 0. EM Microelectronic-Marin SA cannot assume responsibility for use of any circuitry described other than circuitry entirely embodied in an EM Microelectronic-Marin SA product. EM Microelectronic-Marin SA reserves the right to change the circuitry and specifications without notice at any time. You are strongly urged to ensure that the information given has not been superseded by a more up-to-date version. © EM Microelectronic-Marin SA, 11/04, Rev. A Copyright © 2004, EM Microelectronic-Marin SA 19 www.emmicroelectronic.com