Free Star Pro Series ZFSM-201-EVB-1 Evaluation Board SMAC Programmers Guide ZFSM-201-1 FreeStar Pro Module Document # 0006-00-08-02-000 (Rev B)
FreeStar Pro SMAC Programmers’ Guide Table of Contents 1 OVERVIEW ....................................................................................... 4 1.1 1.2 2 DESCRIPTION ............................................................................................ 4 REFERENCED DOCUMENTS .................................................................... 4 CODE DEVELOPMENT IN IAR WORKBENCH® ............................ 5 2.1 TOOLS..................................................................
FreeStar Pro SMAC Programmers’ Guide 3.7 3.8 3.9 3.10 3.11 3.12 4 RECEIVING A UART MESSAGE ............................................................... 33 TRANSMITTING A UART MESSAGE ....................................................... 33 TIMERS ..................................................................................................... 34 EVENTS..................................................................................................... 34 READING ADC’S............................
FreeStar Pro SMAC Programmers’ Guide 1 Overview 1.1 DESCRIPTION The ZFSM201-EVB-1 FreeStar Pro Evaluation Board serves as an interface, evaluation and development tool enabling the user to demonstrate, and evaluate the capabilities of the CEL ZFSM-201-1, FreeStar Pro Module. At the heart of the CEL ZFSM-201-1 is the Freescale MC13224V Platform-in-Package (PiP) transceiver, a 32-bit ARM-based ZigBee radio module and a third-generation 2.4GHz IEEE® 802.15.4 platform.
FreeStar Pro SMAC Programmers’ Guide Document Title Document Name / Number Freescale Test Tool User’s Guide TTUG Note: The Freescale documents listed above will be loaded to the user’s PC when installing the BeeKit™ Toolkit found on the CEL Freestar Pro CD. CEL Documents (www.cel.
FreeStar Pro SMAC Programmers’ Guide 2.1.2 J-Link Figure 2 – Photo, J-Link Debugging Probe The IAR J-Link is necessary for in-circuit debugging. See www.iar.com for more details and where to purchase. Download and install the latest driver from http://www.segger.com/download_jlink.html 2.2 PROJECT OVERVIEW 2.2.
FreeStar Pro SMAC Programmers’ Guide Table 2 – Code, “generic_app.c” – “main” function generic_app.c /************************************************************************************ * main function * * Executes the main function. * ************************************************************************************/ void Main(void) { MSG_INIT(TX_msg, &dataTX, NULL); MSG_INIT(RX_msg, &dataRX, (callback_t)(application_rx_cb)); RX_msg.
FreeStar Pro SMAC Programmers’ Guide main_state.c // tact as SMAC codebase updates come out. // // Include main_state.h in the BeeKit generated source file. // // This function needs to be called in the main() function of // the BeeKit generated application source file. // // coding follows LSR Software Quality Standard - C Coding Standard // // Micro: Freescale MC1322x // Compiler: IAR EWARM // // Written by: Christopher Hofmeister // // Copyright (c) 2008 LS Research, LLC // www.lsr.
FreeStar Pro SMAC Programmers’ Guide main_state.c // // -find: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch_2_isr); // change: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch2_isr); // // -find: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch_3_isr); // change: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch3_isr); // // -find: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch_4_isr); // change: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch4_isr); // // 3) find: #define APP_PACK_SZ (125) in generic_app.
FreeStar Pro SMAC Programmers’ Guide 2.3 APPLICATION FILES Figure 4 – Screen, IAR Workbench – Application Source and Utility Files NOTE: The screenshots used in this user guide may be based on a prior release of the corresponding Freescale codebase, for version / project information with regards to the example included on the CEL CD, please refer to Section 2.2. For the latest Freescale codebase, please download the Freescale BeeKit™ from the Freescale website. 2.3.
FreeStar Pro SMAC Programmers’ Guide 2.4 PLM AND SMAC SOURCE FILES Additional source files are included in the project when made by BeeKit™ and stored in the PLM and SMAC directories. They are shown in Figure 5 below. Figure 5 – Screen, IAR Workbench – PLM and SMAC Source Files 2.5 DEBUG/RELEASE WORKSPACE MODE During development it is strongly recommended that the ‘Workspace’ be kept in ‘Debug’ mode as shown in Figure 6.
FreeStar Pro SMAC Programmers’ Guide 2.6 GENERATING AN OUTPUT FILE The IAR IDE does not generate a .bin file automatically. The user must do the following: Right click on the project name. In Figure 7 below the project name is ‘CEL_SMAC_104_DP’. Select ‘Options…’ from the drop down Menu List.
FreeStar Pro SMAC Programmers’ Guide 2.7 J-LINK SPEED 2.7.1 Change the J-Link speed by following steps: Right click on the project name. In Figure 7 below the project name is ‘CEL_SMAC_104_DP’. Select ‘Options…’ from the Menu List. In the ‘J-Link/J-Trace’ category, set the ‘Reset’ to ‘Software’ and the ‘JTAG/SWD speed’ to ‘Adaptive’ as shown in Figure 9. Figure 9 – Screen, IAR Workbench – Setting JTAG/SWD Speed 2.8 OPTIMIZATIONS Use of optimizations is up to the developer.
FreeStar Pro SMAC Programmers’ Guide 2.9 MAIN IAR FEATURES 2.9.1 Building a Project Under the ‘Project’ menu several options exist to ‘Make’, ‘Compile’, or ‘Rebuild All’ code. Figure 11 – Screen, IAR Workbench – Project Menu 2.9.2 Downloading into Flash: Ensure J-Link is connected to PC though the USB cable. Ensure FreeStar Pro Evaluation Board is connected to the J-Link though the ribbon cable plugged into the JTAG Header (J1).
FreeStar Pro SMAC Programmers’ Guide Figure 12 – Screen, IAR Workbench – Download and Debug 3 SMAC Development with Sample Application 3.1 CODE DEVELOPMENT The MC13224V is a powerful ARM7 based processor integrated with an 802.15.4 radio.
FreeStar Pro SMAC Programmers’ Guide 3.2 STATE DIAGRAMS The following sections describe the states used in the Sample Project with the goal of helping the user to understand the code, and how to modify it for a custom application. 3.2.1 Main State Diagram Section 3.2.2 Section 3.2.9 Section 3.2.3 Section 3.2.10 Section 3.2.4 Section 3.2.11 Section 3.2.5 Section 3.2.12 Section 3.2.6 Section 3.2.7 Section 3.2.
FreeStar Pro SMAC Programmers’ Guide Figure 13 – Diagram, Main State 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.2.
FreeStar Pro SMAC Programmers’ Guide 3.3 TRANSMITTING AN RF MESSAGE 3.3.1 More information See Freescale documents “Simple Media Access Controller (SMAC) User’s Guide” (Freescale Doc # SMACRM) and “MC1322x Simple Media Access Controller (SMAC) Reference Manual” (Freescale Doc # 22xSMACRM) for more information. The Tx_msg structure contains a pointer to the Transmit Buffer named dataTx. These are setup by BeeKit™ and are declared in generic_app.c if using the SMAC Sample Project contained on the CD.
FreeStar Pro SMAC Programmers’ Guide The process_radio_msg() function must be routinely called to run the radio state machine. It is the first function called in the RangeAppReceive() function in applications.c. 3.5 CHANGING OR QUERYING THE RF CHANNEL 3.5.1 More information See Freescale documents “Simple Media Access Controller (SMAC) User’s Guide” (Freescale Doc # SMACRM) and “MC1322x Simple Media Access Controller (SMAC) Reference Manual” (Freescale Doc # 22xSMACRM) for more information.
FreeStar Pro SMAC Programmers’ Guide 3.9 TIMERS A variety of options exist on the MC13224V for periodic timers that expire and generate an interrupt. The sample SMAC project on the CD uses Timer0 to generate an interrupt every 5mS. See timers.c for setup and usage. A variety of the other timers based on Timer0 can be set up and updated every time Timer0 expires. See the UpdateTimer0() function in main_state.c. 3.