4. Booting Strategies

4.1. Boot Sequence

On power-up the AT91SAMA5 microcontroller always boots the first level bootloader from internal ROM memory at address 0x0. It can boot in standard boot mode, which will be described in this chapter, or in secure boot mode. How the secure boot mode can be enabled and how the chip operates in this mode is provided in an application by Atmel®, which is only available under NDA. Please contact taskit support, if you want to employ the secure bootloader.

The ROM code first samples the BMS signal, if it is low, it will boot from NOR flash connected to NCS0 of the external bus. If it is high it tries to retrieve valid code from external memories. The sequence is shown in the following diagram

The standard boot sequence can be altered by writing to the boot sequence controller (BSC) at address 0xFFFF FE54. This has the effect of speeding up the boot process or to avoid having relevant pins driven during the boot process. The boot configuration register is battery-backed and thus the state is preserved during reboots, if a battery is connected. Otherwise it is reset to the default value (0X0).

Boot ValueSPI0 NPCS0SD Card MCI0SD Card MCI1NAND FlashSPI0 NPCS1TWI EEPROMSAM-BA
0 Yes Yes Yes Yes Yes Yes Yes
1 Yes No Yes Yes Yes Yes Yes
2 Yes No No Yes Yes Yes Yes
3 Yes No No No Yes Yes Yes
4 Yes No No No Yes Yes Yes
5-7 No No No No No No Yes

Table 6.1. SAMA5D3X Boot Sequence


Please note, that boot from SD Card (MCI1) is not working according to the errata of the Microcontroller.

4.2. SAM-BA Monitor

If no valid code is found along the configured sequence the SAM-BA monitor is launched. The SAM-BA Monitor initializes the DBGU and USB-Device. It then checks if an USB device enumeration occurs or if characters are received on the DBGU. Once the communication interface is identified, it runs an infinite loop, waiting for commands.

The SAM-BA monitor allows programming of flash or similar. For this purpose Atmel provides a tool running on desktop PCs. If you need to use the SAM-BA monitor and have valid code on one of the booting devices, these have to be disabled first (e.g. disable chipselect of serial or nand flash or remove SD/MMC-Card).

4.3. Design Constraints

The boot sequence affects the design of the pins, which are initialized during the boot sequence. When using pins in a different multiplexing, which are also assigned to a boot device, it has to be kept in mind that these pins could be muxed for the relevant peripheral during boot process and accordingly driven by the microprocessor. Programming the boot sequence controller may help to avoid unwanted side effects.

Before performing the jump to the application in the internal SRAM, all PIOs and peripherals used in the boot program are set to their reset state

Boot Device PinPio LinePin on Stamp
SD Card MCI0 CK PD9 Bus 71
CDA PD0 Bus 76
DA0 PD1 Bus 75
DA1 PD2 Bus 74
DA2 PD3 Bus 73
DA3 PD4 Bus 72
SPI Flash SPI0 MOSI PD11 IO 94
MISO PD10 IO 95
SPCK PD12 IO 93
NPCS0PD13 IO 92
NPCS1PD14 IO 91
TWI EEPROM TWI0TWD0 PA30 IO 38
TWCK0PA31 IO 37
DBGU DRXD PB30 Bus 43
DTXD PB31 Bus 42

Table 6.2. Pins Driven by Boot on Stamp Interface