AN535 LIN BOOTLOADER. 1. Relevant Devices. 2. Introduction

Similar documents
Figure 1. 8-Bit USB Debug Adapter

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

UG103.8: Application Development Fundamentals: Tools

AN111: Using 8-Bit MCUs in 5 Volt Systems

AN962: Implementing Master-Slave Timing Redundancy in Wireless and Packet- Based Network Applications

AN803. LOCK AND SETTLING TIME CONSIDERATIONS FOR Si5324/27/ 69/74 ANY-FREQUENCY JITTER ATTENUATING CLOCK ICS. 1. Introduction

UG129: ZigBee USB Virtual Gateway Reference Design (RD ) User's Guide

AN862. OPTIMIZING Si534X JITTER PERFORMANCE IN NEXT GENERATION INTERNET INFRASTRUCTURE SYSTEMS. 1. Introduction

AN580 INFRARED GESTURE SENSING. 1. Introduction. 2. Hardware Considerations

TS1005 Demo Board COMPONENT LIST. Ordering Information. SC70 Packaging Demo Board SOT23 Packaging Demo Board TS1005DB TS1005DB-SOT

UG103-13: Application Development Fundamentals: RAIL

Bootloader with AES Encryption

AN952: PCIe Jitter Estimation Using an Oscilloscope

AN486: High-Side Bootstrap Design Using ISODrivers in Power Delivery Systems

AN922: Using the Command Line Interface (CLI) for Frequency On-the-Fly with the Si5346/47

Making Prototyping Boards for the EFM32 kits

Current Digital to Analog Converter

UG103.8 APPLICATION DEVELOPMENT FUNDAMENTALS: TOOLS

ETRX3USB ETRX3USB-LRS ETRX3USB+8M ETRX3USB-LRS+8M PRODUCT MANUAL

PC Base Adapter Daughter Card UART GPIO. Figure 1. ToolStick Development Platform Block Diagram

CP2110-EK CP2110 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup

QSG108: Blue Gecko Bluetooth Smart Software Quick-Start Guide

AN655 R ANGE TEST APPLICATION FOR EZRADIO AND EZRADIOPRO. 1. Introduction. 2. Supported Radio Types

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

How To Develop A Toolstick

Telegesis is a trademark of Silicon Laboratories Inc. Telegesis ZigBee Communications Gateway. Product Manual

RoHs compliant, Pb-free Industrial temperature range: 40 to +85 C Footprint-compatible with ICS , 2.5, or 3.3 V operation 16-TSSOP

Selecting the Right MCU Can Squeeze Nanoamps out of Your Next Internet of Things Application

AN10866 LPC1700 secondary USB bootloader

ZigBee-2.4-DK 2.4 GHZ ZIGBEE DEVELOPMENT KIT USER S GUIDE. 1. Kit Contents. Figure GHz ZigBee Development Kit

Backup Power Domain. AN Application Note. Introduction

QSG105 GETTING STARTED WITH SILICON LABS WIRELESS NETWORKING SOFTWARE

AN583: Safety Considerations and Layout Recommendations for Digital Isolators

APPLICATION. si32library. Callback CMSIS HARDWARE. Figure 1. Firmware Layer Block Diagram

AN220 USB DRIVER CUSTOMIZATION

USER GUIDE EDBG. Description

AN104 I NTEGRATING KEIL 8051 TOOLS INTO THE SILICON LABS IDE. 1. Introduction. 2. Key Points. 3. Create a Project in the Silicon Labs IDE

AN220 USB DRIVER CUSTOMIZATION

AN0822: Simplicity Studio User's Guide

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

TWR-KV31F120M Sample Code Guide for IAR Board configuration, software, and development tools Rev.0

AN614 A SIMPLE ALTERNATIVE TO ANALOG ISOLATION AMPLIFIERS. 1. Introduction. Input. Output. Input. Output Amp. Amp. Modulator or Driver

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

AN3354 Application note

AT88CK490 Evaluation Kit

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

CPU. PCIe. Link. PCIe. Refclk. PCIe Refclk. PCIe. PCIe Endpoint. PCIe. Refclk. Figure 1. PCIe Architecture Components

USB Audio Simplified

Table 1. RF Pico Boards of the EZRadioPRO Development Kits. Qty Description Part Number

USER GUIDE. ZigBit USB Stick User Guide. Introduction

AVR106: C Functions for Reading and Writing to Flash Memory. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

UART Boot Loader Design on the Kinetis E Series

AN335 USB DRIVER INSTALLATION UTILITY. 1. Description. 2. Installation Install Package

How To Add A Usb Secondary Ipo Bootloader To An Lpc23Xx Flash Device To A Flash Device

USB Stick Driver Installation Instructions

UG103.14: Application Development Fundamentals: Bluetooth Smart Technology

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

1 Software Overview ncp-uart ash-v3-test-app ash-v3-test-app Command Line Options Testing... 2

Using Xbee in Serial Communication

Production Flash Programming Best Practices for Kinetis K- and L-series MCUs

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

User Manual. AS-Interface Programmer

AN10811 Programming SPI flash on EA3131 boards Rev May 2009 Application note Document information Info Content Keywords Abstract

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

WIZ-Embedded WebServer User s Manual (Ver. 1.0)

Connect the EFM32 with a Smart Phone through the Audio Jack

The Answer to the 14 Most Frequently Asked Modbus Questions

Application Note: AN00141 xcore-xa - Application Development

AN588 ENERGY HARVESTING REFERENCE DESIGN USER S GUIDE. 1. Kit Contents. 2. Introduction. Figure 1. Energy Harvesting Sensor Node

Using Altera MAX Series as Microcontroller I/O Expanders

Block 3 Size 0 KB 0 KB 16KB 32KB. Start Address N/A N/A F4000H F0000H. Start Address FA000H F8000H F8000H F8000H. Block 2 Size 8KB 16KB 16KB 16KB

AN335 USB DRIVER INSTALLATION METHODS. 1. Introduction. 2. Relevant Documentation. 3. DPInst Installation and Customization

USER GUIDE Programming Adapter Cable for Fujitsu Flash Microcontroller- F²MC-16LX/FR Family Fujitsu Microelectronics America, Inc.

Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0

CP2102/ V. 48 MHz Oscillator. USB Function Controller. 640B TX Buffer. 576B RX Buffer 1024B PROM. Figure 1. Example System Diagram

8051 MICROCONTROLLER COURSE

DSO138 oscilloscope program upgrade method

AN3998 Application note

Dolphin In-Circuit programming Updating Firmware in the field

Applications Development on the ARM Cortex -M0+ Free On-line Development Tools Presented by William Antunes

Serial Communications

APPLICATION. Using the PB-100 to Make Calls and Announcements From a Database. Using the PB-100 for All-Call Dialing

Lab Experiment 1: The LPC 2148 Education Board

SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual

Software Real Time Clock Implementation on MC9S08LG32

Software User Guide UG-461

PL-2303 (Chip Rev H, HX, X) USB to Serial Adapter Windows Driver Installer Manual

AN10860_1. Contact information. NXP Semiconductors. LPC313x NAND flash data and bad block management

CodeWarrior Development Studio for Freescale S12(X) Microcontrollers Quick Start

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

RN-XV-RD2 Evaluation Board

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

AT89C5131A Starter Kit... Software User Guide

Freescale Variable Key Security Protocol Transmitter User s Guide by: Ioseph Martínez and Christian Michel Applications Engineering - RTAC Americas

etpu Host Interface by:

Getting Started with Kinetis SDK (KSDK)

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Transcription:

LIN BOOTLOADER 1. Relevant Devices This application note applies to the following devices: C8051F50x, C8051F51x, C8051F54x, C8051F58x, and C8051F59x. 2. Introduction A bootloader enables field updates of application firmware. A Local Interconnect Network (LIN) bootloader enables firmware updates over the LIN bus. The LIN bootloader described in this application note is based on the Silicon Labs Modular Bootloader Framework. This framework is described in detail in the application note AN533: Modular Bootloader Framework for Silicon Labs C8051Fxxx Microcontrollers, which can be downloaded from here: http://www.silabs.com/products/mcu/pages/applicationnotes.aspx The following components are part of the firmware update setup: Target Bootloader Firmware Master Programmer Firmware Active Data Source Software Application Firmware Image (Hex File) The firmware update setup is shown in Figure 1. Details about the steps involved in updating the firmware can be found in the Firmware Update Process Flow Diagram in application note AN533. Rev. 0.1 2/11 Copyright 2011 by Silicon Laboratories AN535

PC Target Application Firmware Hex File Master MCU Active Data Source Software Master Programmer Firmware Comm. Interface Device Driver / API UART (RS-232) Comm. Interface (UART) Comm. Interface (LIN) Target MCU LIN Bus Comm. Interface (LIN) Target Bootloader Firmware Target Application Firmware Serial = 0... Target MCU Serial = N Figure 1. Firmware Update Setup 2 Rev. 0.1

3. Target Bootloader Profile The LIN target bootloader firmware allows application firmware updates in the field over the LIN bus. The LIN bootloader code builds under the Keil toolchain with a total size of 1911 bytes. Because the bootloader and application have to be split on page boundaries, the bootloader takes up a total of 2 kb (= four flash pages) code space, with 512 bytes (= one flash page) of that total located on the last flash page, i.e., the one containing the lock byte. This means that the application firmware starts at address 0x0600 and ends one page short of the last flash page. Figure 2 shows the LIN bootloader memory map. Figure 3 shows the code space utilization of the bootloader grouped by functional blocks. Area NOT erasable by bootloader Area erasable by bootloader Bootloader FW Project Reset Vector and Interrupt Redirection 0x0000 0x0600 Bootloader Firmware Application FW Project Bootloader FW Project Part of Bootloader Firmware [Last flash page] RESERVED Area (on most MCUs) Lock Byte Bootloader InfoBlock Figure 2. LIN Target Bootloader Memory Map 2% 9% 3% 5% 4% Reset Vector and Interrupt Redirection 7% Device Specific Functions Flash Read/Erase/Write Functions Main program loop 27% Bootloader Command Interpreter Target Bootloader InfoBlock Comm Functions (LIN0) CRC (CCITT 16) 1% 42% Other (compiler init/library code etc) Figure 3. LIN Target Bootloader Code Space Utilization Profile Rev. 0.1 3

3.1. Configurable Options The target bootloader has the following parameters that can be configured. These parameters are located in two header files as grouped in Table 1 and Table 2. TGT_PRODUCT_CODE 1 TGT_BL_TYPE 2 Parameter Table 1. Fxxx_Target_Config.h Any 8-bit value 8-bit value: 0x82 Options TGT_FLASH_PAGE_SIZE 3 Number of bytes per flash page: 512 TGT_FLASH_PAGE_SIZE_CODE 4 8-bit value: 9 APP_FW_START_ADDR 5 APP_FW_END_ADDR 6 DEV_SERIAL_CHECK_ENABLED 7 Binary: 1 TGT_DEVICE_SERIAL0 8 TGT_DEVICE_SERIAL1 8 24-bit value: 0x000600 24-bit value: 0x00FBFF 8-bit value: 0x01 8-bit value: 0x00 Notes: 1. This can be used to identify a product line among many different products. 2. This denotes that the BL uses Silicon Labs-defined LIN bootloader protocol (see Fxxx_BL130_LIN_Interface.h ). 3. Should be changed based on the MCU data sheet. 4. 2 n encoding: 2 9 =512 bytes. 5. Starting address of App FW. 6. Ending address of App FW (includes App InfoBlock and Signature bytes). 7. 0 = Disabled; 1 = Enabled. When enabled, device serial number is matched for TGT_ENTER_BL_MODE command. 8. Ensure a UNIQUE serial number for each device on the same LIN network. 4 Rev. 0.1

Parameter Table 2. Fxxx_TargetBL_Config.h CODE_BANKING Binary: 0 1 Binary: 1 2 BOOTLOADER_PIN_OVERRIDE 3 Binary: 1 TGT_BL_FW_INFOBLOCK_LENGTH 4 8-bit value: 16 TGT_BL_FW_VERSION_LOW and TGT_BL_FW_VER- 8-bit values: 0 and 1 SION_HIGH 5 TGT_BL_BUF_SIZE 6 Options Max number of bytes in bootloader receive buffer: 32 TGT_BL_BUF_SIZE_CODE 6 8-bit value: 3 TGT_CRC_TYPE 7 8-bit value: 0x40 TGT_BL_FW_INFOBLOCK_ADDR 8 24-bit value: 0x00FCFE Notes: 1. 0 = Disabled; 1 = Enabled. Disable for MCUs with flash memory 64 kb or less. 2. Enable for MCUs with flash memory greater than 64 kb. 3. 0 = Disabled; 1 = Enabled. When enabled, the bootloader will check a pin state on reset to see if it should stay in BL mode. 4. See Table 1 in AN533. 5. BL v1.0 Low = 0 and High = 1. 6. 2 n encoding: 2 3 = 8 bytes. 7. This denotes that the BL uses the Silicon Labs-defined 16-bit CRC (CCITT-16) (see Fxxx_CRC064_CCITT16.c ). 8. Start address of BL InfoBlock so that it ends adjacent to the lock byte. Rev. 0.1 5

4. Target Application Profile The target application firmware needs to fit within the allocated application area in flash memory. The application firmware memory map is shown in Figure 4. Area NOT erasable by bootloader Area erasable by bootloader 0x0000 Bootloader FW Project Application Reset Vector Set to 0x0600; Redirected Interrupt Vectors (spacing = 3 bytes) 0x0600 0x0600 Application Firmware Application FW Project Application InfoBlock Bootloader FW Project Signature Bytes RESERVED Area (on most MCUs) 4.1. Target Application Template Figure 4. Target Application Memory Map A target application template is included for easy integration with existing application code or to use as a starting point. This template includes the following files: Header Files Fxxx_BL130_LIN_Interface.h Fxxx_Target_Config.h Fxxx_Target_Interface.h Fxxx_TargetApp_Config.h Source Files Note: The application firmware starts at address 0x0600 in this example. F50x_TargetApp_LIN0_BLsupport.c F50x_TargetApp_Startup.A51 Fxxx_TargetApp_InfoBlock.c A typical application would use all files in the template, but that does not mean all the files in the template are required. Files can be omitted or used as a reference to create code that is more suitable to the application. 6 Rev. 0.1

4.2. Configurable Options AN535 The application firmware should always keep its version number updated in the Application InfoBlock whenever a new version is built so that the application hex file includes this information. The active data source software can interpret this information from the hex, while the master programmer can retrieve this data using the TGT_Get_Info command. Table 3. Fxxx_TargetApp_Config.h Parameter Options TGT_APP_FW_VERSION_LOW and TGT_APP_FW_VER- 8-bit values: 0 and 1 SION_HIGH 1 TGT_APP_FW_INFOBLOCK_LENGTH 2 8-bit value: 9 Notes: 1. App v1.0 Low = 0 and High = 1. 2. See Table 5 in AN533. 4.3. Making an Application Bootloader Aware A series of simple steps can be used to make an existing application firmware project bootloader aware, i.e., allow it to co-exist with the bootloader. These steps are described in detail in AN533. The following is a summary of the changes needed when using the Keil toolchain for the F50x MCU family: 1. Add F50x_TargetApp_Startup.A51 to application firmware project and build list; this changes the reset vector from 0x0000 to 0x0600. 2. Add these options to the compiler command line of the project: INTVECTOR(0x600) INTERVAL(3). 3. Add these options to the linker command line of the project: CODE(0x600-0xF9FD,?CO?FXXX_TARGETAPP_INFOBLOCK(0xF9F4)). 4. Add Fxxx_TargetApp_InfoBlock.c to the application project and build list. 5. [OPTIONAL] Add F50x_TargetApp_LIN0_BLsupport.c to the application project and build list, then insert calls in the application to call the functions in that source file to recognize the TGT_Enter_BL_Mode command and take appropriate action. 6. Check hardware design to allow the use of a GPIO pin as a fail-safe trigger to enter bootload mode. In the LIN bootloader example, port pin P1.4 is used for this purpose. To disable or change this, see Fxxx_TargetBL_Config.h and F50x_TargetBL_DevSpecific.c in the Target Bootloader firmware project. If this is disabled, then the application has to provide some other way of entering bootload mode. 4.4. Target Application Examples Two versions of an application firmware example ( F50x_LIN0_Slave_Blinky ) are included with the source code. These examples show the application firmware settings needed to co-exist with the bootloader and also demonstrate firmware updates by showing slightly different functionality between the two versions (v1 and v1.1). See AN533 for the firmware update steps. Rev. 0.1 7

5. Master Programmer and Data Source Examples A master programmer example that runs on the C8051F500 MCU is included with the LIN bootloader source code. This master programmer example can update the firmware on any Silicon Labs MCU with a LIN interface that implements the LIN protocol as detailed in the above sections and per the specifications in Section 5. This example code can be used as-is, or can be used as a reference to implement this functionality on another MCU. The master programmer includes code to communicate with the active data source PC software via the UART. Code banking support is included, so the master programmer can work with targets that have more than 64 kb of flash memory. The Silicon Labs MCU Serial Bootloader Data Source software included with the modular bootloader framework is an example of an active data source software. This is described in application note AN533: Modular Bootloader Framework for Silicon Labs C8051Fxxx Microcontrollers. The software installer and source code are included in the file AN533SW.zip, which is available for download from: http://www.silabs.com/products/mcu/pages/ ApplicationNotes.aspx 6. LIN Protocol Details The LIN protocol details used by the LIN bootloader are shown in Table 4. Any changes to these details would have to be duplicated in all three projects (Master Programmer, Target Bootloader, and Target Application). If changes are made to any of the protocol details, the TGT_BL_TYPE value in Fxxx_Target_Config.h should also be changed from the Silicon Labs standard value of 0x82 (decimal 130) to a value within the user-defined range of 0x01 through 0x7F, and the 130 in the file name Fxxx_BL130_LIN_Interface.h should be changed appropriately as well. Table 4. LIN Protocol Details Parameter Value Parameter Definition and File Name LIN Baud Rate 19200 Comm_Init() function in F50x_Comm_LIN0.c Auto Baud Disabled Comm_Init() function in F50x_Comm_LIN0.c LIN Message Size 8 bytes LIN_MESSAGE_SIZE in Fxxx_BL130_LIN_Interface.h Master Transmit Message ID (Master to Target) Master Transmit Message ID (Master to Target) Master Receive Message ID (Target to Master) 0x04 0x05 0x06 ID_MASTER_TO_SLAVE_BL_CMD in Fxxx_BL130_LIN_Interface.h ID_MASTER_TO_SLAVE_WR_CMD in Fxxx_BL130_LIN_Interface.h ID_SLAVE_TO_MASTER_BL_RSP in Fxxx_BL130_LIN_Interface.h 8 Rev. 0.1

Simplicity Studio One-click access to MCU and wireless tools, documentation, software, source code libraries & more. Available for Windows, Mac and Linux! IoT Portfolio www.silabs.com/iot SW/HW Quality Support and Community www.silabs.com/simplicity www.silabs.com/quality community.silabs.com Disclaimer Silicon Labs intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Silicon Labs products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Labs reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Silicon Labs shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products are not designed or authorized to be used within any Life Support System without the specific written consent of Silicon Labs. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Labs products are not designed or authorized for military applications. Silicon Labs products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons. Trademark Information Silicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, Bluegiga, Bluegiga Logo, Clockbuilder, CMEMS, DSPLL, EFM, EFM32, EFR, Ember, Energy Micro, Energy Micro logo and combinations thereof, "the world s most energy friendly microcontrollers", Ember, EZLink, EZRadio, EZRadioPRO, Gecko, ISOmodem, Precision32, ProSLIC, Simplicity Studio, SiPHY, Telegesis, the Telegesis Logo, USBXpress and others are trademarks or registered trademarks of Silicon Labs. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders. Silicon Laboratories Inc. 400 West Cesar Chavez Austin, TX 78701 USA http://www.silabs.com