CAN SBL Users Guide

Table of Contents

This document is a guide to the Secondary Bootloader application for AWR1843 device.

1. Introduction

In automotive applications, CAN is the only available external interface to the XWR1843 device and hence any update to the application binaries residing in the SFLASH need to be received over CAN. The secondary bootloader primarily is responsible for supporting the following functionality:

  1. Provides the capability of updating application binaries in the SFLASH by receiving the binaries over CAN
  2. Loads the application to run on the device. The SBL is never updated once deployed in the field. This ensures that even in case of power outages during the update of the application there is no impact to the availability of the device. On the subsequent power cycle, the SBL again is loaded by the primary (ROM) bootloader to allow for an update to the application.

Secondary bootloader application aims at providing a reference for an application which can fulfill this requirement.

The following Nomenclature is used throughout this document:

Primary Bootloader or PBL The ROM bootloader
Secondary Bootloader or SBL This application
Application Meta-Image or User Application The user’s application Meta-Image that will be loaded over CAN interface

1.1 Design Scheme

The application has following two parts:

2. Application Design Flow

The idea behind this approach is that the Meta-Image (without the BSS patch and DSS image) for the secondary bootloader application will be flashed once over UART. From there on, following each Cold/Warm reset, this application will be loaded from the SFLASH into the MSS RAM by the primary bootloader, which then will allow the user to do either of the following based on the user input over UART:

3. Decision Analysis and Resolution (DAR)

3.1 TCMA vs TCMB

Whether to execute the Secondary Bootloader code from TCMA or TCMB.

4. Detailed Flow

The Secondary Bootloader application code is divided into various phases. The functioning and relevance of each phases is explained in the following subsections.

4.1 Pre Initialization

As most of the code would be executing from the MSS TCMB memory, it needs to be copied from TCMA to TCMB as part of the pre initialization routine. The following variables are defined in the linker command file which will be used to copy the code.

extern uint32_t _libRunAddr, _libLoadStart, _libLoadEnd;
extern uint32_t _constRunAddr, _constLoadStart, _constLoadEnd;
extern uint32_t _startupRunAddr, _startupLoadStart, _startupLoadEnd;

4.2 MPU Configuration

The following Memory sections will be relevant for this application. The MPU setting of each of these sections is also specified.

4.3 PinMux

The following peripherals are used for this application. Hence the pin muxing for these peripherals is required.

4.4 User Input

The UART is initialized with following configuration:

Baudrate : 115200
Data : 8 bit
Parity : None
Stop bit : 1 bit
Flow control : None

User can choose from one of the following option:

4.5 Can Downloader

The following steps are performed in this phase:

4.6 Flash Downloader

The following steps are performed in this phase:

4.7 Soft Reset

Reset the MSS core

5. Configurable Options

Only the following options should be configured as per the requirement (in main.c):

#define SBL_CANFD_DATA_MSG_ID 0x29E

The CAN message ID for the receiving the Meta-Image.

#define SBL_CANFD_TERMINATE_MSG_ID 0x19E

The CAN message ID for the notifying the end of CAN transmission.

#define METAIMAGE_OFFSET (300 * 1024)

The user application Meta-Image offset from the start of flash memory. This value shall be larger than the size of SBL Meta-Image.

#define ERASE_SIZE_KB (1024)

This is the size of flash memory that needs to be cleared before flashing the application Meta-Image. This value shall be larger than the size of the application Meta-Image.

6. Usage

6.1 Pre requisites

6.2 Running the application

The Meta-Image for SBL application will be created automatically along with the out file upon compiling this application. Note that this image will contain only the MSS binary (no BSS or DSS binary). This Meta-Image needs to be flashed once using the conventional method (uniflash). From this point onwards, this image will reside in the SFLASH as the primary Meta-Image (until a new image is flashed using the uniflash) and will be loaded each time after a cold or warm reset. Follow the below steps to run the application:

Baudrate : 115200
Data : 8 bit
Parity : None
Stop bit : 1 bit
Flow control : None

If there is no error is the application Meta-Image, the application will start executing automatically. Refer to the below figure.

7. PC based CAN Application

A PC based CAN application based on the Peak System USB to CAN Dongle is already provided. For other similar dongles, the application has to be ported. The General flow of the application is explained in the below flow diagram