Skip to content

Commit 0aefab9

Browse files
committed
Updated documentation
1 parent 170dc00 commit 0aefab9

File tree

8 files changed

+434
-490
lines changed

8 files changed

+434
-490
lines changed

README.md

Lines changed: 170 additions & 217 deletions
Large diffs are not rendered by default.

bootloaders/zero/README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Arduino Zero Bootloader
22

3-
## 1- Prerequisites
3+
## Prerequisites for Building
44

55
The project build is based on Makefile system.
66
Makefile is present at project root and try to handle multi-platform cases.
@@ -40,30 +40,30 @@ Make is usually available by default.
4040
Make is available through XCode package.
4141

4242

43-
## 2- Makefile Configuration
43+
## Makefile Configuration
4444

4545
The section between 'Begin Configuration' and 'End Configuration' in the Makefile should be edited.
4646
Set BOARD_ID and MCU to a chip listed in the comments.
4747

48-
# Boards definitions:
49-
# MT_D21E_rev_A, MT_D21E_rev_B, MT_D11, MT_D21J
50-
# arduino_zero, arduino_mkrzero, arduino_mkr1000, genuino_mkr1000, genuino_zero
51-
# Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A
48+
### Boards definitions:
49+
* MT_D21E_rev_A, MT_D21E_rev_B, MT_D11, MT_D21J
50+
* arduino_zero, arduino_mkrzero, arduino_mkr1000, genuino_mkr1000, genuino_zero
51+
* Generic_x21E, Generic_x21G, Generic_x21J, Generic_D11D14AM, Generic_D11D14AS, Generic_D11C14A
5252

53-
# MCU definitions:
54-
# SAMD21J: SAMD21J18A, SAMD21J17A, SAMD21J16A, SAMD21J15A
55-
# SAMD21G: SAMD21G18A, SAMD21G17A, SAMD21G16A, SAMD21G15A
56-
# SAMD21E: SAMD21E18A, SAMD21E17A, SAMD21E16A, SAMD21E15A
57-
# SAML21J: SAML21J18B, SAML21J17B, SAML21J16B
58-
# SAML21G: SAML21G18B, SAML21G17B, SAML21G16B
59-
# SAML21E: SAML21E18B, SAML21E17B, SAML21E16B, SAML21E15B
60-
# SAMC21J: SAMC21J18A, SAMC21J17A, SAMC21J16A, SAMC21J15A
61-
# SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A
62-
# SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A
63-
# SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS
53+
### MCU definitions:
54+
* SAMD21J: SAMD21J18A, SAMD21J17A, SAMD21J16A, SAMD21J15A
55+
* SAMD21G: SAMD21G18A, SAMD21G17A, SAMD21G16A, SAMD21G15A
56+
* SAMD21E: SAMD21E18A, SAMD21E17A, SAMD21E16A, SAMD21E15A
57+
* SAML21J: SAML21J18B, SAML21J17B, SAML21J16B
58+
* SAML21G: SAML21G18B, SAML21G17B, SAML21G16B
59+
* SAML21E: SAML21E18B, SAML21E17B, SAML21E16B, SAML21E15B
60+
* SAMC21J: SAMC21J18A, SAMC21J17A, SAMC21J16A, SAMC21J15A
61+
* SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A
62+
* SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A
63+
* SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS
6464

6565

66-
## 3- Behaviour / Board Configuration
66+
## Board Configuration
6767

6868
Configuration for each board is available in the board_definitions directory.
6969
Each board has a file named board_definitions_BOARD_NAME.h, where BOARD_NAME is
@@ -181,7 +181,7 @@ so no crystal is required. No LEDs are defined. BOOT_LOAD_PIN is not
181181
defined, but BOOT_DOUBLE_TAP_ENABLED is, since it uses the reset pin.
182182

183183

184-
## Boot condition test sequence
184+
## Boot Condition Test Sequence
185185
First, the start location of the sketch is fetched and checked. If it
186186
is empty (0xFFFFFFFF), then bootloader execution is resumed. Note that
187187
when Arduino auto-reset (into bootloader) is initiated, the first flash
@@ -198,7 +198,27 @@ should not be defined. USB_VENDOR_STRINGS_ENABLED also should not be
198198
defined in most cases, as well as BOOT_LOAD_PIN.
199199

200200

201-
## 4- Details
201+
## Building
202+
203+
If not specified the makefile builds for **MT_D21E_rev_B**:
204+
205+
```
206+
make
207+
```
208+
209+
if you want to make a custom bootloader for a derivative board you must supply all the
210+
necessary information in a `board_definitions_xxx.h` file, and add the corresponding case in
211+
`board_definitions.h`. For example for the **Generic_x21J** board with a **SAMD21J18A** MCU,
212+
we use `board_definitions_Generic_x21J.h` and it is build with the following command:
213+
214+
```
215+
BOARD_ID=Generic_x21J MCU=SAMD21J18A make clean all
216+
```
217+
218+
which will produce a binary named sam_ba_Generic_x21J_SAMD21J18A.bin
219+
220+
221+
## Technical Details
202222

203223
**Pinmap**
204224

@@ -228,23 +248,3 @@ of the system stack. The applet in this case is a very simple word copy function
228248
1KB is reserved for the applet, and there are two 64 byte data buffers placed after it. The
229249
applet has its own stack at the top of RAM, but the word copy applet uses little/none of this.
230250
The bossac tool is responsible for loading the applet. See Devices.h from the Bossa source.
231-
232-
233-
## 5- How to build
234-
235-
If not specified the makefile builds for **MT_D21E_rev_B**:
236-
237-
```
238-
make
239-
```
240-
241-
if you want to make a custom bootloader for a derivative board you must supply all the
242-
necessary information in a `board_definitions_xxx.h` file, and add the corresponding case in
243-
`board_definitions.h`. For example for the **Generic_x21J** board with a **SAMD21J18A** MCU,
244-
we use `board_definitions_Generic_x21J.h` and it is build with the following command:
245-
246-
```
247-
BOARD_ID=Generic_x21J MCU=SAMD21J18A make clean all
248-
```
249-
250-
which will produce a binary named sam_ba_Generic_x21J_SAMD21J18A.bin

variants/Generic_D11C14A/README.md

Lines changed: 49 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ SWDCLK TX1/MISO* 30 | A30 A31 | 31 * RX1/SS
2828
```
2929

3030

31-
# Pins descriptions for Generic ATsamD11C14A
32-
## PIN_MAP_STANDARD
31+
## Pins descriptions for Generic ATsamD11C14A
32+
33+
### PIN_MAP_STANDARD
34+
```
3335
====================================================================================================================================
3436
Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment)
3537
--------|-------|-----------------------|-------------------------------------------------------------------------------------------
@@ -66,8 +68,11 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip
6668
30 | PA30 | MISO / SWD CLK | !EIC/EXTINT[2] SERCOM1/PAD[0] !SERCOM1/PAD[2] !TC2/WO[0] !TCC0/WO[2] SWD CLK, leave floating during boot
6769
31 | PA31 | SS / SWD IO | EIC/EXTINT[3] SERCOM1/PAD[1] !SERCOM1/PAD[3] !TC2/WO[1] !TCC0/WO[3] SWD IO
6870
====================================================================================================================================
71+
```
72+
6973

70-
## PIN_MAP_COMPACT
74+
### PIN_MAP_COMPACT
75+
```
7176
====================================================================================================================================
7277
Arduino | Port | Alternate Function | Comments (! means not used with this peripheral assignment)
7378
--------|-------|-----------------------|-------------------------------------------------------------------------------------------
@@ -96,68 +101,57 @@ Arduino | Port | Alternate Function | Comments (! means not used with this perip
96101
* When using ONE_UART_NO_WIRE_ONE_SPI, Serial1 refers to TX2/RX2 instead of TX1/RX1.
97102
* Leave pin A30 floating (or use external pullup) during reset.
98103
* SERCOM2 does not exist on the D11C14A.
104+
```
99105

100106

101-
# Board Configuration Notes
102-
103-
TODO: Update this for Generic D11C14A
107+
## Board Configuration Notes
104108

105-
* Either the 32.768KHz crystal or the 16MHz crystal can be used.
106-
* The bootloader does not use an external crystal by default. Double-tap the reset button to enter.
109+
* **Crystals**
110+
* Either a 32.768KHz crystal or a high speed crystal can be used.
111+
* The bootloader does not use an external crystal by default. Double-tap the reset button to enter manually.
107112

108-
* **Digital: All pins can be used for general purpose I/O**
109-
* Supports INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN.
110-
* Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin).
113+
* **GPIO**
114+
* All pins (including analog) support INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN.
115+
* Each pin can source or sink a maximum of 7 mA (when PER_ATTR_DRIVE_STRONG is set for the pin, enabled by default).
111116
* Internal pull-up and pull-down resistors of 20-60 Kohms (40Kohm typ., disconnected by default).
112-
* Use the pinMode(), digitalWrite(), and digitalRead() functions.
113-
* **Analog Inputs: 10 pins can be configured as ADC analog inputs.**
114-
* These are available using the analogRead() function.
115-
* All pins can be used for GPIO and some pins can be used for other digital functions (ie. pwm or serial).
117+
118+
* **Analog Inputs**
119+
* 5 pins can be configured as ADC analog inputs.
120+
* Each pin measures from ground to 3.3 volts by default.
116121
* Each pin provides 10 bits of resolution (1024 values) by default.
117122
* 12-bit resolution supported by using the analogReadResolution() function.
118-
* Each pin measures from ground to 3.3 volts.
119-
* The upper end of the measurement range can be changed using the AREF pin and the analogReference() function.
120-
* **DAC: One analog output is available on pin 2.**
123+
* The upper end of the measurement range can be changed using the analogReference() function.
124+
* A reference voltage can be connected to REF.
125+
126+
* **DAC**
127+
* One analog output is available on pin 2.
121128
* Provides a 10-bit voltage output with the analogWrite() function.
122-
* **PWM: 12 pins (MT-D21E) or 8 pins (MT-D11) can be configured as PWM outputs.**
123-
* Available using the analogWrite() function.
129+
130+
* **PWM**
131+
* 6 pins can be configured as PWM outputs.
124132
* Each pin provides 8 bits of resolution (256 values) by default.
125133
* 12-bit resolution supported by using the analogWriteResolution() function.
126-
* **External Interrupts: 15 pins (MT-D21E) or 9 pins (MT-D11) can be configured with external interrupts.**
127-
* Available using the attachInterrupt() function.
128-
* **Serial: 2 pairs of pins (MT-D21E) or 1 pair (MT-D11) can be configured for TTL serial I/O.**
129-
* MT-D21E: Serial1: pin 11 (RX) and pin 10 (TX). Serial2: pin 15 (RX) and pin 14 (TX).
130-
* MT-D11: Serial1: pin 31 (RX) and pin 30 (TX).
131-
* **SPI: 3 or 4 pins can be configured for SPI I/O (SPI).**
132-
* MT-D21E: Pin 18 (MOSI), pin 19 (SCK), pin 22 (MISO), and optionally pin 23 (SS, not currently used).
133-
* MT-D11: Pin 10 (MOSI), pin 11 (SCK), pin 14 (MISO), and optionally pin 15 (SS, not currently used).
134-
* SPI communication using the SPI library.
135-
* Note that the SPI library will set SS as an output.
136-
* On the MT-D11, the button must be configured as reset (default) when using SPI.
137-
* **TWI (I2C): 2 pins can be configured for TWI I/O (Wire).**
138-
* MT-D21E: Pin 16 (SDA) and pin 17 (SCL).
139-
* MT-D11: Pin 22 (SDA) and pin 23 (SCL).
140-
* TWI communication using the Wire library.
141-
* **LED: One pin can be configured to light the onboard LED (LED_BUILTIN).**
142-
* Pin 28 (MT-D21E) or pin 16 (MT-D11). Bring the pin HIGH to turn the LED on. The pullup is disabled on this pin.
143-
* **Button: One pin can be configured to read the onboard Button A (BUTTON_BUILTIN).**
144-
* Pin 27 (MT-D21E) or pin 15 (MT-D11). Pressing the button will bring the pin LOW. The pullup must be enabled first.
145-
* If the debouncing capacitor is connected, delay reading the pin at least 6ms after turning on the pullup.
146-
* **AREF: One pin can be configured as an AREF analog input.**
147-
* The upper end of the analog measurement range can be changed using the analogReference() function.
148-
* **Reset: Bring this line LOW to reset the microcontroller.**
149-
150-
151-
152-
# PinDescription table format
153-
154-
## Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0.
134+
135+
* **External Interrupts**
136+
* 7 pins can be configured with external interrupts.
137+
138+
* **SERCOM**
139+
* 2 SERCOM are available.
140+
* Up to 2 UART instances
141+
* 1 SPI instance
142+
* 1 WIRE (I2C) instance
143+
144+
145+
146+
## PinDescription table format
147+
148+
### Note that a new column (GCLKCCL) was added for 1.6.8-beta-b0.
155149
MATTAIRTECH_ARDUINO_SAMD_VARIANT_COMPLIANCE in variant.h is used to track versions.
156150
If using board variant files with the old format, the new core will still read the
157151
table the old way, losing any new features introduced by the new column. Additionally,
158152
new definitions have been added for L21 and C21 support.
159153

160-
## Each pin can have multiple functions.
154+
### Each pin can have multiple functions.
161155
The PinDescription table describes how each of the pins can be used by the Arduino
162156
core. Each pin can have multiple functions (ie: ADC input, digital output, PWM,
163157
communications, etc.), and the PinDescription table configures which functions can
@@ -168,7 +162,7 @@ analogReference(), attachInterrupt(), and pinMode() all call pinPeripheral() to
168162
verify that the pin can perform the function requested, and to configure the pin for
169163
that function. Most of the contents of pinMode() are now in pinPeripheral().
170164

171-
## Pin Mapping
165+
### Pin Mapping
172166
There are different ways that pins can be mapped. Typically, there is no relation
173167
between the arduino pin number used, and the actual port pin designator. Thus, the
174168
pcb must be printed with the arduino numbering, otherwise, if the port pin is printed,
@@ -184,15 +178,15 @@ designators from both PORTA and PORTB for arduino numbers 0-31 (ie: B1=1, A2=2),
184178
using arduino numbering only above 31. For 0-31 only one pin from PORTA or PORTB can be
185179
used, leaving the other pin for some number above 31.
186180

187-
## See WVariant.h in cores/arduino for the definitions used in the table.
181+
**See [WVariant.h](https://github.com/mattairtech/ArduinoCore-samd/tree/master/cores/arduino/WVariant.h) for the definitions used in the table.**
188182

189-
### Port:
183+
### Port
190184
This is the port (ie: PORTA).
191185

192-
### Pin:
186+
### Pin
193187
This is the pin (bit) within the port. Valid values are 0-31.
194188

195-
### PinType:
189+
### PinType
196190
This indicates what peripheral function the pin can be attached to. In most cases,
197191
this is PIO_MULTI, which means that the pin can be anything listed in the PinAttribute
198192
field. It can also be set to a specific peripheral. In this case, any attempt to

0 commit comments

Comments
 (0)