Part Number Hot Search : 
2405DH CPH3338 HV57908 48VDC GP50B60 VN10K IS82C55A 56F8000
Product Description
Full Text Search
 

To Download AN668 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rev. 0.1 2/12 copyright ? 2012 by silicon laboratories AN668 AN668 p recision 32? s oftware d evelopment k it c ode e xamples o verview 1. introduction the precision32? code examples are part of the software development kit (sdk) inst alled with the precision32 software package available at www.silabs.com/32bit-s oftware. the code examples are simple and complete examples that illustrate and highlight the peripheral modes and features. th ey are also modular so code can be copied into an application base, making peripheral-specific code development easy. figure 1 shows the precision32 firmware layer block diagram. figure 1. firmware layer block diagram 2. relevant documentation precision32 application notes are listed on th e following website: www. silabs.com/32bit-mcu. ?? an664: precision32? cmsis and hal user?s guide ?? an667: getting started with the silicon labs precision32? ide ?? an670: getting started wit h the silicon labs pr ecision32? appbuilder ?? an673: precision32? software development kit (sdk) overview callback cmsis rtos si32library application cmsis coresupport (from arm) cmsis devicesupport (from silicon labs) code examples hardware
AN668 2 rev. 0.1 3. code example organization the code examples are separated by device and are located in si32-x.y\examples\device , where x is the major sdk version, and y is the minor sdk version. each code example has its own folder named with the peripheral or example name. the ide can import these code examples using the instruct ions in the application no te, ?an667: getting started with the silicon labs precision32 ide? . sub-directories under the example fo lder include example projects for uvision and iar. figure 2 displays the code ex ample organization on disk. figure 2. code example organization
AN668 rev. 0.1 3 4. detailed documentation the detailed documentation for each code example is in the readme file in the example fo lders.this file includes a basic description of the example, the resources and clock speeds used, notes on the example and supported modes, and detailed how-to-use steps. the blinky_readme.txt file shown in figure 3 is installed in si32-x.y\example\ sim3u1xx\blinky for sim3u1xx devices after installing the pr ecision32 software package. figure 3. code example documentation
AN668 4 rev. 0.1 5. sim3u1xx b linky example blinky uses the sim3u1xx rtc0 module and systick to toggle two leds. pb2.10 (led on the sim3u1xx mcu card) toggles every 500 ms using the rtc counting 10 ms intervals. pb2.11 (also an led) toggles every second using systick. the example also reads the switches on the mcu card (pb2.8 and pb2.9) every 500 ms and prints their status to the console view (semi-hosting) by default. the code examples follow the silicon labs appbuilder file generati on structure: gen erated files are included in the src\generated folder with the g- prefix, and application files are in the src folder with my- prefix. all of the modes implemented in the example are called from main . in the blinky example, main calls gmodes_enter_my_default_mode() from gmodes.c , which then calls gcpu_enter_default_config() in gcpu.c , and so forth. these code examples use the s ilicon labs hardware access layer (hal) macros by default. figure 4. blinky example
AN668 rev. 0.1 5 5.1. blinky application-specific files 5.1.1. main.c the main.c file calls functions from the gmodes.c and the port hal as shown in figu re 5. this file also includes all the main application code th at sits in a while(1) loop, toggling the led pins or reading the switches and printing their status to the console view. figure 5. main.c dependencies 5.1.2. mycpu.c this file has the application-specific implementation of mysysteminit() called by system_sim3u1xx.c in the hal. for blinky, this function: ?? disables the watchdog timer. ?? enables apb to the port bank modules. ?? sets the serial wire viewer pin (pb1.3) to push-pull. figure 6 shows the dependencies for mycpu.c . figure 6. mycpu.c dependencies 5.1.3. mypb.c this file doesn?t include any applicatio n-specific code for the blinky example. si32hal blinky si32_pbstd_a_type.c main.c gmodes.c si32hal blinky system_sim3u1xx.c mycpu.c si32_clkctrl_a_type.c si32_wdtimer_a_type.c si32_pbstd_a_type.c
AN668 6 rev. 0.1 5.1.4. myrtc0.c the myrtc0.c file includes the second-level handlers for the rtc0 alarm 0 and rtc0 oscillator fail interrupts. these second-level handlers are called from the first-level handlers in grtc0.c. the second-level alarm 0 handler: ?? reads the rtc0 counter value. ?? sets the rtc0 alarm 0 value with a new value equal to the current counter value + 10 ms. ?? increments msticks_10 , which keeps track of the 10 ms intervals. ?? clears the alarm 0 interrupt in the rtc0 module. the second-level oscillator fail handler sits in a while(1) loop to indica te an unrecoverable error condition. figure 6 shows the dependencies for myrtc0.c . figure 7. myrtc0.c dependencies 5.2. blinky appbuild er-generated files 5.2.1. gcpu.c this file contains the systick handler, which increments the msticks variable, and the gcpu_enter_default_config() function, which is called from gmodes_enter_my_default_mode() in gmodes.c . this function sets the systemcoreclock variable to 20 mhz, since blinky us es the low power oscillator, and sets the systick timer to trigger every millisecond. figure 8 shows the dependencies for gcpu.c . figure 8. gcpu.c dependencies si32hal blinky si32_rtc_a_type.c myrtc.c si32_rtc_a_type.c si32_rtc_a_type.c grtc.c si32hal blinky core_cm3.h gcpu.c gmodes.c
AN668 rev. 0.1 7 5.2.2. gmodes.c the gmodes.c file has two functions: gmodes_enter_my_default_mode() and gmodes_enter_my_off_mode() . the default mode function places the device in the default mode after a reset and calls gcpu_enter_default_config() from gcpu.c , gpb_enter_default_config() from gpb.c , and grtc0_enter_default_config() from grtc0.c . the off mode function is not currently called fr om anywhere in the project and includes calls to grtc0_enter_off_config() from grtc0.c and gpb_enter_off_config() from gpb.c . figure 9 illustrates the d ependencies diagram for gmodes.c . figure 9. gmodes.c dependencies si32hal blinky gmodes.c gcpu.c gpb.c grtc0.c
AN668 8 rev. 0.1 5.2.3. gpb.c this file includes two functions: gpb_enter_off_config() and gpb_enter_default_config() . the gpb_enter_off_config() function is called by gmodes_enter_my_off_mode() in gmodes.c and sets all the pins to digital input mode, disabl es crossbar 1, and disables th e apb clock to the port registers. the gpb_enter_default_config() function: ?? enables the apb clock to the port registers. ?? sets the swv pin to push-pull. ?? enables crossbar 1. ?? sets the pb2.10 and pb2.11 pins to push-pull. ?? sets the pb2.8 and pb2.9 pi ns to digital input mode. ?? configures the pb0.9 and pb0.10 rtc0 oscillator input pins as analog inputs. ?? configures pb2.7 to output the rtc0 clock by settin g pb2.7 to push-pull, skip ping the pb2.0-pb2.6 pins on crossbar 1, and enabling the oscillator output on crossbar 1. figure 10 shows the dependencies for gpb.c . figure 10. gpb.c dependencies si32hal blinky gpb.c si32_clkctrl_a_type.c si32_pbstd_a_type.c si32_pbcfg_a_type.c
AN668 rev. 0.1 9 5.2.4. grtc0.c the grtc0.c file includes the first-level interrupt handlers for the rtc0 oscillator fail ( rtc0fail_irqhandler() ) and alarm 0 ( rtc0alrm_irqhandler() ). these first-level interrupt handlers just call the second-level handlers and must use the handler names defined in sim3u1xx.h , the device-specific header file. in addition to the first-level interrupt handlers, grtc0.c has two functions: grtc_enter_off_config() and grtc0_enter_default_config() . the grtc_enter_off_config() function disables the alarm 0 interrupt in the rtc0 module, clears any pending oscillator fail or alarm 0 inte rrupts in the nvic, and disables these two interrupts in the nvic. in addition, the function stops the rtc0 timer, disables the rt c0 module, and disables the apb clock to rtc0. the grtc0_enter_default_config() function: ?? enables the apb clock to the rtc0 module. ?? enables the rtc module and configur es it for crystal oscillator mode. ?? sets the initial ala rm 0 value for 10 ms. ?? clears any pending interrupts and enables the interrupts in the nvic. ?? enables the alarm 0 interrupt in the rtc0 module. ?? enables the rtc0 output. figure 11 shows the dependencies for grtc0.c . figure 11. grtc0.c dependencies si32hal blinky grtc0.c si32_clkctrl_a_type.c si32_rtc_a_type.c core_cm3.h myrtc0.c
AN668 10 rev. 0.1 c ontact i nformation silicon laboratories inc. 400 west cesar chavez austin, tx 78701 tel: 1+(512) 416-8500 fax: 1+(512) 416-9669 toll free: 1+(877) 444-3032 please visit the silicon labs technical support web page: https://www.silabs.com/support/pages/contacttechnicalsupport.aspx and register to submit a technical support request. silicon laboratories and silicon labs are trademarks of silicon laboratories inc. other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. the information in this document is believed to be accurate in all respects at the time of publication but is subject to change without notice. silicon laboratories assumes no responsibility for errors and omissions, and disclaims responsib ility for any consequences resu lting from the use of information included herein. a dditionally, silicon laboratorie s assumes no responsibility for the functioning of und escribed features or parameters. silicon laboratories reserves the right to make changes without further notice . silicon laboratories makes no wa rranty, rep- resentation or guarantee regarding the suitability of its products for any particular purpose, nor does silicon laboratories as sume any liability arising out of the application or use of any product or circuit, and s pecifically disclaims any an d all liability, including wi thout limitation conse- quential or incidental damages. silicon laborat ories products are not designed, intended, or authorized for use in applications intended to support or sustain life, or for any other application in which the failure of the silicon laboratories product could create a s ituation where per- sonal injury or death may occur. should buyer purchase or us e silicon laboratories products for any such unintended or unauthor ized ap- plication, buyer shall indemnify and hold silicon laboratories harmless against all claims and damages.


▲Up To Search▲   

 
Price & Availability of AN668

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X