Freescale Semiconductor 802.15.4/Zigbee Reference Manual Download Page 1

 

 

 

 

802.15.4/Zigbee 

Embedded Bootloader 

Reference Manual 

 

 

 

 

 

 

 

802154EBRM/D 

Rev. 0.0, 09/2004 

 

 

 

Summary of Contents for 802.15.4/Zigbee

Page 1: ...802 15 4 Zigbee Embedded Bootloader Reference Manual 802154EBRM D Rev 0 0 09 2004 ...

Page 2: ...nductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed...

Page 3: ... 1 4 Chapter 2 Using the Embedded Bootloader 2 1 2 1 Upload Firmware 2 1 2 1 1 Use Case One 2 1 2 1 2 Use Case Two 2 2 2 1 3 Safe Mode Boot 2 2 2 2 Updating Non volatile Memory NVM 2 3 2 2 1 An Example of How to Change the MAC Address 2 3 2 3 System Bus Frequency 2 4 2 4 UART Baud Rate 2 4 Chapter 3 Test Tool Zigbee Flash Tool 3 1 3 1 Graphical User Interface GUI Version 3 2 3 1 1 Using the Tools ...

Page 4: ...Application 5 2 5 2 1 Compiler Defines 5 2 5 2 2 Unreferenced Symbols 5 2 5 2 3 System Clock Setup 5 3 5 3 Application Support Files 5 3 5 3 1 DigiType h 5 3 5 3 2 Gb60_io h 5 3 5 3 3 Crt0 c and Crt h 5 4 5 3 4 Embedded_Bootloader h and Embedded_Bootloader c 5 5 5 3 5 NV_Data c and NV_Data h 5 5 5 3 6 ISR_Vectors c 5 5 5 3 7 DummyIsr c 5 6 Chapter 6 Port Integration Reference Guide 6 1 6 1 Embedde...

Page 5: ...r_Target h 6 5 6 4 4 HW_Init h 6 6 6 4 5 HW_Init c 6 6 6 4 6 main c 6 6 Chapter 7 Embedded Bootloader Public Function Description 7 1 7 1 802 15 4 Zigbee Application Accessible Functions 7 1 7 1 1 Enable_Download_Firmware 7 1 7 1 2 Hard_Reset 7 3 7 1 3 Update_NV_RAM 7 3 7 1 4 NV_Flash_Setup 7 4 7 1 5 FL_ICG_Setup 7 4 7 1 6 UART_Port_Select 7 5 Chapter 8 Embedded Bootloader Memory Map 8 1 Appendix ...

Page 6: ...ganized into eight chapters and one appendix Chapter 1 Embedded Bootloader Description This chapter gives an overview of the Embedded Bootloader Chapter 2 Using the Embedded Bootloader This chapter describes the basic functionality of the Embedded Bootloader Chapter 3 Test Tool Zigbee Flash Tool This chapter describes the Zigbee Flash Tool The GUI and Command Line versions are covered Chapter 4 Pr...

Page 7: ...raphical User Interface MAC Medium Access Control MCU MicroController Unit NVM None Volatile Memory PC Personal Computer PCB Printed Circuit Board S19 S19 is the file extension used for the Motorola binary image format The S19 file encapsulates the binary image as a list of ASCII records Each record contains a length address data and checksum field The 16 bit address field allows a memory space fo...

Page 8: ...Note Handling MAC Address Erasure AN2825 D 5 Freescale Application Note Zigbee 802 15 4 Evaluation Kit Quick Start Guide AN2772 D 6 Freescale Embedded Bootloader User s Guide MC13192FLUG D 7 Freescale Switch Demo Application AN2773 D Revision History The following table summarizes revisions to this manual since the previous release Rev 0 0 Revision History Location Revision Entire Document This do...

Page 9: ... Zigbee Flash Tool which can be found in the Test Tool Suite Test Tool exe This document describes Embedded Bootloader version 5 01 The Embedded Bootloader is located in a protected 4 KB flash block in the highest memory area 0xF000 0xFFFF of the Freescale MC908HCS08GB60 GT60 microcontroller It cannot be accidentally erased A BDM debugger is required to erase the Embedded Bootloader See the Handli...

Page 10: ...COM1 port SCI1 Version Number 528 536 Ver 5 01 DIG536 2 SARD PC Communication Interface RS232 UART on COM1 SCI1 Safe Mode Boot Short pins 2 3 on COM1 port SCI1 Version Number 528 536 Ver 5 01 RD01 PC Communication Interface RS232 UART USB on COM1 SCI1 RS232 UART USB on COM2 SCI2 Safe Mode Boot Short pins 2 3 on COM1 SCI1 COM2 SCI2 Version Number RD01 Ver 5 01 NOTE The generic RD01 target can be us...

Page 11: ...ty debug development tools to get started Users can update the 802 15 4 Zigbee application firmware without having to build in additional code for interfacing to the Embedded Bootloader See Section 2 1 3 Safe Mode Boot Application firmware can be updated after production by users However this requires that the final product has a communication interface UART USB Users can update the 802 15 4 Zigbe...

Page 12: ...le NOTE Care must be taken when enabling this option The user must save a backup of vital production data MAC address The production data can be manually added to the NVM structure in the NV_Data c file Do not reset after upload o Disabled The system is automatically reset after upload default o Enabled The system must be manually reset by user Skip firmware checksum verification o Disabled A chec...

Page 13: ...e feature that makes it possible for the application to call the Enable_Download_Firmware function The application can optionally call the Hard_Reset function to perform a reset or the board can be reset manually The board will now start up in Embedded Bootloader mode Start the PC Tool See Chapter 3 for more information 2 1 1 Use Case One In this case users send a specific command via the UART to ...

Page 14: ... disable the detection of an invalid malfunctioning application due to items such as code errors corrupt NVM data or internal flash programming errors among others All the NVM memory except production data and MAC address is completely erased The Safe Mode Boot can also be used to upload firmware without first calling the Enable_Download_Firmware function This could be useful if the use cases as s...

Page 15: ...ded Bootloader 2 2 Updating Non volatile Memory NVM The following steps show how to update the NVM data from an application code 1 The Embedded Bootloader must be present on the board NOTE All EVBs are shipped with the Embedded Bootloader pre programmed in flash The Embedded Bootloader can only be erased programmed with a BDM debugger 2 Call the Update_NV_RAM function This function can change any ...

Page 16: ...M D for more details If no NVM data can be found the following safe mode boot values are used MC13192 CLKO 62 5 KHz MC908HCS08GB60 GT60 bus clock 16 MHz 2 4 UART Baud Rate If NVM data is found the UART baud rate is setup as specified by the uploaded application Several values can be used See the MC908HCS08GB60 GT60 MCU Data Sheet MC9S08GB60 D for more information The baud rate depends on the NVM v...

Page 17: ...ry help The flash programming part of the Test Tool can be used with two different user interfaces 1 The GUI version in Test Tool exe 2 The command line version in Bootloader exe in the S19 folder This description covers Embedded Bootloader version 5 00 of the Zigbee Test Tool Uploadable applications in Motorola S19 file format must be copied to the installation directory Freescale Test Tool S19 d...

Page 18: ...e the baud rate specified for the current embedded application Notice that applications require that you push one or more buttons or some other functions to enable upload of new firmware See the Zigbee 802 15 4 Evaluation Kit Quick Start Guide AN2772 D for a description of what to do for a specific application If no application is downloaded use the default settings specified for the Embedded Boot...

Page 19: ...ed for the current embedded application See the Zigbee 802 15 4 Evaluation Kit Quick Start Guide AN2772 D for a description of what to do for a specific application If no application is uploaded you must use the default settings specified for the Embedded Bootloader See Chapter 2 for more information NOTE If the USB interface is used the USB option appears as a new COM port Figure 4 View Menu Opti...

Page 20: ...ck on the application file to upload and then click on the Upload button The upload progress bar begins to indicate upload progress Figure 5 Firmware Upload The Status Error Information Field shows the Status Error Information received from the Embedded Bootloader Status Error Information Field Upload Button Upload Progress Field Application Files ...

Page 21: ...dow appears as shown in Figure 6 NOTE A system reset is performed default after upload as shown in Figure 6 Figure 6 After a Successful Firmware Upload NOTE If the uploaded application uses another baud rate it is required to change baud rate values in order to be able to communicate with the board Automatic Reset Enabled ...

Page 22: ...ifferent ways 1 If the uploaded application does not support NVM data editing it is possible to edit the NVM data in the application file before it is uploaded to the board and save it back in the application file for later upload 2 If the uploaded application does support NVM data editing it is possible to edit the NVM data after the board has been uploaded with the application For example the fi...

Page 23: ...Freescale Semiconductor Embedded Bootloader Reference Manual Rev 0 0 3 7 Figure 8 System Configuration Window ...

Page 24: ...Semiconductor 3 2 Command Line Version CMD The command line version of the Embedded Bootloader flash programming tool must be called with parameters Execute Bootloader exe without parameters to show a parameter list Figure 9 Command Line Version Parameter List ...

Page 25: ...s NOTE It is not possible to edit NVM data with the CMD version 3 2 2 Flash Erase Disabled Example Flash erase disabled example Bootloader EVK_PTC_Demo s19 C COM2 B 19200 E A O S Figure 11 Command Line Version Flash Erase Disable Option NOTE The flash is not erased and a flash programming error is detected at address 0xEFFE This is the address of the Embedded Bootloader control flags which was not...

Page 26: ...3 10 Embedded Bootloader Reference Manual Rev 0 0 Freescale Semiconductor ...

Page 27: ...a c and NV_Data h if they need to upgrade the Embedded Bootloader This can be done either manually or automatically by a custom made script with the command line version of the CPROG tool The command line version is not described further Follow the procedures as shown in Section 4 2 on how to make a copy of the production data 4 1 Programming To An Empty Erased Board This section describes how to ...

Page 28: ... Semiconductor The Connection Assistant window appears where you can select the debugger interface connection As shown in Figure 13 a USB connection was chosen and the HCS08 was selected as the CPU type Click the OK button Figure 13 Connection Assistant Window ...

Page 29: ...le File window Specify application file to program in the Load Executable File window as shown in Figure 14 Select Motorola S Record s19 using the Files of type drop down menu Navigate to the folder where a copy of the Embedded Bootloader is located Select the Embedded Bootloader s19 file and click the Open button Figure 14 Load Executable Window ...

Page 30: ...otloader is now programmed to the PCB as shown in the Status Window in Figure 15 Figure 15 Status Window 5 Remove power and disconnect the BDM cable from the PCB Next power up the PCB The PCB is now ready to upload an application See Chapter 2 for details about how to upload an application ...

Page 31: ...e from your chosen installation directory For example installation directory Metrowerks CodeWarrior_CW08_V3 0 Prog 2 From the main window setup the target by selecting Setup Target the select the Component menu and click on Set Target The Set Target window appears as shown in Figure 16 Figure 16 Set Target Window 3 From the Processor drop down menu select HCS08 From the Target Interface drop down ...

Page 32: ...Semiconductor 4 The Connection Assistant window appears where you can select the debugger interface connection As shown in Figure 17 a USB connection was chosen and the HCS08 was selected as the CPU type Click the OK button Figure 17 Connection Assistant Window ...

Page 33: ...e 18 Figure 18 Programmer Expert Window 6 In the Programmer Expert window click on UR Upload Range The Start Address window appears as shown in Figure 19 Here you specify the start address for the NVM section Click the OK button For NVM0 use 0x152F and for NVM1 use 0x172F Figure 19 Start Address Window 7 In the End Address window which looks very similar to the Start Address window specify the end...

Page 34: ...nd PD_NVM1 s19 files Execute the Production_Data_Converter exe The output is an PD_NVM s19 file containing the production data from the active NVM sector NOTE The Production_Data_Converter exe tool can be found in the EVK release EVK_3_0B in folder source Zigbee_EVK EVK_Common CPROG_Tool Scripts 11 Click on Load Application under the File menu to open the Load Executable File window Specify the ap...

Page 35: ...ect SS Specify S record and locate the PD_NVM s19 file built in Step 10 Select the PM Program Module option and production data is written to flash 13 Remove power and disconnect the BDM cable from PCB Next power up the PCB The PCB is now ready to upload an application See Chapter 2 for more information about how to upload an application NOTE The applications must have the production section in th...

Page 36: ...4 10 Embedded Bootloader Reference Manual Rev 0 0 Freescale Semiconductor ...

Page 37: ... Files Application Linker File 5 1 1 Embedded Bootloader Image The Embedded Booloader executable image for a specific PCB must exist on the PCB in advance If not it must be downloaded to the PCB with a BDM debugger like the P E Multilink BDM debugger for HCS08 See Section 1 1 1 Ported Targets for more details NOTE Use caution when making an 802 15 4 Zigbee Application with the Embedded Bootloader ...

Page 38: ...ecified to enable Embedded Bootloader functionality in an 802 15 4 Zigbee application define BOOTLOADER_ENABLED 5 2 2 Unreferenced Symbols The Embedded Bootloader interface variables NVM and strings with version numbers are not referenced directly from the 802 15 4 Zigbee application code Because of this it is required to add dummy references to these and other unreferenced symbols to prevent the ...

Page 39: ...ICG_Setup function This function must be added to the ISR vector table The following is an example of an ISR function to handle lost lock of clock CLKO __interrupt void FLL_Lost_Lock_ISR void Setup ICG module again to prevent that system hangs forever ICGS1 0x01 Clear FLL lost lock interrupt if defined BOOTLOADER_ENABLED FL_ICG_Setup Call ICG_Setup in Embedded Bootloader endif defined BOOTLOADER_E...

Page 40: ...oader these files only contain the _startupdata structure The Embedded Bootloader handles all the basic initialization memory and stack setup of the application That is the application s main function will be the first item called entry point NOTE Do not include basic initialization memory and stack setup when building an application with the Embedded Bootloader Place any necessary initialization ...

Page 41: ...lled once during system initialization NOTE In earlier versions these files were titled FreeLoader_inf c and FreeLoader_inf h Do not user the FreeLoader_inf c and FreeLoader_inf h files with the Embedded Bootloader 5 3 5 NV_Data c and NV_Data h The NVM is not a part of the Embedded Bootloader However it is advised to make the NVM a part of the 802 15 4 Zigbee application The Embedded Bootloader ca...

Page 42: ...ntains a dummy ISR function which makes a break if a BDM debugger is attached to the BDM connector An illegal instruction reset occurs if no BDM debugger is attached The function is added to all unused ISR vectors in the ISR_Vector c file NOTE Users can change this function to any desired functionality ...

Page 43: ...he Generate Code for HCS08 Code Generation option enabled Source file hw_hc08_compiler dll version 5 0 8 0 Setting Cs08 CswMaxLF0 CswMinLF0 CswMinSLB9999 Lasm n lst Lasmc h Ot Ou Onf OnB alr OnCstVar OnPMNC Or TE1uE WmsgNu acdet 6 1 2 HCS08 Linker All Embedded Bootloader object files are linked with the following linker to build an executable file Source file hw_hc08_linker dll version 5 0 8 0 Set...

Page 44: ...b Lib The version number is only available from flash library version 5 00 NOTE The HCS0_Flash_Lib Lib can also be included directly in an application for run time update of NVM Refer to the HCSO8 Flash Application Note AN2770 D for more information 6 2 3 Embedded_Bootloader_Functionality_Lib Lib The library contains the internal functionality of the Embedded Bootloader For example the state machi...

Page 45: ...e and Data Segments The Embedded Bootloader must be linked with the linker file as specified in Section 6 1 2 Several code and data segments are listed and must not be changed Refer to the map file as described in Chapter 8 for more details 6 3 2 Standard Libraries The Embedded Bootloader must include the ansiis lib from Metrowerks for a successful build The library is part of the Metrowerks CodeW...

Page 46: ...he Freescale TARGET_DIG528_2 and TARGET_DIG536_2 MC13192 reset pin connection define HWAssertAbelReset PTCD 0x10 Reset 0 define HWDeAssertAbelReset PTCD 0x10 Reset 1 Optional for Safe Mode Boot indicator function LED pin connections define LED1ON PTDD 0xFE define LED1OFF PTDD 0x01 define LED1TOGGLE PTDD 0x01 define LED2ON PTDD 0xFD define LED2OFF PTDD 0x02 define LED2TOGGLE PTDD 0x02 define LED3ON...

Page 47: ...oader_Target h to achieve a successful port Version number of the build Version number update Big change interface main code structure new feature Y xx increment Y Smaller change function code structure bug fix x Yx increment Y Small change bug fix x xY increment Y define EMBEDDED_BOOTLOADER_VERSION 5 01 Number used with all PCB Targets NOTE Use caution if the version number is changed You should ...

Page 48: ...so be left empty Default is a GPIO pin set low to light an LED void HW_Init The init main function NOTE User can add more functions if required for a particular PCB Do not change the calling sequence 6 4 6 main c This file contains the Embedded Bootloader main function and the Embedded version number void main void It calls the hardware init function and then the Embedded Bootloader state machine ...

Page 49: ...Flash_Setup Update_NV_RAM FL_ICG_Setup UART_Port_Select The Embedded_Bootloader h file contains function pointer prototypes and must be included in source files calling these functions The function pointers are setup to point to functions with the same name in the Embedded Bootloader extern Enable_Download_Firmware_ptr_t Enable_Download_Firmware extern Hard_Reset_ptr_t Hard_Reset extern NV_Flash_S...

Page 50: ...e checksum verification define PERFORM_FLASH_VERIFICATION uint8_t 0x08 NOTE The Embedded Bootloader control flags correspond to the optional firmware upload settings which can be disabled enabled in the Zigbee Flash Tool See Section 1 4 1 Embedded Bootloader Description for details The value is inverted To enable the bit mask option the setting must be set to 0 To disable the bit mask option the s...

Page 51: ...uint8_t Source_ptr uint16_t Source_Length Description The application can call this function to update any NVM parameter with new values specified in the input parameters There is no validation of input parameters NOTE NVM can in code be read as a normal construct Input NV_RAM_Distination_ptr A pointer to current NV RAM data ex The MAC address which must be changed Source_ptr A pointer to new NVM ...

Page 52: ...or execution and initialize the HCS08 flash module Input None Output None 7 1 5 FL_ICG_Setup Prototype void FL_ICG_Setup void Description This function can be called by the application The function could be automatically called if the external system clock is unstable removed from ISR function and on power down up doze This requires that the FL_ICG_Setup is called from an ISR function NOTE Applica...

Page 53: ...ected the active communication interface if used by the application The communication interface can be any of the two SCI ports SCI1 or SCI2 When called with the proper parameters the Embedded Bootloader knows the active communication interface Input data_reg_address the address of the active SCI port data register SCI1 0x1F or SCI2 0x27 status_reg_address the address of the active SCI port status...

Page 54: ...7 6 Embedded Bootloader Reference Manual Rev 0 0 Freescale Semiconductor ...

Page 55: ... Direct Addressing RAM Fast memory NM FF FF 1 Direct Addressing RAM Fast memory Sleep variable gSeqPowerSaveMode NM 100 1FF 256 RAM Embedded Bootloader stack NM 200 F5F 3424 RAM NM F60 F6F 16 RAM Unint RAM for init structure NM F70 F71 2 RAM NV_RAM_ptr NM F72 F7F 14 RAM Flash routines data NM F80 FBC 61 RAM Flash routines critical code NM FBD 106F 179 RAM NM 1070 1077 8 RAM Static variables NM 107...

Page 56: ...2 19 2600 27FF 512 FLASH section 2 20 2800 29FF 512 FLASH section 2 21 2A00 2BFF 512 FLASH section 2 22 2C00 2DFF 512 FLASH section 2 23 2E00 2FFF 512 FLASH section 2 24 3000 31FF 512 FLASH section 2 25 3200 33FF 512 FLASH section 2 26 3400 35FF 512 FLASH section 2 27 3600 37FF 512 FLASH section 2 28 3800 39FF 512 FLASH section 2 29 3A00 3BFF 512 FLASH section 2 30 3C00 3DFF 512 FLASH section 2 31...

Page 57: ...F 512 FLASH section 2 47 5E00 5FFF 512 FLASH section 2 48 6000 61FF 512 FLASH section 2 49 6200 63FF 512 FLASH section 2 50 6400 65FF 512 FLASH section 2 51 6600 67FF 512 FLASH section 2 52 6800 69FF 512 FLASH section 2 53 6A00 6BFF 512 FLASH section 2 54 6C00 6DFF 512 FLASH section 2 55 6E00 6FFF 512 FLASH section 2 56 7000 71FF 512 FLASH section 2 57 7200 73FF 512 FLASH section 2 58 7400 75FF 51...

Page 58: ...F 512 FLASH section 2 74 9400 95FF 512 FLASH section 2 75 9600 97FF 512 FLASH section 2 76 9800 99FF 512 FLASH section 2 77 9A00 9BFF 512 FLASH section 2 78 9C00 9DFF 512 FLASH section 2 79 9E00 9FFF 512 FLASH section 2 80 A000 A1FF 512 FLASH section 2 81 A200 A3FF 512 FLASH section 2 82 A400 A5FF 512 FLASH section 2 83 A600 A7FF 512 FLASH section 2 84 A800 A9FF 512 FLASH section 2 85 AA00 ABFF 51...

Page 59: ...ASH section 2 101 CA00 CBFF 512 FLASH section 2 102 CC00 CDFF 512 FLASH section 2 103 CE00 CFFF 512 FLASH section 2 104 D000 D1FF 512 FLASH section 2 105 D200 D3FF 512 FLASH section 2 106 D400 D5FF 512 FLASH section 2 107 D600 D7FF 512 FLASH section 2 108 D800 D9FF 512 FLASH section 2 109 DA00 DBFF 512 FLASH section 2 110 DC00 DDFF 512 FLASH section 2 111 DE00 DFFF 512 FLASH section 2 112 E000 E1F...

Page 60: ...ash routines critical code copy to RAM 120 F051 F1FF 431 FLASH section 2 121 F200 F3FF 512 FLASH section 2 122 F400 F5FF 512 FLASH section 2 123 F600 F7FF 512 FLASH section 2 124 F800 F9FF 512 FLASH section 2 125 FA00 FBFF 512 FLASH section 2 126 FC00 FDFF 512 FLASH section 2 127 FE00 FF1D 286 FLASH section 2 127 FF1E FFAF 146 FLASH section 2 Embedded Bootloader version number string 127 FFB0 FFBF...

Page 61: ...ecified address If either the Embedded Bootloader and or the 802 15 4 App must not use a particular resource the color from the General HCS08 Map and Usage is kept Cursive fixed register and vectors in flash Bold MUST be located on this particular address DO NOT CHANGE Flash sector 120 127 is block protected and cannot be erased by SW Embedded Bootloader Application RAM 4096 bytes available Code 4...

Page 62: ...8 8 Embedded Bootloader Reference Manual Rev 0 0 Freescale Semiconductor ...

Page 63: ...d here AX 0308RevC Freescale s reference build of the Embedded Bootloader for the Axiom AXM 0308 development board DIG 528 2_DIG 536 2_RD01 DIG 528 2 and DIG 536 2 are Freescale s reference build for the DIG 528 2 and DIG 536 2 EVB s RD01 is Freescale s reference build for all PCB s using the Freescale Reference Design version 01 Embedded_Bootloader_Functionality_Lib Embedded Bootloader functional...

Page 64: ...sh ini Hiwave system file Embedded_Bootloader 802 15 4_Headers Ghdr AbelReg h AppAspInterface h Debug h DigiType h Defined C data types Embedded_Bootloader h New interface file to Embedded Bootloader after version 5 00 FreeLoader_inf h Embedded Bootloader interface file Freeloader before version 5 00 FunctionalityDefines h Gb60_io h Register mapping for HCS08 hwdrv_hcs08 h MacPhy h NV_Data h NVM d...

Page 65: ...6 2 Embedded_Bootloader elf Elf format file Embedded_Bootloader map Map file Embedded_Bootloader s19 Freescale S19 file Embedded_Bootloader Bin Embedded_Bootloader_Functionality_Lib Embedded_Bootloader_Functionality_Lib Lib Functionality library Embedded_Bootloader Bin HCS08_Flash_Lib HCS08_Flash_Lib Lib HCS08 flash library Embedded_Bootloader prm Embedded_Bootloader_HCS08 ach HCS08 GT60 GB60 link...

Page 66: ...A 4 Embedded Bootloader Reference Manual Rev 0 0 Freescale Semiconductor ...

Reviews: