August2009DocID15903Rev11/54AN3000ApplicationnoteConfiguringtheNicheLite™TCP/IPstackfortheSTM32F107xxmicrocontrollerIntroductionSTM32F107xxconnectivitylinemicrocontrollersfeatureacomplete10/100EthernetMACsupportingMIIandRMIIwithhardwaresupportfortheIEEE1588precisetimeprotocol,enablingEthernetconnectivityforreal-timeapplications.TheNicheLiteTCP/IPstack,fromInterNicheTechnologies,supportsSTM32F107xxconnectivitylinemicrocontrollersandisprovidedfree-of-chargetoSTcustomers.ThisstackisascaleddownversionofthefullstackavailablefromInterNiche.Fordownloadinformation,pleaserefertoSTMicroelectronicswebsite■AshortglossaryisprovidedinSection1■AgeneralintroductiontoTCP/IPispresentedinSection2■TheSection3introducestheNicheLitestack■Section4and5describetheNicheLitestackconfigurationandoptimization■NicheLitestackdebuggingtipsaregiveninSection6■Section7presentstheNicheTaskOSandhowtouseitinyourapplication■Lastly,Section8describestheNicheLitepackageforSTM32F107xxandtheavailabledemonstrationsThisapplicationnoteisintendedtocomplementthedocumentationprovidedbyInterNiche,whichshouldbereferredtofordetailedinformation.:Internetprotocol........................................112.3.2ARP:addressresolutionprotocol.............................122.3.3ICMP:internetcontrolmessageprotocol........................122.3.4UDP:userdatagramprotocol................................132.3.5TCP:transmissioncontrolprotocol............................142.3.6BOOTP:bootstrapprotocol..................................142.3.7DHCP:dynamichostconfigurationprotocol.....................152.3.8TFTP:trivialfiletransferprotocol..............................152.3.9FTP:filetransferprotocol....................................152.3.10PPP:point-to-pointprotocol..................................152.3.11SMTP:simplemailtransferprotocol...........................152.3.12POP3:postofficeprotocolversion3...........................162.3.13SNMP:simplenetworkmanagementprotocol....................162.3.14HTTP:hypertexttransferprotocol.............................162.3.15Telnet:remoteterminalprotocol..............................163NicheLiteTCP/IPstackoverview..............................173.1Stackstructure.............................................173.2NicheLiteprotocols..........................................193.3NicheLiteimplementationintroduction...........................213.3.1Packetdemultiplexingflow...................................223.3.2Packetbuffermemorymanagement...........................233.3.3Memorymanagement......................................27AN3000ContentsDocID15903Rev13/544NicheLiteTCP/IPstackconfiguration..........................294.1NicheLitemodules..........................................294.2IPaddress................................................294.3MACaddress..............................................304.4Keepalive.................................................304.4.1EnablingKeepaliveinNicheLite...............................304.4.2KeepalivetimeouttuninginNicheLite..........................315NicheLiteTCP/IPstackoptimization...........................326Debugtips................................................356.1NicheTooldiagnosticconsole..................................356.2Networkstatistics...........................................366.3Packetdebugging...........................................376.4Socketandpacketqueues....................................387NicheTaskOS.............................................407.1Overview.................................................407.1.1Superloop(OSdisabled)....................................407.1.2Multitaskingsystem(OSenabled).............................407.2ConfiguringtheNicheTaskOS.................................427.3Implementingyourownsystemmenusandtasks..................427.3.1Taskdeclaration(indemo_server.cfile)........................427.3.2Taskfunctiondefinition(indemo_server.cfile)...................437.3.3Taskcreation(intk_misc.cfile)...............................448NicheLitepackageforSTM32F107xx..........................458.1Filestructure....