Logout succeed
Logout succeed. See you again!

Typical application with ADC PDF
Preview Typical application with ADC
STM8S903K3 STM8S903F3 16 MHz STM8S 8-bit MCU, up to 8 Kbytes Flash, 1 Kbyte RAM, 640 bytes EEPROM,10-bit ADC, 2 timers, UART, SPI, I²C - Switch-offperipheralclocksindividually • Permanentlyactive,lowconsumptionpower-on andpower-downreset Interruptmanagement • Nestedinterruptcontrollerwith32interrupts • LQFP327x7UFQFPN325x5 SDIP32400mils Upto28externalinterruptson7vectors Timers • Advancedcontroltimer:16-bit,4CAPCOM channels,3complementaryoutputs,dead-time insertionandflexiblesynchronization • 16-bitgeneralpurposetimer,with3CAPCOM channels(IC,OCorPWM) TSSOP20 UFQFPN203x3 SO20W300mils • 8-bitbasictimerwith8-bitprescaler • Autowakeuptimer • Windowandindependentwatchdogtimers Features Core Communicationsinterfaces • • 16MHzadvancedSTM8corewithHarvard UARTwithclockoutputforsynchronous architectureand3-stagepipeline operation,Smartcard,IrDA,LINmastermode • • Extendedinstructionset SPIinterfaceupto8Mbit/s • 2 I Cinterfaceupto400Kbit/s Memories • Programmemory:8KbytesFlash;dataretention Analogtodigitalconverter(ADC) 20yearsat55°Cafter10kcycles • 10-bit,±1LSBADCwithupto7muxedchannels • Datamemory:640bytestruedataEEPROM; +1internalchannel,scanmodeandanalog endurance300kcycles watchdog • • RAM:1Kbytes Internalreferencevoltagemeasurement Clock,resetandsupplymanagement I/Os • • 2.95to5.5Voperatingvoltage Upto28I/Osona32-pinpackageincluding21 • highsinkoutputs Flexibleclockcontrol,4masterclocksources: • - HighlyrobustI/Odesign,immuneagainstcurrent Lowpowercrystalresonatoroscillator - injection Externalclockinput - Internal,user-trimmable16MHzRC Developmentsupport • - Embeddedsinglewireinterfacemodule(SWIM) Internallowpower128kHzRC forfaston-chipprogrammingandnonintrusive • debugging Clocksecuritysystemwithclockmonitor • Powermanagement: UniqueID:96-bitkeyincludinglotnumber - Lowpowermodes(wait,active-halt,halt) June2012 DocID15590Rev8 1/116 www.st.com Contents STM8S903K3STM8S903F3 Contents 1 Introduction ..............................................................................................................8 2 Description ...............................................................................................................9 3 Block diagram ........................................................................................................10 4 Product overview ...................................................................................................11 4.1 Central processing unit STM8 .....................................................................................11 4.2Singlewireinterfacemodule(SWIM)anddebugmodule(DM) ..................................11 4.3 Interrupt controller .......................................................................................................12 4.4FlashprogramanddataEEPROMmemory ................................................................12 4.5 Clock controller ............................................................................................................13 4.6 Power management ....................................................................................................14 4.7 Watchdog timers ..........................................................................................................14 4.8 Auto wakeup counter ...................................................................................................15 4.9 Beeper ........................................................................................................................15 4.10TIM1-16-bitadvancedcontroltimer .........................................................................15 4.11 TIM5 - 16-bit general purpose timer ..........................................................................16 4.12TIM6-8-bitbasictimer ..............................................................................................16 4.13Analog-to-digitalconverter(ADC1) ............................................................................16 4.14 Communication interfaces .........................................................................................17 4.14.1 UART1 ...............................................................................................17 4.14.2 SPI .....................................................................................................18 4.14.3 I²C ......................................................................................................18 5 Pinout and pin description ...................................................................................19 5.1 STM8S903F3 TSSOP20/SO20 pinout ........................................................................20 5.2 STM8S903F3UFQFPN20pinout ................................................................................21 5.3 TSSOP/SO/UFQFPN20 pin description ......................................................................22 5.4STM8S903K3UFQFPN32/LQFP32/SDIP32pinout ....................................................23 5.5UFQFPN/LQFP/SDIP32pindescription ......................................................................24 5.6Alternatefunctionremapping .......................................................................................26 6 Memory and register map .....................................................................................27 6.1Memorymap ................................................................................................................27 6.2 Register map ...............................................................................................................28 6.2.1 I/O port hardware register map ............................................................28 6.2.2 General hardware register map ...........................................................29 6.2.3 CPU/SWIM/debugmodule/interrupt controller registers .....................38 7 Interrupt vector mapping ......................................................................................41 8 Option bytes ...........................................................................................................43 8.1STM8S903K3/F3alternatefunctionremappingbits ....................................................45 2/116 DocID15590Rev8 STM8S903K3STM8S903F3 Contents 9 Unique ID ................................................................................................................49 10 Electrical characteristics ....................................................................................50 10.1Parameterconditions .................................................................................................50 10.1.1 Minimum and maximum values .........................................................50 10.1.2Typicalvalues .....................................................................................50 10.1.3 Typical curves ....................................................................................50 10.1.4 Loading capacitor ...............................................................................50 10.1.5Pininputvoltage .................................................................................50 10.2 Absolute maximum ratings ........................................................................................51 10.3Operatingconditions ..................................................................................................53 10.3.1 VCAP external capacitor ....................................................................54 10.3.2 Supply current characteristics ............................................................55 10.3.3 External clock sources and timing characteristics .............................65 10.3.4Internalclocksourcesandtimingcharacteristics ...............................67 10.3.5 Memory characteristics ......................................................................69 10.3.6 I/O port pin characteristics .................................................................70 10.3.7 Reset pin characteristics ....................................................................78 10.3.8 SPI serial peripheral interface ............................................................81 2 10.3.9 I C interface characteristics ...............................................................84 10.3.1010-bitADCcharacteristics ................................................................85 10.3.11 EMC characteristics .........................................................................89 11 Package information ............................................................................................92 11.132-pinLQFPpackagemechanicaldata .....................................................................92 11.2 32-lead UFQFPN package mechanical data .............................................................94 11.3 20-lead UFQFPN package mechanical data .............................................................95 11.4 UFQFPN recommended footprint ..............................................................................97 11.5SDIP32packagemechanicaldata .............................................................................98 11.620-pinTSSOPpackagemechanicaldata ................................................................100 11.720-pinSOpackagemechanicaldata .......................................................................101 11.8Thermalcharacteristics ............................................................................................102 11.8.1 Reference document ........................................................................103 11.8.2Selectingtheproducttemperaturerange .........................................103 12 Ordering information .........................................................................................104 12.1STM8S903K3/F3FASTROMmicrocontrolleroptionlist ..........................................104 13 STM8 development tools ..................................................................................110 13.1Emulationandin-circuitdebuggingtools .................................................................110 13.2 Software tools ..........................................................................................................110 13.2.1 STM8 toolset ....................................................................................111 13.2.2 C and assembly toolchains ..............................................................111 13.3 Programming tools ..................................................................................................111 14 Revision history .................................................................................................112 DocID15590Rev8 3/116 Listoftables STM8S903K3STM8S903F3 List of tables Table 1. STM8S903K3/F3access line features .......................................................................................9 Table2.PeripheralclockgatingbitassignmentsinCLK_PCKENR1/2registers ..................................14 Table 3. TIM timer features ....................................................................................................................16 Table 4. Legend/abbreviations for pinout tables ...................................................................................19 Table 5. TSSOP20/SO20/UFQFPN20pin description ...........................................................................24 Table6.UFQFPN32/LQFP32/SDIP32pindescription ...........................................................................24 Table 7. I/O port hardware register map ................................................................................................28 Table8.Generalhardwareregistermap ................................................................................................43 Table 9. CPU/SWIM/debug module/interrupt controller registers .........................................................54 Table 10. Interrupt mapping ...................................................................................................................41 Table11.Optionbytes .........................................................................................................................112 Table12.Optionbytedescription ...........................................................................................................43 Table13.STM8S903K3alternatefunctionremappingbits[7:2]for32-pinpackages ...........................45 Table14.STM8S903F3alternatefunctionremappingbits[7:2]for20-pinpackages ...........................46 Table15.STM8S903K3alternatefunctionremappingbits[1:0]for32-pinpackages .........................102 Table16.STM8S903F3alternatefunctionremappingbits[1:0]for20-pinpackages ...........................48 Table17.UniqueIDregisters(96bits) .................................................................................................112 Table 18. Voltage characteristics ...........................................................................................................51 Table 19. Current characteristics ...........................................................................................................51 Table 20. Thermal characteristics ..........................................................................................................52 Table 21. General operating conditions .................................................................................................53 Table22.Operatingconditionsatpower-up/power-down ......................................................................54 Table23.TotalcurrentconsumptionwithcodeexecutioninrunmodeatV =5V .............................55 DD Table24.TotalcurrentconsumptionwithcodeexecutioninrunmodeatV =3.3V ..........................56 DD Table25.TotalcurrentconsumptioninwaitmodeatV =5V ............................................................57 DD Table26.TotalcurrentconsumptioninwaitmodeatV =3.3V .........................................................57 DD Table27.TotalcurrentconsumptioninactivehaltmodeatV =5V ..................................................58 DD Table28.TotalcurrentconsumptioninactivehaltmodeatV =3.3V ...............................................59 DD Table29.TotalcurrentconsumptioninhaltmodeatV =5V .............................................................60 DD Table30.TotalcurrentconsumptioninhaltmodeatV =3.3V ..........................................................60 DD Table 31. Wakeup times .........................................................................................................................60 Table32.Totalcurrentconsumptionandtiminginforcedresetstate ....................................................61 Table 33. Peripheral current consumption .............................................................................................62 Table34.HSEuserexternalclockcharacteristics .................................................................................65 Table35.HSEoscillatorcharacteristics .................................................................................................65 Table 36. HSI oscillator characteristics ..................................................................................................67 Table37.LSIoscillatorcharacteristics ...................................................................................................68 Table38.RAMandhardwareregisters ..................................................................................................69 Table39.Flashprogrammemory/dataEEPROMmemory ....................................................................69 Table 40. I/O static characteristics .........................................................................................................70 Table 41. Output driving current (standard ports) ..................................................................................72 Table42.Outputdrivingcurrent(trueopendrainports) ........................................................................73 Table 43. Output driving current (high sink ports) ..................................................................................73 Table 44. NRSTpin characteristics ........................................................................................................78 Table45.SPIcharacteristics ..................................................................................................................81 2 Table 46. I C characteristics ..................................................................................................................84 Table 47. ADC characteristics ................................................................................................................85 4/116 DocID15590Rev8 STM8S903K3STM8S903F3 Listoftables Table48.ADCaccuracywithR <10kΩ,V =5V .........................................................................86 AIN DD Table49.ADCaccuracywithR <10kΩR ,V =3.3V ..............................................................87 AIN AIN DD Table50.EMSdata ................................................................................................................................89 Table 51. EMI data .................................................................................................................................90 Table 52. ESD absolute maximum ratings .............................................................................................91 Table 53. Electrical sensitivities .............................................................................................................91 Table 54. 32-pin low profile quad flat package mechanical data .........................................................102 Table55.32-lead,ultrathin,finepitchquadflatno-leadpackagemechanicaldata .............................94 Table56.20-lead,ultrathin,finepitchquadflatno-leadpackage(3x3)packagemechanicaldata ....96 Table 57. 32-lead shrink plastic DIP (400 ml) package mechanical data ..............................................99 Table58.20-pin,4.40mmbody,0.65mmpitchmechanicaldata .......................................................101 Table59.20-lead,plasticsmalloutline(300mils)mechanicaldata ....................................................101 Table 60. Thermal characteristics ........................................................................................................102 Table 61. Document revision history ....................................................................................................112 DocID15590Rev8 5/116 Listoffigures STM8S903K3STM8S903F3 List of figures Figure 1. Block diagram .........................................................................................................................10 Figure 2. Flash memory organization ....................................................................................................13 Figure 3. STM8S903F3 TSSOP20/SO20 pinout ...................................................................................23 Figure 4. STM8S903F3 UFQFPN20 pinout ...........................................................................................23 Figure 5. STM8S903K3 UFQFPN32/LQFP32 pinout ............................................................................23 Figure 6. STM8S903K3 SDIP32 pinout .................................................................................................24 Figure 7. Memory map ...........................................................................................................................27 Figure8.Pinloading conditions .............................................................................................................50 Figure 9. Pin input voltage .....................................................................................................................51 Figure 10. f versus V ..............................................................................................................54 CPUmax DD Figure 11. External capacitor C .......................................................................................................55 EXT Figure12.TypI vs.V HSEuserexternalclock,f =16MHz .............................................62 DD(RUN) DD CPU Figure13.TypI vs.f HSEuserexternalclock,V =5V ....................................................63 DD(RUN) CPU DD Figure14.TypI vs.V HSIRCosc,f =16MHz .................................................................63 DD(RUN) DD CPU Figure15.TypI vs.V HSEuserexternalclock,f =16MHz ..............................................64 DD(WFI) DD CPU Figure16.TypI vs.f HSEuserexternalclock,V =5V .....................................................64 DD(WFI) CPU DD Figure17.TypI vs.V HSIRCosc,f =16MHz .................................................................64 DD(WFI) DD CPU Figure18.HSEexternalclocksource .....................................................................................................65 Figure19.HSEoscillatorcircuitdiagram ...............................................................................................66 Figure20. Typical HSIfrequencyvariationvs V @ 4 temperatures ..................................................68 DD Figure21.TypicalLSIfrequencyvariationvsV @4temperatures ...................................................68 DD Figure22.TypicalV andV vsV @4temperatures ......................................................................71 IL IH DD Figure23.Typicalpull-upresistancevsV @4temperatures ............................................................72 DD Figure24.Typicalpull-upcurrentvsV @4temperatures .................................................................72 DD Figure25.Typ.V @V =5V(standardports) ................................................................................74 OL DD Figure26.Typ.V @V =3.3V(standardports) .............................................................................74 OL DD Figure27.Typ.V @V =5V(trueopendrainports) ......................................................................75 OL DD Figure28.Typ.V @V =3.3V(trueopendrainports) ...................................................................75 OL DD Figure29.Typ.V @V =5V(highsinkports) ................................................................................76 OL DD Figure30.Typ.V @V =3.3V(highsinkports) .............................................................................76 OL DD Figure31.Typ.V -V @V =5V(standardports) .......................................................................77 DD OH DD Figure32.Typ.V -V @V =3.3V(standardports) ...................................................................77 DD OH DD Figure33.Typ.V -V @V =5V(highsinkports) .......................................................................78 DD OH DD Figure34.Typ.V -V @V =3.3V(highsinkports) ....................................................................78 DD OH DD Figure35.TypicalNRSTV andV vsV @4temperatures ...........................................................79 IL IH DD Figure36.TypicalNRSTpull-upresistancevsV @4temperatures .................................................80 DD Figure37.TypicalNRSTpull-upcurrentvsV @4temperatures ......................................................80 DD Figure38.Recommendedresetpinprotection ......................................................................................81 Figure39.SPItimingdiagram-slavemodeandCPHA=0 ..................................................................83 Figure40.SPItimingdiagram-slavemodeandCPHA=1 ..................................................................83 (1) Figure41.SPItimingdiagram-mastermode ...................................................................................84 2 Figure 42. Typical application with I C bus and timing diagram ............................................................85 Figure43.ADCaccuracycharacteristics ...............................................................................................88 Figure 44. Typical application with ADC ................................................................................................88 Figure45.32-pinlowprofilequadflatpackage(7x7) ..........................................................................92 Figure46.32-lead,ultrathin,finepitchquadflatno-leadpackage(5x5) ............................................94 Figure47.20-lead,ultrathin,finepitchquadflatno-leadpackageoutline(3x3) ................................95 6/116 DocID15590Rev8 STM8S903K3STM8S903F3 Listoffigures Figure 48. Recommended footprint for on-board emulation ..................................................................97 Figure49.Recommendedfootprintwithouton-boardemulation ...........................................................98 Figure50.32-leadshrinkplasticDIP(400 ml)package ........................................................................98 Figure51.20-pin,4.40mmbody,0.65mmpitch .................................................................................101 Figure52.20-lead,plasticsmalloutline(300mils)package ...............................................................101 Figure53.STM8S903K3/F3orderinginformationscheme ..................................................................104 DocID15590Rev8 7/116 Introduction STM8S903K3STM8S903F3 1 Introduction Thisdatasheetcontainsthedescriptionofthedevicefeatures,pinout,electricalcharacteristics, mechanicaldataandorderinginformation. • ForcompleteinformationontheSTM8Smicrocontrollermemory,registersandperipherals, pleaserefertotheSTM8Smicrocontrollerfamilyreferencemanual(RM0016). • Forinformationonprogramming,erasingandprotectionoftheinternalFlashmemory pleaserefertotheSTM8SFlashprogrammingmanual(PM0051). • ForinformationonthedebugandSWIM(singlewireinterfacemodule)refertotheSTM8 SWIMcommunicationprotocolanddebugmoduleusermanual(UM0470). • ForinformationontheSTM8core,pleaserefertotheSTM8CPUprogrammingmanual (PM0044). 8/116 DocID15590Rev8 STM8S903K3STM8S903F3 Description 2 Description TheSTM8S903K3andSTM8S903F38-bitmicrocontrollersoffer8KbytesFlashprogram memory,plusintegratedtruedataEEPROM.TheSTM8Smicrocontrollerfamilyreference manual(RM0016)referstodevicesinthisfamilyaslow-density.Theyprovidethefollowing benefits:performance,robustness,andreducedsystemcost. Deviceperformanceandrobustnessareensuredbyadvancedcoreandperipheralsmade inastate-of-thearttechnology,a16MHzclockfrequency,robustI/Os,independentwatchdogs withseparateclocksource,andaclocksecuritysystem. ThesystemcostisreducedthankstoanintegratedtruedataEEPROMforupto300 kwrite/erasecyclesandahighsystemintegrationlevelwithinternalclockoscillators,watchdog andbrown-outreset. Fulldocumentationisofferedaswellasawidechoiceofdevelopmenttools. Table1:STM8S903K3/F3accesslinefeatures Device STM8S903K3 STM8S903F3 Pincount 32 20 (1) (2) Max.numberofGPIOs 28 16 (I/Os) Ext.interruptpins 28 16 TimerCAPCOM 7 channels Timercomplementary 3 2 outputs A/Dconverterchannels 7 5 HighsinkI/Os 21 12 LowdensityFlash 8K programmemory(bytes) (3) DataEEPROM(bytes) 640 RAM(bytes) 1K 2 Peripheralset Multipurposetimer(TIM1),SPI,I C,UARTwindowWDG, independentWDG,ADC,PWMtimer(TIM5),8-bittimer(TIM6) (1) Including21highsinkoutputs (2) Including12highsinkoutputs (3) Noread-while-write(RWW)capability DocID15590Rev8 9/116 Blockdiagram STM8S903K3STM8S903F3 3 Block diagram Figure1:Blockdiagram Resetblock XTAL1-16MHz Clockcontroller Reset Reset RCint.16MHz Detector POR BOR RCint.128kHz Clocktoperipheralsandcore WindowWDG STM8core IndependentWDG Singlewire Debug/SWIM 8Kbytes debuginterf. program Flash 640bytes dataEEPROM s u b 400Kbit/s I2C ata 1Kbytes d RAM d n a s 8Mbit/s SPI es ddr Upto A 4CAPCOM 16-bitadvancedcontrol LINmaster UART1 channels timer(TIM1) SPIemul. +3complementary outputs 16-bitgeneralpurpose Upto Timer(TIM5) 3CAPCOM channels 8-bitbasictimer Upto7 ADC1 (TIM6) channels 1/2/4kHz Beeper AWUtimer beep 10/116 DocID15590Rev8