California Eastern Laboratories ZFSM-201-EVB-1 Programmer's Manual

Free Star Pro Series
ZFSM-201-EVB-1
Evaluation Board
SMAC Programmers Guide
ZFSM-201-1 FreeStar Pro Module

(Rev B)
FreeStar Pro SMAC Programmers’ Guide
TableofContents
OVERVIEW ....................................................................................... 4
1
1.1 DESCRIPTION ............................................................................................ 4
1.2 REFERENCED DOCUMENTS .................................................................... 4
2 CODE DEVELOPMENT IN IAR WORKBENCH® ............................ 5
2.1 TOOLS ......................................................................................................... 5
2.1.1IAR Embedded Workbench® for ARM ............................................................. 5
2.1.2J-Link .................................................................................................................. 6
2.2 PROJECT OVERVIEW ................................................................................ 6
2.2.1File Location on the CD .................................................................................... 6
2.2.2Changes to BeeKit Generated Files ................................................................ 6
2.3 APPLICATION FILES ................................................................................ 10
2.3.1Source Files ..................................................................................................... 10
2.3.2Utility files ........................................................................................................ 10
2.4 PLM AND SMAC SOURCE FILES ............................................................. 11
2.5 DEBUG/RELEASE WORKSPACE MODE ................................................ 1 1
2.6 GENERATING AN OUTPUT FILE ............................................................. 12
2.7 J-LINK SPEED .......................................................................................... 13
2.7.1Change the J-Link speed by following steps: .............................................. 13
2.8 OPTIMIZATIONS ....................................................................................... 13
2.9 MAIN IAR FEATURES ............................................................................... 14
2.9.1Building a Project ............................................................................................ 14
2.9.2Downloading into Flash: ................................................................................. 14
3 SMAC DEVELOPMENT WITH SAMPLE APPLICA TION .............. 15
3.1 CODE DEVELOPMENT ............................................................................ 15
3.2 STATE DIAGRAMS ................................................................................... 16
3.2.1Main State Diagram ......................................................................................... 16
3.2.2AppInit State Diagram ..................................................................................... 17
3.2.3Pseudo Random Binary Sequence (PRBS) State Diagram ......................... 18
3.2.4Continuous Receive State Diagram ............................................................... 19
3.2.5Transmit Range Message State Diagram ...................................................... 20
3.2.6Receive Range Message State Diagram ....................................................... 21
3.2.7PERT Transmit Message State Diagram ....................................................... 22
3.2.8PERT Receive Message State Diagram ......................................................... 23
3.2.9Hibernate using 2kHz Oscillator State Diagram ........................................... 24
3.2.10Hibernate using 32kHz Oscillator State Diagram ......................................... 25
3.2.11Doze using 24MHz Reference Oscillator State Diagram .............................. 26
3.2.12Enable Buck Regulator State ......................................................................... 27
3.2.13Save to NVM State Diagram ........................................................................... 28
3.2.14NVM Read State Diagram ............................................................................... 29
3.2.15UART Receive State Diagram ......................................................................... 30
3.2.16Reading ADC’s State Diagram ....................................................................... 31
3.3 TRANSMITTING AN RF MESSAGE .......................................................... 32
3.3.1More information ............................................................................................. 32
3.4 RECEIVING AN RF MESSAGE ................................................................. 32
3.4.1More information ............................................................................................. 32
3.5 CHANGING OR QUERYING THE RF CHANNEL ...................................... 33
3.5.1More information ............................................................................................. 33
3.6 CHANGING THE RF POWER .................................................................... 33
3.6.1More information ............................................................................................. 33
Rev B 0006-00-08-02-000 Page 2 of 34
FreeStar Pro SMAC Programmers’ Guide
3.7 RECEIVING A UART MESSAGE ............................................................... 33
3.8 TRANSMITTING A UART MESSAGE ....................................................... 33
3.9 TIMERS ..................................................................................................... 34
3.10EVENTS..................................................................................................... 34
3.11READING ADC’S ....................................................................................... 34
3.12USER INPUTS (SWITCHES) ..................................................................... 34
4 REVISION HISTORY ...................................................................... 34
Rev B 0006-00-08-02-000 Page 3 of 34
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. The 32-bit ARM7 processor and extensive on-chip memory allows designers to eliminate the
peripheral host processors often required by 8- and/or 16-bit transceiver solutions. The high level of integration also helps to reduce component count, lowering power consumption and reducing overall system cost.
The evaluation kit provides the end user the ability to quickly become familiar with both the ZFSM-201-1 FreeStar Pro module’s hardware and software. The evaluation boards come preloaded with firmware demonstrating a wireless link and communicating with the supplied FreeStar Pro Test Tool Graphical User Interface (GUI).
The full application source code of the pre-programmed firmware is based on Freescale’s SMAC codebase for ARM7® and is supplied in an IAR Embedded Workbench for ARM project. The source code exercises key features of the MC13224V and provides a good reference or starting point for creating custom applications on the SMAC codebase. The application source code includes the following features:
RF Evaluation Range Test Application Packet Error Rate Test (PERT) Application Transmitting and receiving on the UART Using low power modes Reading and writing to Non-Volatile Memory (NVM) Reading Analog to Digital Converters Using GPIOs
1.2 REFERENCED DOCUMENTS
Table 1 contains the documents that have been referenced by this document (or recommended as additional information). Please consult the appropriate website to check for the latest revisions and editions.
Table 1 – Related and Referenced Documents
Document Title Document Name / Number
Freescale Semiconductor Documents
BeeKit™ BeeKit™ BeeKit™
MC13224V MC1322x MC1322x MC1322x
802.15.4 Media Access Controller (MAC) MyWirelessApp 802154MWAUG
802.15.4 Media Access Controller (MAC MyStarNetworkApp 802154MSNAUG
802.15.4 MAC PHY Software Reference Manual 802154MPSRM Simple Media Access Controller (SMAC) User’s Guide SMACRM
Rev B 0006-00-08-02-000 Page 4 of 34
Wireless Connectivity Toolkit Quick Start Guide BKWCTKQSG Wireless Connectivity Toolkit User’s Guide BKWCTKUG Wireless Connectivity Toolkit Software Release Notes BKWCTKRN
Datasheet MC1322x Reference Manual MC1322xRM Software Driver Reference Manual 22XDRVRRM Simple Media Access Controller (SMAC) Reference Manual 22xSMACRM
(www.freescale.com)
FreeStar Pro SMAC Programmers’ Guide
Document Title Document Name / Number
Freescale
Note
found on the CEL Freestar Pro CD.
ZFSM-201-1 ZFSM-201-KIT-1 ZFSM-201-EVB-1 ZFSM-201-EVB-1 ZFSM-201-EVB-1 ZFSM-201-EVB-1 ZFSM-201-KIT-1 ZFSM-201-KIT-1, ZFSM-201-EVB-1 Note
Test Tool
: The Freescale documents listed above will be loaded to the user’s PC when installing the
Datasheet 0006-00-07-00-000
: The CEL documents listed above are included on the CEL CD.
User’s Guide TTUG
CEL Documents
Development Kit User Guide 0006-00-08-00-000
Evaluation Board Host Serial & RF Protocol Guide Evaluation Board SMAC Programmers Guide 0006-00-08-02-000 Evaluation Board BeeKit™ Porting Guide Evaluation Board MAC Programmers Guide 0006-00-08-05-000
Wireless UART Application User Guide
Erratum 0006-00-08-04-000
(www.cel.com)
2 Code Development in IAR Workbench®
BeeKit™
0006-00-08-01-000 0006-00-08-03-000 0006-00-08-06-000
Toolkit
Figure 1 – Screen, IAR Website, Workbench®
2.1 TOOLS
2.1.1 IAR Embedded Workbench® for ARM
Several options exist to purchase or evaluate this program.
See The included SMAC project on the CD was developed in IAR Embedded Workbench® for
Rev B 0006-00-08-02-000 Page 5 of 34
www.iar.com for details
ARM version 5.20.
2.1.2 J-Link
FreeStar Pro SMAC Programmers’ Guide
Figure 2 – Photo, J-Link Debugging Probe
The IAR J-Link is necessary for in-circuit debugging.
See Download and install the latest driver from http://www.segger.com/download_jlink.html
www.iar.com for more details and where to purchase.
2.2 PROJECT OVERVIEW
2.2.1 File Location on the CD
A complete IAR project, developed based on the BeeKit™ SMAC codebase is included on the CEL CD in the directory \ZFSM-201\Application Source Files\CEL_SMAC_111_v1.2 \CEL_SMAC_111\. It is titled ‘CEL_SMAC_111.eww’.
The project was based on the ‘Generic Application’ template in BeeKit™ (see Figure 3)
with changes to a few of the Application Source files.
2.2.2 Changes to BeeKit Generated Files
The default project creates one application source file named generic_app.c contained in the subdirectory \ZFSM-201\Application Source Files\ CEL_SMAC_111_v1.2 \CEL_SMAC_111 \Application\Source. See Table 2.
Rev B 0006-00-08-02-000 Page 6 of 34
Figure 3 – Screen, BeeKit – New Project
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.u8BufSize = APP_PACK_SZ;
generic_app_init();
for(;;) { // (void)process_radio_msg(); // data_indication_execute(); // process_uart_data(); // generic_app(); MainState(); } }
/************************************************************************************
In the Main() function in
Table 2, notice that the default contents of the ‘for’ loop are commented out and a function named ‘MainState()’; is called instead. This makes porting the application code to new codebases, or other projects quicker and cleaner.
Several files created by BeeKit™ had to be modified. They include changes to:
o project settings o TransceiverConfigMngmnt.h file o generic_app.c file o UartUtil.c file o WirelessLinkMngmt.c file
These changes are fully documented at the top of the main_state.c file and are shown in Table 3.
Table 3 – Code, “main_state.c” – Changes to BeeStack Generated Code
main_state.c
////////////////////////////////////////////////////////////////////////////////// // Filename: main_state.c // // Description: this is the main state machine for the application // it is kept in a different function than main() so that // it is easier to keep the project in tact as new versions // of the SMAC codebase are released. An attempt will be made // in this file to document any changes to BeeKit generated // code. This will again make it easier to keep the project in
Rev B 0006-00-08-02-000 Page 7 of 34
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.com // // Version rev 1.0 // ////////////////////////////////////////////////////////////////////////////////// // ****** Changes to BeeStack Generated Code ****** //project settings // 1) in workspace window under Application->Utilities folder remove // display.c and sound.c // // //TransceiverConfigMngmnt.h (In workspace window in IAR under SMAC->Source) // - find and replace: // typedef enum Test_Mode_tag // { // SMAC_TEST_MODE_IDLE = 0, // SMAC_TEST_MODE_CONTINUOUS_RX,//1 // SMAC_TEST_MODE_CONTINUOUS_TX_NOMOD,//2 // SMAC_TEST_MODE_CONTINUOUS_TX_MOD,//3 // SMAC_TEST_MODE_PULSE_PRBS9_TX,//4 // SMAC_TEST_MODE_PER_RX,//5 // SMAC_TEST_MODE_RANGE_RX,//6 // SMAC_TEST_MODE_PER_TX,//7 // SMAC_TEST_MODE_RANGE_TX,//8 // SMAC_MAX_TEST_MODES//9 // } Test_Mode_t; // // //generic_app.c // 1) find and comment out: print_freescale_logo(); (fucntion call only in static // void generic_app_init(void) // // 2) the following keep the Switch ISR callback out the the generic_app code that // is replaced with a new codebase // -find: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch_1_isr); // change: CRM_RegisterISR(gCrmKB4WuEvent_c, Switch1_isr);
Rev B 0006-00-08-02-000 Page 8 of 34
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.c and comment out // ensure it is defined in application_globals.h // // 4) in list of include files add: // #include "application_globals.h" // #include "main_state.h" // // 5) in void main (); find and comment out: // for(;;) // { // (void)process_radio_msg(); // data_indication_execute(); // process_uart_data(); // generic_app(); // } // //UartUtil.c // 1) comment out: IntAssignHandler(gUart1Int_c, (IntHandlerFunc_t)UartIsr1); // replace with: IntAssignHandler(gUart1Int_c, (IntHandlerFunc_t)UartIsr1A); // // 2) comment out: ITC_EnableInterrupt(gUart1Int_c); // copy and move to bottom of UART1 init routine: ITC_EnableInterrupt(gUart1Int_c); // // 3) add extern void UartIsr1A(void); prototype // //WirelessLinkMngmt.c // 1) find FuncReturn_t MCPSDataRequest (message_t *msg) // add // #if MANUAL_PA_POWER == TRUE // LED_TurnOnLed(LED1); // u16LED1_OnTimer = 10; // #endif // // 2) add // #include "../../Application/Utilities/Leds.h" // #include "../../Application/Source/application_globals.h" // extern uint16_t u16LED1_OnTimer; // //////////////////////////////////////////////////////////////////////////////////
Rev B 0006-00-08-02-000 Page 9 of 34
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.1 Source Files
As shown in Figure 4, six application source files are included in the Sample Project. Except for generic_app.c, each file also has a corresponding header (.h) file.
application_nvm.c Contains the source code necessary to write to NVM  applications.c Contains the base applications for the CEL/SMAC release
o range test
o packet error rate test
o continuous receive
o pseudo random binary sequence tx
generic_app.c See description in Section 0 above  main_state.c See description in Table 3 above timer.c Enables and processes timer related functions  uart_parse.c Handles incoming and outgoing UART messages.
2.3.2 Utility files
The following software modules included with the project when made by BeeKit™ are located in the ‘Utilities’ folder as shown in Figure 4.
Keyboard.c Contains the keyboard initialization function Leds.c Contains utility functions for the LEDs management  UartUtil.c Contains the UART utilities
Rev B 0006-00-08-02-000 Page 10 of 34
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.
Figure 6 – Screen, IAR Workbench – Debug mode
Rev B 0006-00-08-02-000 Page 11 of 34
Loading...
+ 23 hidden pages