diff options
author | bnewbold <bnewbold@robocracy.org> | 2014-08-27 17:36:11 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2014-08-27 17:42:22 -0400 |
commit | 34b766c9d5f778762069938c71e052fa40455d1c (patch) | |
tree | 3a2b77e636b222fecff6366218cf7845029afecf /docs/source/hardware | |
parent | 746d6fecf86572c9fe95dbbffdf541a8d3875dd0 (diff) | |
parent | add7e54ccaf61859874527feda2b51ea172ce697 (diff) | |
download | librambutan-34b766c9d5f778762069938c71e052fa40455d1c.tar.gz librambutan-34b766c9d5f778762069938c71e052fa40455d1c.zip |
merge libmaple docs ("leaflabs-docs") into ./docs
In the past, libample documentation was forked out of this repository
because the documentation had increased in scope. For the librambutan,
and the rambutan project in general, we will try to keep documentation
closer to the source code, so the librambutan-specific documentation
should live here. Other sections of leaflabs-docs will be culled in a
following commit.
This merge attempts to maintain history by using a subtree strategy.
Followed directions at:
http://nuclearsquid.com/writings/subtree-merging-and-you/
Full history for files should be accessible using the "--follow" flag to
git log, eg:
git log --follow docs/source/adc.rst
It should be possible to pull patches from leaflabs-docs with:
git pull -s subtree leaflabs-docs master
... at least until the docs in this repository diverge significantly.
Diffstat (limited to 'docs/source/hardware')
-rw-r--r-- | docs/source/hardware/maple-mini.rst | 402 | ||||
-rw-r--r-- | docs/source/hardware/maple-native-beta.rst | 605 | ||||
-rw-r--r-- | docs/source/hardware/maple-native.rst | 6 | ||||
-rw-r--r-- | docs/source/hardware/maple-ret6.rst | 466 | ||||
-rw-r--r-- | docs/source/hardware/maple.rst | 618 |
5 files changed, 2097 insertions, 0 deletions
diff --git a/docs/source/hardware/maple-mini.rst b/docs/source/hardware/maple-mini.rst new file mode 100644 index 0000000..c28211d --- /dev/null +++ b/docs/source/hardware/maple-mini.rst @@ -0,0 +1,402 @@ +.. _maple-mini: + +Maple Mini +========== + +This page is a general resource for information specific to the Maple +Mini. The Maple Mini is a smaller version of the Maple that fits on a +breadboard. + +.. contents:: Contents + :local: + +.. TODO [dma.rst] Ref to dma.rst in sequel instead of libmaple-dma + +Technical Specifications +------------------------ + +* MCU: :ref:`STM32F103CBT6 <maple-mini-stdocs>`, a 32-bit ARM Cortex + M3 microprocessor +* Clock Speed: **72 MHz** +* **128 KB Flash** and **20 KB SRAM** +* 34 :ref:`digital I/ pins (GPIOs) <gpio>` +* 12 :ref:`PWM <pwm>` pins at 16 bit resolution +* 9 :ref:`analog input (ADC) <adc>` pins at 12 bit resolution +* 2 :ref:`SPI <spi>` peripherals +* 2 :ref:`I2C <i2c>` peripherals +* 7 Channels of Direct Memory Access (**DMA**) (:ref:`libmaple-dma`) +* 3 :ref:`USART (serial port) <usart>` peripherals +* 1 advanced and 3 general-purpose :ref:`timers <timers>` +* Dedicated :ref:`USB <usb>` port for programming and communications +* :ref:`jtag` +* Nested Vectored Interrupt Controller (NVIC) (including + :ref:`external interrupt <external-interrupts>` on GPIOs) +* Supplies up to 500 mA at 3.3 V, with :ref:`separate 250 mA digital + and analog regulators <maple-mini-adc-bank>` for low-noise analog + performance +* :ref:`Open source, four layer design <maple-mini-hardware>` +* Support for low power, sleep, and standby modes (<500 μA) +* Operating Voltage: 3.3 V +* Input Voltage (recommended): 3 V — 12 V +* Dimensions: 2.02″ × 0.72″ + +.. _maple-mini-powering: + +Powering the Maple Mini +----------------------- + +You can power the Maple Mini via the USB plug or by powering Vin +directly. + +.. warning:: The silkscreen on the Maple Mini suggests it will accept + an input voltage up to 16 V. We recommend applying **no greater + than 12 V**, and potentially even lower depending upon the current + draw requirements of the application. Please see :ref:`Power + Regulation on the Maple Mini <maple-mini-power-regulation>` for + more information. + +.. _maple-mini-power-regulation: + +Power Regulation on the Maple Mini +---------------------------------- + +Power regulation on the Maple is provided by two low dropout linear +voltage regulators. (The part is the MCP1703 from Microchip, in the +SOT-23A package. You can download the datasheet `here +<http://ww1.microchip.com/downloads/en/DeviceDoc/22049a.pdf>`_ ). One +of the regulators supplies power to the digital voltage plane; the +other supplies power to the analog voltage plane. + +These voltage regulators nominally take an input of up to 16V. In +addition, while the maximum continuous output current for the board is +250mA, if you are powering the board off higher voltages the amount +current it can supply goes down, due to the regulators needing to +dissipate the extra power. So if you are powering the board off 12V, +the max current is about 40mA at room temperature. In general (again, +at room temperature) the max power dissipation (PD) for the chip is +about .37W, and output current = PD/(Vin-Vout). For exact max current +calculations, please refer to the datasheet linked above. + +If you are planning to draw a lot of current from the Maple board, it +is necessary to provide input power as close to 3.3V as +possible. Powering the microcontroller circuitry and LEDs on the board +alone takes approximately 30mA, so if you are powering the board with +12V that leaves only 10mA (at best) available for powering any user +circuitry. Attempting to draw more than 10mA runs the risk of shorting +out the power regulators and bricking your board. + +.. _maple-mini-gpios: + +GPIO Information +---------------- + +The Maple Mini features 34 total input/output pins, numbered ``D0`` +through ``D33``. These numbers correspond to the numeric values next +to each header on the Maple Mini's silkscreen. However, some of them +have special uses by default [#fusedpins]_. + +.. _maple-mini-usb-pins: + +Pin ``D23`` is the :ref:`USB <usb>` D+ line, and ``D24`` is the USB D- +line. To use them as GPIOs, your program will need to :ref:`disable +SerialUSB <lang-serialusb-end>` first. Be aware, however, that +disabling SerialUSB means that the :ref:`bootloader <bootloader>` +won't work properly, and you'll need to use +:ref:`troubleshooting-perpetual-bootloader` to make your next upload. + +.. _maple-mini-but: + +Pin ``D32`` is the Mini's :ref:`button pin <lang-board-values-but>`. +It is thus mainly useful as an :ref:`input <lang-pin-levels>`. The +pin will :ref:`read <lang-digitalread>` ``HIGH`` when the :ref:`button +is pressed <lang-isbuttonpressed>`. + +.. _maple-mini-led: + +Pin ``D33`` is the Mini's :ref:`LED pin <lang-board-values-led>`. It +is thus mainly useful as an :ref:`output <lang-pin-levels>`. The LED +will glow when ``HIGH`` is :ref:`written <lang-digitalwrite>` to it. +(It also supports :ref:`pwm`, for finer-grained brightness control). + +.. TODO [0.1.0] silkscreen pictures which expand abbreviations + +.. _maple-mini-pin-map-master: + +Master Pin Map +^^^^^^^^^^^^^^ + +This table shows a summary the available functionality on every GPIO +pin, by peripheral type. The "5 V?" column documents whether or not +the pin is :ref:`5 volt tolerant <gpio-5v-tolerant>`. + +Note that this table is not exhaustive; on some pins, more peripherals +are available than are listed here. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`ADC <adc>`, :ref:`Timer <timers>`, :ref:`I2C <i2c>`, :ref:`UART <usart>`, :ref:`SPI <spi>`, 5 V? + + D0, PB11, -, -, 2_SDA, 3_RX, -, Yes + D1, PB10, -, -, 2_SCL, 3_TX, -, Yes + D2, PB2, -, -, -, -, -, Yes + D3, PB0, CH8, 3_CH3, -, -, -, - + D4, PA7, CH7, 3_CH2, -, -, 1_MOSI, - + D5, PA6, CH6, 3_CH1, -, -, 1_MISO, - + D6, PA5, CH5, -, -, -, 1_SCK, - + D7, PA4, CH4, -, -, 2_CK, 1_NSS, - + D8, PA3, CH3, 2_CH4, -, 2_RX, -, - + D9, PA2, CH2, 2_CH3, -, 2_TX, -, - + D10, PA1, CH1, 2_CH2, -, 2_RTS, -, - + D11, PA0, CH0, 2_CH1_ETR, -, 2_CTS, -, - + D12, PC15, -, -, -, -, -, - + D13, PC14, -, -, -, -, -, - + D14, PC13, -, -, -, -, -, - + D15, PB7, -, 4_CH2, 1_SDA, -, -, Yes + D16, PB6, -, 4_CH1, 2_SCL, -, -, Yes + D17, PB5, -, -, 1_SMBA, -, -, - + D18, PB4, -, -, -, -, -, Yes + D19, PB3, -, -, -, -, -, Yes + D20, PA15, -, -, -, -, -, Yes + D21, PA14, -, -, -, -, -, Yes + D22, PA13, -, -, -, -, -, Yes + D23, PA12, -, 1_ETR, -, 1_RTS, -, Yes + D24, PA11, -, 1_CH4, -, 1_CTS, -, Yes + D25, PA10, -, 1_CH3, -, 1_RX, -, Yes + D26, PA9, -, 1_CH2, -, 1_TX, -, Yes + D27, PA8, -, 1_CH1, -, 1_CK, -, Yes + D28, PB15, -, -, -, -, 2_MOSI, Yes + D29, PB14, -, -, -, 3_RTS, 2_MISO, Yes + D30, PB13, -, -, -, 3_CTS, 2_SCK, Yes + D31, PB12, -, 1_BKIN, 2_SMBA, 3_CK, 2_NSS, Yes + D32, PB8, -, 4_CH3, -, -, -, Yes + D33, PB1, CH9, 3_CH4, -, -, -, - + +.. _maple-mini-gpio-port-map: + +GPIO Port Pin Map +^^^^^^^^^^^^^^^^^ +The following table shows what pins are associated with each +:ref:`GPIO port <gpio-ports>`. + +.. csv-table:: + :header: GPIOA, GPIOB, GPIOC + + PA0: D11, PB0: D3, PC0: - + PA1: D10, PB1: D33, PC1: - + PA2: D9, PB2: D2, PC2: - + PA3: D8, PB3: D19, PC3: - + PA4: D7, PB4: D18, PC4: - + PA5: D6, PB5: D17, PC5: - + PA6: D5, PB6: D16, PC6: - + PA7: D4, PB7: D15, PC7: - + PA8: D27, PB8: D32, PC8: - + PA9: D26, PB9: -, PC9: - + PA10: D25, PB10: D1, PC10: - + PA11: D24, PB11: D0, PC11: - + PA12: D23, PB12: D31, PC12: - + PA13: D22, PB13: D30, PC13: D14 + PA14: D21, PB14: D29, PC14: D13 + PA15: D20, PB15: D28, PC15: D12 + +.. _maple-mini-timer-map: + +Timer Pin Map +^^^^^^^^^^^^^ + +The following table shows what pins are associated with a particular +timer's capture/compare channels. + +.. csv-table:: + :header: Timer, Ch. 1, Ch. 2, Ch. 3, Ch. 4 + :delim: | + + 1 | D27 | D26 | D25 | D24 + 2 | D11 | D10 | D9 | D8 + 3 | D5 | D4 | D3 | :ref:`D33 <maple-mini-led>` + 4 | D16 | D15 | :ref:`D32 <maple-mini-but>` | + +.. _maple-mini-exti-map: + +EXTI Line Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows which pins connect to which :ref:`EXTI lines +<external-interrupts-exti-line>`. + +.. list-table:: + :widths: 1 1 + :header-rows: 1 + + * - EXTI Line + - Pins + * - EXTI0 + - D3, D11 + * - EXTI1 + - D10, D33 + * - EXTI2 + - D2, D9 + * - EXTI3 + - D8, D19 + * - EXTI4 + - D7, D18 + * - EXTI5 + - D6, D17 + * - EXTI6 + - D5, D16 + * - EXTI7 + - D4, D15 + * - EXTI8 + - D27, D32 + * - EXTI9 + - D26 + * - EXTI10 + - D1, D25 + * - EXTI11 + - D0, D24 + * - EXTI12 + - D23, D31 + * - EXTI13 + - D14, D22, D30 + * - EXTI14 + - D13, D21, D29 + * - EXTI15 + - D12, D20, D28 + +.. _maple-mini-usart-map: + +USART Pin Map +^^^^^^^^^^^^^ + +The Maple Mini has three serial ports (also known as :ref:`USARTs +<usart>`). They communicate using the pins given in the following +table. + +.. csv-table:: + :header: Serial Port, TX, RX, CK, CTS, RTS + :delim: | + + ``Serial1`` | D26 | D25 | D27 | D24 | D23 + ``Serial2`` | D9 | D8 | D7 | D11 | D10 + ``Serial3`` | D1 | D0 | D31 | D30 | D29 + +.. _maple-mini-adc-bank: + +Low-Noise ADC Pins +^^^^^^^^^^^^^^^^^^ + +Maple Mini has an electrically isolated analog power plane with its +own regulator, and a geometrically isolated ground plane, connected to +the digital plane by an inductor. Its analog input pins, D3 — D11, +are laid out to correspond with these analog planes, and our +measurements indicate that they generally offer low noise ADC +performance. However, analog performance may vary depending upon the +activity of the other GPIOs. Consult the :ref:`Maple Mini hardware +design files <maple-mini-hardware>` for more details. + +.. _maple-mini-board-values: + +Board-Specific Values +--------------------- + +This section lists the Maple Mini's :ref:`board-specific values +<lang-board-values>`. + +- ``CYCLES_PER_MICROSECOND``: 72 +- ``BOARD_BUTTON_PIN``: 32 +- ``BOARD_LED_PIN``: 33 +- ``BOARD_NR_GPIO_PINS``: 34 +- ``BOARD_NR_PWM_PINS``: 12 +- ``boardPWMPins``: 3, 4, 5, 8, 9, 10, 11, 15, 16, 25, 26, 27 +- ``BOARD_NR_ADC_PINS``: 9 +- ``boardADCPins``: 3, 4, 5, 6, 7, 8, 9, 10, 11 +- ``BOARD_NR_USED_PINS``: 4 +- ``boardUsedPins``: ``BOARD_LED_PIN``, ``BOARD_BUTTON_PIN``, 23, 24 + (23 and 24 are used by :ref:`USB <maple-mini-usb-pins>`) +- ``BOARD_NR_USARTS``: 3 +- ``BOARD_USART1_TX_PIN``: 26 +- ``BOARD_USART1_RX_PIN``: 25 +- ``BOARD_USART2_TX_PIN``: 9 +- ``BOARD_USART2_RX_PIN``: 8 +- ``BOARD_USART3_TX_PIN``: 1 +- ``BOARD_USART3_RX_PIN``: 0 +- ``BOARD_NR_SPI``: 2 +- ``BOARD_SPI1_NSS_PIN``: 7 +- ``BOARD_SPI1_MOSI_PIN``: 4 +- ``BOARD_SPI1_MISO_PIN``: 5 +- ``BOARD_SPI1_SCK_PIN``: 6 +- ``BOARD_SPI2_NSS_PIN``: 31 +- ``BOARD_SPI2_MOSI_PIN``: 28 +- ``BOARD_SPI2_MISO_PIN``: 29 +- ``BOARD_SPI2_SCK_PIN``: 30 +- ``BOARD_JTMS_SWDIO_PIN``: 22 +- ``BOARD_JTCK_SWCLK_PIN``: 21 +- ``BOARD_JTDI_PIN``: 20 +- ``BOARD_JTDO_PIN``: 19 +- ``BOARD_NJTRST_PIN``: 18 + +.. _maple-mini-hardware: + +Hardware Design Files +--------------------- + +The hardware schematics and board layout files are available in the +`Maple Mini GitHub repository <https://github.com/leaflabs/maplemini>`_. + +From the GitHub repository main page, you can download the entire +repository by clicking the "Download" button. If you are familiar +with `Git <http://git-scm.com/>`_, you can also clone the repository +at the command line with :: + + $ git clone git://github.com/leaflabs/maplemini.git + +Failure Modes +------------- + +The following known failure modes apply to all Maple boards. The +failure modes aren't design errors, but are easy ways to break or +damage your board permanently. + +* **High voltage on non-tolerant pins**: not all header pins are 5 V + compatible; so e.g. connecting certain serial devices in the wrong + way could over-voltage the pins. The :ref:`pin-mapping master table + <maple-mini-pin-map-master>` details which pins are :ref:`5 + V-tolerant <gpio-5v-tolerant>`. + +Errata +------ + +This section lists known issues and warnings for the Maple Mini Rev 2 +(the first Rev sold to the public). + +.. _maple-mini-vin: + +* **Silkscreen Vin voltage mistake**: The silkscreen on the Maple Mini + falsely indicates that Vin may be supplied with up to 16V. We + recommend an input voltage **no greater than 12V**, and potentially + even lower depending upon the current draw requirements of the + application. Please see :ref:`Power Regulation on the Maple Mini + <maple-mini-power-regulation>` for more information. + + +Recommended Reading +------------------- + +.. _maple-mini-stdocs: + +STMicro documentation for STM32F103CB microcontroller: + +* `Datasheet + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00161566.pdf>`_ + (PDF); covers STM32F103x8, STM32F103xB. +* `Reference Manual RM0008 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00171190.pdf>`_ + (PDF); definitive resource for peripherals on the STM32F1 line. +* `Programming Manual PM0056 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/PROGRAMMING_MANUAL/CD00228163.pdf>`_ + (PDF); assembly language and register reference. +* `STM32F103CB <http://www.st.com/internet/mcu/product/189782.jsp>`_ + overview page with links to further references. + +.. rubric:: Footnotes + +.. [#fusedpins] See :ref:`boardUsedPins <lang-board-values-used-pins>` + for more information. diff --git a/docs/source/hardware/maple-native-beta.rst b/docs/source/hardware/maple-native-beta.rst new file mode 100644 index 0000000..bdfd216 --- /dev/null +++ b/docs/source/hardware/maple-native-beta.rst @@ -0,0 +1,605 @@ +.. highlight:: sh + +.. _maple-native-b: + +Maple Native β +============== + +This page is a general resource for information specific to the Maple +Native Beta. Since this is a beta release, the information here may +change slightly between now and the final Maple Native release. + +.. contents:: Contents + :local: + +Technical Specifications +------------------------ + +* MCU: `STM32F103ZET6 <maple-native-b-stdocs>`, a 32-bit ARM Cortex M3 + microprocessor. +* Clock Speed: **72 MHz** +* **512 KB Flash**, **64 KB SRAM** (on-chip), **1 MB SRAM** (external) +* 106 :ref:`digital I/O pins <gpio>` +* 17 :ref:`PWM <pwm>` pins at 16 bit resolution +* 21 :ref:`analog input (ADC) <adc>` pins at 12-bit resolution +* 3 :ref:`SPI <spi>` peripherals +* 2 :ref:`I2C <i2c>` peripherals +* 12 Channels of Direct Memory Access (**DMA**) (:ref:`libmaple-dma`) + with 2 DMA controllers +* 3 :ref:`USART (serial port) <usart>` peripherals, 2 **UART** peripherals +* 2 advanced, 4 general-purpose, and 2 basic :ref:`timers <timers>` +* Dedicated :ref:`USB <usb>` port for programming and communications +* :ref:`JTAG <jtag>` +* Nested Vectored Interrupt Controller (NVIC) (including + :ref:`external interrupt <lang-attachinterrupt>` on GPIOs) +* Supplies up to 500 mA at 3.3 V, with :ref:`separate 250 mA digital + and analog regulators <maple-native-b-adc-bank>` for low-noise analog + performance +* :ref:`Open-source, four layer design <maple-native-b-hardware>` +* Support for low power, sleep, and standby modes (<500 μA) +* Operating Voltage: 3.3 V +* Input Voltage (recommended): 3 V — 12 V +* Dimensions: 4″ × 2.1″ + +.. _maple-native-b-powering: + +Powering the Maple Native +------------------------- + +The power source is determined by the header labeled "PWRSEL" on the +silkscreen. The Maple Native may be powered from USB (marked "USB" on +the PWRSEL header), a LiPo battery (marked "BAT"), or one of the two +"Vin" pins (marked "EXT"). Boards are shipped with a jumper on the +USB selector. In order to power it off of an alternative source, +unplug the Maple Native, then move the jumper to the desired selector +before reconnecting power. + +The "Vin" line is available on the pin labeled "Vin" on the vertical +header to the right of the PWRSEL header, as well as on the +unpopulated two-pin connector on the upper left corner of the +board. On this latter connector, polarity was accidentally left +unmarked: the leftmost, round pin should be power, while the square +pin should be ground. + +When powering the Maple Native board from a battery or the Vin lines, +care must be taken not to over-voltage the board. In general, an upper +limit of 12V input is acceptable, but this may vary depending upon the +current draw requirements of the application. Please see :ref:`Power +Regulation on the Maple Native <maple-native-b-power-regulation>` for +more information. + +.. _maple-native-b-power-regulation: + +Power Regulation on the Maple Native +------------------------------------ + +Power regulation on the Maple Native is provided by two low dropout +linear voltage regulators. (The part is the MCP1703 from Microchip, in +the SOT-23A package. You can download the datasheet `here +<http://ww1.microchip.com/downloads/en/DeviceDoc/22049a.pdf>`_). One +of the regulators supplies power to the digital voltage plane; the +other supplies power to the analog voltage plane. + +These voltage regulators nominally take an input of up to 16V. In +addition, while the maximum continuous output current for the board is +250mA, if you are powering the board off higher voltages the current +it can supply goes down, due to the regulators needing to dissipate +the extra power. So if you are powering the board off 12V, the max +current is about 40mA at room temperature. In general (again, at room +temperature) the max power dissipation (PD) for the chip is about +.37W, and output current = PD/(Vin-Vout). For exact max current +calculations, please refer to the datasheet linked above. + +If you are planning to draw a lot of current from the Maple Native +board, it is necessary to provide input power as close to 3.3V as +possible. Powering the microcontroller circuitry and LEDs on the board +alone takes approximately 30mA, so if you are powering the board with +12V that leaves only 10mA (at best) available for powering any user +circuitry. Attempting to draw more than 10mA runs the risk of shorting +out the power regulators and bricking your board. + +Using the Built-in Battery Charger +---------------------------------- + +Maple Native includes a built-in LiPo battery charger. In order to +use it, put a jumper across the CHRG selector on the PWRSEL header and +across the USB, or EXT selectors, depending on whether you're charging +the battery via USB cable or Vin, respectively. The LED labeled CHRG +will light up while the battery is being charged. When the battery is +finished charging, the LED labeled DONE will light up. + +.. _maple-native-b-gpios: + +GPIO Information +---------------- + +The Maple Native features 106 total input/output pins, numbered ``D0`` +through ``D105``. In most cases, these numbers correspond to the +numeric values next to each header on the Maple Native's silkscreen. +However, pins ``D101`` through ``D105`` are broken out to the +:ref:`JTAG <jtag>` header, and are not numbered on the silkscreen. In +addition, some other pins have other uses by default [#fusedpins]_. + +.. _maple-native-b-but: + +Pin ``D6`` is the Native's :ref:`button pin <lang-board-values-but>`. +It is thus mainly useful as an :ref:`input <lang-pin-levels>`. The +pin will :ref:`read <lang-digitalread>` ``HIGH`` when the :ref:`button +is pressed <lang-isbuttonpressed>`. + +.. _maple-native-b-led: + +Pin ``D22`` is the Native's :ref:`LED pin <lang-board-values-led>`. +It is thus mainly useful as an :ref:`output <lang-pin-levels>`. The +LED will glow when ``HIGH`` is :ref:`written <lang-digitalwrite>` to +it. + +.. _maple-native-b-fsmc: + +Many of the pins on the right header (pins ``D56`` through ``D100``, +the header is labeled :ref:`"FSMC" <fsmc>` on the silkscreen) are +connected to the SRAM chip. Using these pins as GPIOs may render the +memory chip useless, which can cause your program to crash. For this +reason, we don't recommend that you use these pins unless you know +what you are doing. The following pins on the right header are not +connected to the SRAM and may be used with impunity: ``D57``, ``D60``, +``D63``, ``D66``, ``D69``, ``D72``, ``D75``, ``D80``, ``D83``. + +.. _maple-native-b-jtag: + +Pins ``D101`` through ``D105`` are connected to the pads on the +:ref:`JTAG <jtag>` header. In order to use them as GPIOs, you must +first disable the Maple Native's debug ports. You can do this by +calling :ref:`lang-disabledebugports`. (Note that this means you +won't be able to use JTAG or SW-Debug to debug your program). + +.. TODO [0.1.0] silkscreen pictures + +.. _maple-native-b-pin-map-master: + +Master Pin Map +^^^^^^^^^^^^^^ + +This table shows a summary the available functionality on every GPIO +pin, by peripheral type. The "5 V?" column documents whether or not +the pin is :ref:`5 volt tolerant <gpio-5v-tolerant>`. + +Note that this table is not exhaustive; on some pins, more peripherals +are available than are listed here. + +**Top header:** + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`ADC <adc>`, :ref:`Timer <timers>`, :ref:`I2C <i2c>`, :ref:`UART <usart>`, :ref:`SPI <spi>`, 5 V? + + D0, PB10, -, -, 2_SCL, 3_TX, -, Yes + D1, PB11, -, -, 2_SDA, 3_RX, -, Yes + D2, PB12, -, 1_BKIN, 2_SMBA, 3_CK, 2_NSS, Yes + D3, PB13, -, -, -, 3_CTS, 2_SCK, Yes + D4, PB14, -, -, -, 3_RTS, 2_MISO, Yes + D5, PB15, -, -, -, -, 2_MOSI, Yes + D6, PG15, -, -, -, -, -, Yes + D7, PC0, 1_CH10, -, -, -, -, - + D8, PC1, 1_CH11, -, -, -, -, - + D9, PC2, 1_CH12, -, -, -, -, - + D10, PC3, 1_CH13, -, -, -, -, - + D11, PC4, 1_CH14, -, -, -, -, - + D12, PC5, 1_CH15, -, -, -, -, - + D13, PC6, -, 8_CH1, -, -, -, Yes + D14, PC7, -, 8_CH2, -, -, -, Yes + D15, PC8, -, 8_CH3, -, -, -, Yes + D16, PC9, -, 8_CH4, -, -, -, Yes + D17, PC10, -, -, -, 4_TX, -, Yes + D18, PC11, -, -, -, 4_RX, -, Yes + D19, PC12, -, -, -, 5_TX, -, Yes + D20, PC13, -, -, -, -, -, - + D21, PC14, -, -, -, -, -, - + D22, PC15, -, -, -, -, -, - + D23, PA8, -, 1_CH1, -, 1_CK, -, Yes + D24, PA9, -, 1_CH2, -, 1_TX, -, Yes + D25, PA10, -, 1_CH3, -, 1_RX, -, Yes + D26, PB9, -, 4_CH4, -, -, -, Yes + +**Bottom header:** + +.. note:: ``D48``, ``D49``, ``D50``, ``D51`` are also connected to + Timer 2 channels 1, 2, 3, and 4, respectively. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`ADC <adc>`, :ref:`Timer <timers>`, :ref:`I2C <i2c>`, :ref:`UART <usart>`, :ref:`SPI <spi>`, 5 V? + + D27, PD2, -, 3_ETR, -, 5_RX, -, Yes + D28, PD3, -, -, -, -, -, Yes + D29, PD6, -, -, -, -, -, Yes + D30, PG11, -, -, -, -, -, Yes + D31, PG12, -, -, -, -, -, Yes + D32, PG13, -, -, -, -, -, Yes + D33, PG14, -, -, -, -, -, Yes + D34, PG8, -, -, -, -, -, Yes + D35, PG7, -, -, -, -, -, Yes + D36, PG6, -, -, -, -, -, Yes + D37, PB5, -, -, 1_SMBA, -, 3_MOSI, - + D38, PB6, -, 4_CH1, 1_SCL, -, -, Yes + D39, PB7, -, 4_CH2, 1_SDA, -, -, Yes + D40, PF11, -, -, -, -, -, Yes + D41, PF6, 3_CH4, -, -, -, -, - + D42, PF7, 3_CH5, -, -, -, -, - + D43, PF8, 3_CH6, -, -, -, -, - + D44, PF9, 3_CH7, -, -, -, -, - + D45, PF10, 3_CH8, -, -, -, -, - + D46, PB1, 1_CH9, 3_CH4, -, -, -, - + D47, PB0, 1_CH8, 3_CH3, -, -, -, - + D48, PA0, 1_CH0, 5_CH1, -, 2_CTS, -, - + D49, PA1, 1_CH1, 5_CH2, -, 2_RTS, -, - + D50, PA2, 1_CH2, 5_CH3, -, 2_TX, -, - + D51, PA3, 1_CH3, 5_CH4, -, 2_RX, -, - + D52, PA4, 1_CH4, -, -, 2_CK, 1_NSS, - + D53, PA5, 1_CH5, -, -, -, 1_SCK, - + D54, PA6, 1_CH6, 3_CH1, -, -, 1_MISO, - + D55, PA7, 1_CH7, 3_CH2, -, -, 1_MOSI, - + +.. _maple-native-b-fsmc-map: + +**Right (FSMC) header** + +All of the following pins are 5V-tolerant. Note that in the "FSMC" +column below, entries with a "Dn" value (D0, D1, etc.) don't refer to +pins; they refer to FSMC data lines. See :ref:`RM0008 +<maple-native-b-stdocs>` for more information. + +.. warning:: Many of the pins on this header are used by the Maple + Native's SRAM chip. Don't use them as GPIOs unless you know what + you're doing, or your program may crash. :ref:`See above + <maple-native-b-fsmc>` for more information. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`FSMC <fsmc>` + + D56, PF0, A0 + D57, PD11, A16 + D58, P14, D0 + D59, PF1, A1 + D60, PD12, A17 + D61, PD15, D1 + D62, PF2, A2 + D63, PD13, A18 + D64, PD0, D2 + D65, PF3, A3 + D66, PE3, A19 + D67, PD1, D3 + D68, PF4, A4 + D69, PE4, A20 + D70, PE7, D4 + D71, PF5, A5 + D72, PE5, A21 + D73, PE8, D8 + D74, PF12, A6 + D75, PE6, A22 + D76, PE9, D6 + D77, PF13, A7 + D78, PE10, D7 + D79, PF14, A8 + D80, PG9, NE2/NCE3 + D81, PE11, D8 + D82, PF15, A9 + D83, PG10, NCE4_1/NE3/NCE4_2 + D84, PE12, D9 + D85, PG0, A10 + D86, PD5, NWE + D87, PE13, D10 + D88, PG1, A11 + D89, PD4, NOE + D90, PE14, D11 + D91, PG2, A12 + D92, PE1, NBL1 + D93, PE15, D12 + D94, PG3, A13 + D95, PE0, NBL0 + D96, PD8, D13 + D97, PG4, A14 + D98, PD9, D14 + D99, PG5, A15 + D100, PD10, D15 + +**JTAG header pins** + +.. note:: See :ref:`above <maple-native-b-jtag>` for more information on + these pins. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`SPI <spi>`, 5 V? + + D101, PA13, -, Yes + D102, PA14, -, Yes + D103, PA15, 3_NSS, Yes + D104, PB3, 3_SCK, Yes + D105, PB4, 3_MISO, Yes + +.. _maple-native-b-gpio-port-map: + +GPIO Port Pin Map +^^^^^^^^^^^^^^^^^ + +The following tables show what pins are associated with each +:ref:`GPIO port <gpio-ports>`. + +.. csv-table:: + :header: GPIOA, GPIOB, GPIOC, GPIOD + + PA0: D48, PB0: D47, PC0: D7, PD0: D64 + PA1: D49, PB1: D46, PC1: D8, PD1: D67 + PA2: D50, PB2: -, PC2: D9, PD2: D27 + PA3: D51, PB3: D104, PC3: D10, PD3: D28 + PA4: D52, PB4: D105, PC4: D11, PD4: D89 + PA5: D53, PB5: D37, PC5: D12, PD5: D86 + PA6: D54, PB6: D38, PC6: D13, PD6: D29 + PA7: D55, PB7: D39, PC7: D14, PD7: - + PA8: D23, PB8: -, PC8: D15, PD8: D96 + PA9: D24, PB9: D26, PC9: D16, PD9: D98 + PA10: D25, PB10: D0, PC10: D17, PD10: D100 + PA11: -, PB11: D1, PC11: D18, PD11: D57 + PA12: -, PB12: D2, PC12: D19, PD12: D60 + PA13: D101, PB13: D3, PC13: D20, PD13: D63 + PA14: D102, PB14: D4, PC14: D21, PD14: D58 + +.. csv-table:: + :header: GPIOE, GPIOF, GPIOG + + PE0: D95, PF0: D56, PG0: D85 + PE1: D92, PF1: D59, PG1: D88 + PE2: - PF2: D62, PG2: D91, + PE3: D66, PF3: D65, PG3: D94 + PE4: D69, PF4: D68, PG4: D97 + PE5: D72, PF5: D71, PG5: D99 + PE6: D75, PF6: D41, PG6: D36 + PE7: D70, PF7: D42, PG7: D35 + PE8: D73, PF8: D43, PG8: D34 + PE9: D76, PF9: D44, PG9: D80 + PE10: D78, PF10: D45, PG10: D83 + PE11: D81, PF11: D40, PG11: D30 + PE12: D84, PF12: D74, PG12: D31 + PE13: D87, PF13: D77, PG13: D32 + PE14: D90, PF14: D79, PG14: D33 + +.. _maple-native-b-timer-map: + +Timer Pin Map +^^^^^^^^^^^^^ + +The following table shows what pins are associated with a particular +timer's capture/compare channels. + +There is no mistake between timers 2 and 5. They really do share +those pins. If you like, you can remap some of the timer 2 channels +to get extra PWM pins; see :ref:`afio_remap() (in gpio.h) +<gpio-h-afio-remap>`. + +.. csv-table:: + :header: Timer, Ch. 1, Ch. 2, Ch. 3, Ch. 4 + :delim: | + + 1 | D23 | D24 | D25 | + 2 | D48 | D49 | D50 | D51 + 3 | D54 | D55 | D47 | D46 + 4 | D38 | D39 | | D26 + 5 | D48 | D49 | D50 | D51 + 8 | D13 | D14 | D15 | D16 + +.. _maple-native-b-exti-map: + +EXTI Line Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows which pins connect to which :ref:`EXTI lines +<external-interrupts-exti-line>`. + +.. list-table:: + :widths: 1 3 + :header-rows: 1 + + * - EXTI Line + - Pins + * - EXTI0 + - D7, D47, D48, D56, D64, D85, D95 + * - EXTI1 + - D8, D46, D49, D59, D67, D88, D92 + * - EXTI2 + - D9, D27, D50, D62, D91 + * - EXTI3 + - D10, D28, D51, D65, D66, D94, D104 + * - EXTI4 + - D11, D52, D68, D69, D89, D97, D105 + * - EXTI5 + - D12, D37, D53, D71, D72, D86, D99 + * - EXTI6 + - D13, D29, D36, D38, D41, D54, D75 + * - EXTI7 + - D14, D35, D39, D42, D55, D70 + * - EXTI8 + - D15, D23, D34, D43, D73, D96 + * - EXTI9 + - D16, D24, D26, D44, D76, D80, D98 + * - EXTI10 + - D0, D17, D25, D45, D78, D83, D100 + * - EXTI11 + - D1, D18, D30, D40, D57, D81 + * - EXTI12 + - D2, D19, D31, D60, D74, D84 + * - EXTI13 + - D3, D20, D32, D63, D77, D87, D101 + * - EXTI14 + - D4, D21, D33, D58, D79, D90, D102 + * - EXTI15 + - D5, D6, D22, D61, D82, D93, D103 + +.. _maple-native-b-usart-map: + +USART Pin Map +^^^^^^^^^^^^^ + +The Maple Native has 3 :ref:`USART <usart>` serial ports. They +communicate using the pins given in the following table. + +.. csv-table:: + :header: Serial port, TX, RX, CK, CTS, RTS + :delim: | + + ``Serial1`` | D24 | D25 | D23 | | + ``Serial2`` | D50 | D51 | D52 | D48 | D49 + ``Serial3`` | D0 | D1 | D2 | D3 | D4 + +The Maple Native also has 2 UART serial ports. Unlike USARTS, these +only communicate asynchronously, and thus only have TX and RX pins. +These are given in the following table. + +.. csv-table:: + :header: Serial port, TX, RX + :delim: | + + ``Serial4`` | D17 | D18 + ``Serial5`` | D19 | D27 + +.. _maple-native-b-adc-bank: + +Low-Noise ADC Pins +^^^^^^^^^^^^^^^^^^ + +There are fifteen pins at the bottom right of the board (``D41`` — +``D55``) that generally offer lower-noise ADC performance than other +pins on the board. If you're concerned about getting good ADC +readings, we recommend using one of these pins to take your +measurements. + +Maple Native has an electrically isolated analog power plane with its +own regulator, and a geometrically isolated ground plane. Analog input +pins D41 — D55 are laid out to correspond with these analog planes, +and our measurements indicate that they generally ofer low noise ADC +performance. However, analog performance may vary depending upon the +activity of other GPIOs. In particular, using PWM on any of pins +``D46`` — ``D51``, ``D54``, and ``D55`` may cause digital noise. +Consult the :ref:`Maple Native beta hardware design files +<maple-native-b-hardware>` for more details. + +.. _maple-native-b-board-values: + +Board-Specific Values +--------------------- + +This section lists the Maple Native's :ref:`board-specific values +<lang-board-values>`. + +- ``CYCLES_PER_MICROSECOND``: 72 +- ``BOARD_BUTTON_PIN``: 6 +- ``BOARD_LED_PIN``: 22 +- ``BOARD_NR_GPIO_PINS``: 106 +- ``BOARD_NR_PWM_PINS``: 18 +- ``boardPWMPins``: 13, 14, 15, 16, 23, 24, 25, 26, 38, 39, 46, 47, + 48, 49, 50, 51, 54, 55 +- ``BOARD_NR_ADC_PINS``: 21 +- ``boardADCPins``: 7, 8, 9, 10, 11, 12, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55 +- ``BOARD_NR_USED_PINS``: 43 +- ``boardUsedPins``: ``BOARD_LED_PIN``, ``BOARD_BUTTON_PIN``, + ``BOARD_JTMS_SWDIO_PIN``, ``BOARD_JTCK_SWCLK_PIN``, + ``BOARD_JTDI_PIN``, ``BOARD_JTDO_PIN``, ``BOARD_NJTRST_PIN``, and + all pins on FSMC header except those mentioned :ref:`above + <maple-native-b-fsmc>`. +- ``BOARD_NR_USARTS``: 5 +- ``BOARD_USART1_TX_PIN``: 24 +- ``BOARD_USART1_RX_PIN``: 25 +- ``BOARD_USART2_TX_PIN``: 50 +- ``BOARD_USART2_RX_PIN``: 51 +- ``BOARD_USART3_TX_PIN``: 0 +- ``BOARD_USART3_RX_PIN``: 1 +- ``BOARD_UART4_TX_PIN``: 17 +- ``BOARD_UART4_RX_PIN``: 18 +- ``BOARD_UART5_TX_PIN``: 19 +- ``BOARD_UART5_RX_PIN``: 27 +- ``BOARD_NR_SPI``: 3 +- ``BOARD_SPI1_NSS_PIN``: 52 +- ``BOARD_SPI1_MOSI_PIN``: 55 +- ``BOARD_SPI1_MISO_PIN``: 54 +- ``BOARD_SPI1_SCK_PIN``: 53 +- ``BOARD_SPI2_NSS_PIN``: 2 +- ``BOARD_SPI2_MOSI_PIN``: 5 +- ``BOARD_SPI2_MISO_PIN``: 4 +- ``BOARD_SPI2_SCK_PIN``: 3 +- ``BOARD_SPI3_NSS_PIN``: 103 (on :ref:`JTAG header <maple-native-b-jtag>`) +- ``BOARD_SPI3_MOSI_PIN``: 37 +- ``BOARD_SPI3_MISO_PIN``: 105 (JTAG header) +- ``BOARD_SPI3_SCK_PIN``: 104 (JTAG header) +- ``BOARD_JTMS_SWDIO_PIN``: :ref:`103 <maple-native-b-jtag>` +- ``BOARD_JTCK_SWCLK_PIN``: 102 +- ``BOARD_JTDI_PIN``: 103 +- ``BOARD_JTDO_PIN``: 104 +- ``BOARD_NJTRST_PIN``: 105 + +.. _maple-native-b-hardware: + +Hardware Design Files +^^^^^^^^^^^^^^^^^^^^^ + +The hardware schematics and board layout files are available in the +`Maple Native GitHub repository +<https://github.com/leaflabs/maplenative/>`_. Download the `beta +version's hardware design files +<https://github.com/leaflabs/maplenative/tree/beta>`_ (ZIP format). + +If you're familiar with Git, you can clone the entire repository and +checkout the commit tagged "beta" using the following:: + + $ git clone git://github.com/leaflabs/maplenative.git + $ git checkout beta + +Failure Modes +------------- + +The following known failure modes apply to the Maple Native Beta. The +failure modes aren't design errors, but are easy ways to break or +damage your board permanently. + +* **Reversing Vin and GND**: when powering the Maple Native Beta via + the Vin and ground (GND) pins at the top left of the board, it is + possible to carelessly cause a short or switch the connections, + applying the high voltage to GND and ground to Vin. + + If this happens, you will reverse bias the diode beneath these pins, + most likely damaging it. This may cause excess voltage to + subsequently be delivered to the board once the reversed pins are + connected properly. + +Errata +------ + +This section lists known issues and warnings for the Maple Native +Beta. + +* **PWM on pin 39**: PWM on pin 39 appears to be nonfunctional. We + are looking into this issue. + +* **VREF is nonfunctional**: Due to a routing error, VREF is + permanently tied to 3.3V at VAA. + +Recommended Reading +------------------- + +.. _maple-native-b-stdocs: + +STMicro documentation for STM32F103ZE microcontroller: + +* `Datasheet + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00191185.pdf>`_ + (PDF); covers STM32F103xC, STM3F103xD, STM32F103xE. +* `Reference Manual RM0008 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00171190.pdf>`_ + (PDF); definitive resource for peripherals on the STM32F1 line. +* `Programming Manual PM0056 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/PROGRAMMING_MANUAL/CD00228163.pdf>`_ + (PDF); assembly language and register reference. +* `STM32F103RE <http://www.st.com/internet/mcu/product/164485.jsp>`_ + overview page with links to further references. + +.. rubric:: Footnotes + +.. [#fusedpins] See :ref:`boardUsedPins <lang-board-values-used-pins>` + for more information. diff --git a/docs/source/hardware/maple-native.rst b/docs/source/hardware/maple-native.rst new file mode 100644 index 0000000..79115fc --- /dev/null +++ b/docs/source/hardware/maple-native.rst @@ -0,0 +1,6 @@ +.. _hardware-maple-native: + +Maple Native +============ + +Stub. diff --git a/docs/source/hardware/maple-ret6.rst b/docs/source/hardware/maple-ret6.rst new file mode 100644 index 0000000..3d2d037 --- /dev/null +++ b/docs/source/hardware/maple-ret6.rst @@ -0,0 +1,466 @@ +.. highlight:: sh + +.. _maple-ret6: + +Maple RET6 Edition +================== + +This page is a general resource for information specific to the Maple +RET6 Edition. The Maple RET6 Edition is a "beta" board released as a +simple way to get a more powerful chip (the STM32F103\ **RET6**, hence +the name) than the one on the base Maple (the STM32F103\ **RBT6**) in +the hands of Maple developers. + +.. contents:: Contents + :local: + +.. TODO [dma.rst] Ref to source/dma.rst in sequel instead of libmaple-dma +.. TODO [dac.rst] Ref to source/dac.rst in sequel instead of libmaple-dac +.. TODO [nvic.rst] Ref to source/nvic.rst in sequel + +Technical Specifications +------------------------ + +* MCU: :ref:`STM32F103RET6 <maple-ret6-stdocs>`, a 32-bit ARM Cortex + M3 microprocessor +* Clock Speed: **72 MHz** +* **512 KB Flash** and **64 KB SRAM** +* 43 :ref:`digital I/O pins (GPIOs) <gpio>` +* 18 :ref:`PWM <pwm>` pins at 16 bit resolution +* 15 :ref:`analog input (ADC) <adc>` pins at 12 bit resolution +* Built-in, 2 channel **DAC** at 12 bit resolution (:ref:`libmaple-dac`). +* 2 :ref:`SPI <spi>` peripherals with **I2S** support +* 2 :ref:`I2C <i2c>` peripherals +* 12 Channels of Direct Memory Access (**DMA**) (:ref:`libmaple-dma`) + with 2 DMA controllers +* 3 :ref:`USART (serial port) <usart>` peripherals +* 2 advanced, 4 general-purpose, and 2 basic :ref:`timers <timers>` +* Dedicated :ref:`USB <usb>` port for programming and communications +* :ref:`JTAG <jtag>` +* Nested Vectored Interrupt Controller (NVIC) (including + :ref:`external interrupt <lang-attachinterrupt>` on GPIOs) +* Supplies up to 500 mA at 3.3 V, with :ref:`separate 250 mA digital + and analog regulators <maple-ret6-adc-bank>` for low-noise analog + performance +* :ref:`Open-source, four layer design <maple-ret6-hardware>` +* Support for low power, sleep, and standby modes (<500 μA) +* Operating Voltage: 3.3 V +* Input Voltage (recommended): 4 V — 12 V +* Dimensions are 2.05″ × 2.1″ + +.. _maple-ret6-powering: + +Powering the Maple RET6 Edition +------------------------------- + +The Maple RET6 Edition is powered in the :ref:`same way as the +standard Maple <maple-powering>`. + +.. warning:: The RET6 Edition silkscreen falsely indicates that the + barrel jack accepts up to 18 V. We recommend a barrel jack input + voltage **no greater than 12V**, and potentially even lower + depending upon the current draw requirements of the + application. The same goes for powering off LiPo batteries. + + Please see :ref:`Power Regulation on the Maple + <maple-power-regulation>` for more information. + +.. _maple-ret6power-regulation: + +Power Regulation on the Maple RET6 +---------------------------------- + +Power regulation on the Maple RET6 works in the :ref:`same way as the +standard Maple <maple-power-regulation>`. + +Using the Built-in Battery Charger +---------------------------------- + +The RET6 Edition has a built-in LiPo battery charger. In order to use +it, put a jumper across the CHRG header on the power selection header +and across the USB, or EXT selectors, depending on whether you're +charging the battery via USB cable or barrel jack connector. The LED +labeled CHRG will light up while the battery is being charged. When +the battery is finished charging, the LED labeled DONE will light up. + +.. _maple-ret6-gpios: + +GPIO Information +---------------- + +The RET6 Edition features 38 ready-to-use general purpose input/output +(see :ref:`gpio`) pins for digital input/output, numbered ``D0`` +through ``D37``. These numbers correspond to the numeric values next +to each header on the Maple silkscreen. + +.. _maple-ret6-but: + +Pin ``D38`` is the board's :ref:`button pin <lang-board-values-but>`. +It is thus mainly useful as an :ref:`input <lang-pin-levels>`. The +pin will :ref:`read <lang-digitalread>` ``HIGH`` when the :ref:`button +is pressed <lang-isbuttonpressed>`. + +More GPIOs (numbered ``D39``\ --``D42`` on the back of the RET6 +Edition's silkscreen) are available if you use the +:ref:`lang-disabledebugports` function; see the :ref:`board-specific +debug pin constants <lang-board-values-debug>` for more information. +(See :ref:`this erratum <maple-ret6-nrst-pb4>` for information about +the pin numbered ``43`` on the silkscreen). + +.. TODO [0.1.0] silkscreen pictures which expand abbreviations + +.. _maple-ret6-pin-map-master: + +Master Pin Map +^^^^^^^^^^^^^^ + +This table shows a summary of the available functionality on every +GPIO pin, by peripheral type. The "5 V?" column documents whether or +not the pin is :ref:`5 volt tolerant <gpio-5v-tolerant>`. + +Note that this table is not exhaustive; on some pins, more peripherals +are available than are listed here. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`ADC <adc>`, :ref:`Timer <timers>`, :ref:`I2C <i2c>`, :ref:`UART/USART <usart>`, :ref:`SPI <spi>`, 5 V? + + D0, PA3, CH3, 2_CH4, -, 2_RX, -, - + D1, PA2, CH2, 2_CH3, -, 2_TX, -, - + D2, PA0, CH0, 2_CH1_ETR, -, 2_CTS, -, - + D3, PA1, CH1, 2_CH2, -, 2_RTS, -, - + D4, PB5, -, -, 1_SMBA, -, 3_MOSI, - + D5, PB6, -, 4_CH1, 1_SCL, -, -, Yes + D6, PA8, -, 1_CH1, -, 1_CK, -, Yes + D7, PA9, -, 1_CH2, -, 1_TX, -, Yes + D8, PA10, -, 1_CH3, -, 1_RX, -, Yes + D9, PB7, -, 4_CH2, 1_SDA, -, -, Yes + D10, PA4, CH4, -, -, 2_CK, 1_NSS, - + D11, PA7, CH7, 3_CH2, -, -, 1_MOSI, - + D12, PA6, CH6, 3_CH1, -, -, 1_MISO, - + D13, PA5, CH5, -, -, -, 1_SCK, - + D14, PB8, -, 4_CH3, -, -, -, Yes + D15, PC0, CH10, -, -, -, -, - + D16, PC1, CH11, -, -, -, -, - + D17, PC2, CH12, -, -, -, -, - + D18, PC3, CH13, -, -, -, -, - + D19, PC4, CH14, -, -, -, -, - + D20, PC5, CH15, -, -, -, -, - + D21, PC13, -, -, -, -, -, - + D22, PC14, -, -, -, -, -, - + D23, PC15, -, -, -, -, -, - + D24, PB9, -, 4_CH4, -, -, -, Yes + D25, PD2, -, 3_ETR, -, -, 5_RX, Yes + D26, PC10, -, -, -, -, 4_TX, Yes + D27, PB0, CH8, 3_CH3, -, -, -, - + D28, PB1, CH9, 3_CH4, -, -, -, - + D29, PB10, -, -, 2_SCL, 3_TX, -, Yes + D30, PB11, -, -, 2_SDA, 3_RX, -, Yes + D31, PB12, -, 1_BKIN, 2_SMBA, 3_CK, 2_NSS, Yes + D32, PB13, -, 1_CH1N, -, 3_CTS, 2_SCK, Yes + D33, PB14, -, 1_CH2N, -, 3_RTS, 2_MISO, Yes + D34, PB15, -, 1_CH3N, -, -, 2_MOSI, Yes + D35, PC6, -, 8_CH1, -, -, -, Yes + D36, PC7, -, 8_CH2, -, -, -, Yes + D37, PC8, -, 8_CH3, -, -, -, Yes + D38, PC9, -, 8_CH4, -, -, -, Yes + D39, PA13, -, -, -, -, -, Yes + D40, PA14, -, -, -, -, -, Yes + D41, PA15, -, -, -, -, 3_NSS, Yes + D42, PB3, -, -, -, -, 3_SCK, Yes + +.. _maple-ret6-gpio-port-map: + +GPIO Port Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows what pins are associated with each +:ref:`GPIO port <gpio-ports>`. + +.. csv-table:: + :header: GPIOA, GPIOB, GPIOC + + PA0: D2, PB0: D27, PC0: D15 + PA1: D3, PB1: D28, PC1: D16 + PA2: D1, PB2: -, PC2: D17 + PA3: D0, PB3: D42, PC3: D18 + PA4: D10, PB4: D43, PC4: D19 + PA5: D13, PB5: D4, PC5: D20 + PA6: D12, PB6: D5, PC6: D35 + PA7: D11, PB7: D9, PC7: D36 + PA8: D6, PB8: D14, PC8: D37 + PA9: D7, PB9: D24, PC9: D38 + PA10: D8, PB10: D29, PC10: D26 + PA11: -, PB11: D30, PC11: - + PA12: -, PB12: D31, PC12: - + PA13: D39, PB13: D32, PC13: D21 + PA14: D40, PB14: D33, PC14: D22 + PA15: D41, PB15: D34, PC15: D23 + +.. _maple-ret6-timer-map: + +Timer Pin Map +^^^^^^^^^^^^^ + +The following table shows what pins are associated with a particular +timer's capture/compare channels. Note that timer 5's channels share +pins with timer 2 (e.g., timer 5 channel 1 is also available on D2, +channel 2 on D3, etc.). + +.. csv-table:: + :header: Timer, Ch. 1, Ch. 2, Ch. 3, Ch. 4 + :delim: | + + 1 | D6 | D7 | D8 | - + 2 | D2 | D3 | D1 | D0 + 3 | D12 | D11 | D27 | D28 + 4 | D5 | D9 | D14 | D24 + 8 | D35 | D36 | D37 | :ref:`D38 <maple-ret6-but>` + +.. _maple-ret6-exti-map: + +EXTI Line Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows which pins connect to which :ref:`EXTI lines +<external-interrupts-exti-line>` on the Maple RET6 Edition. + +.. list-table:: + :widths: 1 1 + :header-rows: 1 + + * - EXTI Line + - Pins + * - EXTI0 + - D2, D15, D27 + * - EXTI1 + - D3, D16, D28 + * - EXTI2 + - D1, D17, D25 + * - EXTI3 + - D0, D18, D42 + * - EXTI4 + - D10, D19 + * - EXTI5 + - D4, D13, D20 + * - EXTI6 + - D5, D12, D35 + * - EXTI7 + - D9, D11, D36 + * - EXTI8 + - D6, D14, D37 + * - EXTI9 + - D7, D24, D38 + * - EXTI10 + - D8, D26, D29 + * - EXTI11 + - D30 + * - EXTI12 + - D31 + * - EXTI13 + - D21, D32, D39 + * - EXTI14 + - D22, D33, D40 + * - EXTI15 + - D23, D34, D41 + +.. _maple-ret6-usart-map: + +USART Pin Map +^^^^^^^^^^^^^ + +The Maple RET6 Edition has three serial ports whose pins are broken +out to headers (also known as :ref:`USARTs <usart>`). They communicate +using the pins given in the following table. + +.. csv-table:: + :header: Serial Port, TX, RX, CK, CTS, RTS + :delim: | + + ``Serial1`` | D7 | D8 | D6 | | + ``Serial2`` | D1 | D0 | D10 | D2 | D3 + ``Serial3`` | D29 | D30 | D31 | D32 | D33 + +Unfortunately, :ref:`UART4 and UART5 aren't completely available +<maple-ret6-uarts>`. + +.. _maple-ret6-adc-bank: + +Low-Noise ADC Pins +^^^^^^^^^^^^^^^^^^ + +The six pins at the bottom right of the board (D15—D20) generally +offer lower-noise ADC performance than other pins on the board. If +you’re concerned about getting good ADC readings, we recommend using +one of these pins to take your measurements. More details in the +:ref:`Maple hardware documentation <maple-adc-bank>`. + +Board-Specific Values +--------------------- + +This section lists the Maple RET6 Edition's :ref:`board-specific +values <lang-board-values>`. + +- ``CYCLES_PER_MICROSECOND``: 72 +- ``BOARD_BUTTON_PIN``: 38 +- ``BOARD_LED_PIN``: 13 +- ``BOARD_NR_GPIO_PINS``: 44 (however, :ref:`pin D43 is not usable + <maple-nrst-pb4>`) +- ``BOARD_NR_PWM_PINS``: 18 +- ``boardPWMPins``: 0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 14, 24, 27, 28, + 35, 36, 37 +- ``BOARD_NR_ADC_PINS``: 15 +- ``boardADCPins``: 0, 1, 2, 3, 10, 11, 12, 15, 16, 17, 18, 19, 20, 27, 28 +- ``BOARD_NR_USED_PINS``: 7 +- ``boardUsedPins``: ``BOARD_LED_PIN``, ``BOARD_BUTTON_PIN``, + ``BOARD_JTMS_SWDIO_PIN``, ``BOARD_JTCK_SWCLK_PIN``, + ``BOARD_JTDI_PIN``, ``BOARD_JTDO_PIN``, ``BOARD_NJTRST_PIN`` +- ``BOARD_NR_USARTS``: 3 (unfortunately, :ref:`due to the Maple Rev 5 + design <maple-ret6-uarts>`, UARTs 4 and 5 have pins which are not + broken out). +- ``BOARD_USART1_TX_PIN``: 7 +- ``BOARD_USART1_RX_PIN``: 8 +- ``BOARD_USART2_TX_PIN``: 1 +- ``BOARD_USART2_RX_PIN``: 0 +- ``BOARD_USART3_TX_PIN``: 29 +- ``BOARD_USART3_RX_PIN``: 30 +- ``BOARD_NR_SPI``: 2 (unfortunately, :ref:`due to the Maple Rev 5 + design <maple-ret6-nrst-pb4>`, SPI3 is unavailable). +- ``BOARD_SPI1_NSS_PIN``: 10 +- ``BOARD_SPI1_MOSI_PIN``: 11 +- ``BOARD_SPI1_MISO_PIN``: 12 +- ``BOARD_SPI1_SCK_PIN``: 13 +- ``BOARD_SPI2_NSS_PIN``: 31 +- ``BOARD_SPI2_MOSI_PIN``: 34 +- ``BOARD_SPI2_MISO_PIN``: 33 +- ``BOARD_SPI2_SCK_PIN``: 32 +- ``BOARD_JTMS_SWDIO_PIN``: 39 +- ``BOARD_JTCK_SWCLK_PIN``: 40 +- ``BOARD_JTDI_PIN``: 41 +- ``BOARD_JTDO_PIN``: 42 +- ``BOARD_NJTRST_PIN``: :ref:`43 <maple-ret6-nrst-pb4>` + +.. _maple-ret6-hardware: + +Hardware Design Files +--------------------- + +The hardware schematics and board layout files are available in the +`Maple GitHub repository <https://github.com/leaflabs/maple>`_. Other +than the processor used, the design files for the Maple RET6 edition +are identical to the Maple Rev 5, which are in the ``maple-r5`` +subdirectory of the Maple repository. A schematic for a JTAG adapter +suitable for use with Maple is available in the ``jtagadapter`` +directory. + +From the GitHub repository main page, you can download the entire +repository by clicking the "Download" button. If you are familiar +with `Git <http://git-scm.com/>`_, you can also clone the repository +at the command line with :: + + $ git clone git://github.com/leaflabs/maple.git + +.. _maple-ret6-failure-modes: + +Failure Modes +------------- + +The following known failure modes apply to all Maple boards. The +failure modes aren't design errors, but are easy ways to break or +damage your board permanently. + +* **High voltage on non-tolerant pins**: not all header pins are 5V + compatible; so e.g. connecting certain serial devices in the wrong + way could over-voltage the pins. The :ref:`pin-mapping master table + <maple-ret6-pin-map-master>` details which pins are + :ref:`5V-tolerant <gpio-5v-tolerant>`. + +Errata +------ + +This section lists known issues and warnings for the Maple RET6 +Edition. Some of these are simply due to the RET6 Edition using the +Maple's circuit board, which was not designed to accomodate extra +features only available on the STM32F103RET6. + +.. _maple-ret6-barrel-jack: + +* **Barrel jack power supply voltage mistake**: The acceptable voltage + range given next to the barrel jack on the Maple RET6 is + **incorrect**. The given range is 7V — 18V. In fact, **18V is too + high** and should not be supplied to your board. The original + voltage regulators used on the Maple were rated up to 18V. However, + the voltage regulators on current Maple Revs are rated up to only + 16V, and due to the current draw requirements of the board, operate + properly only up to 12V. The recommended maximum voltage you should + apply is **12V**, and potentially even lower depending upon the + current draw requirements of the application. Please see :ref:`Power + Regulation on the Maple <maple-power-regulation>` for more + information. + +* **Power supply marketing mistake**: We originally sold the Maple + RET6 Edition advertising that it was capable of supplying up to 800 + mA; the correct value is 500 mA. + +.. _maple-ret6-uarts: + +* **UART4, UART5 GPIOs unavailable**: Pins related to UARTs 4 and 5 + are not broken out to headers (specifically, PC11/UART4_RX and + PC12/UART5_TX). This is due to the RET6 Edition's board layout + being that of the Maple Rev 5, which was not designed with these + RET6-specific features in mind. + +.. _maple-ret6-dac-ch2: + +* **DAC channel 2 on BOARD_LED_PIN**: The Maple Rev 5 connects PA5 to + the board's built-in LED; this is the same GPIO bit which is + connected to the DAC's channel 2 output. This is also due to the + RET6 Edition's board layout being that of the Maple Rev 5. The DAC + output channel is still available, and (if you use the + :ref:`standard libmaple DAC interface <libmaple-dac>`) its output is + buffered by default, so this may not significantly interfere with + its functionality. + +.. _maple-ret6-nrst-pb4: + +* **Reset and PB4 tied together**: The RET6 Edition's reset line is + also connected to PB4, which is labeled on the silkscreen as pin 43. + Thus, attempting to use pin 43 as a GPIO can reset your board. This + has other implications. Since PB4 is also the JTAG NJTRST line, + this prevents the :ref:`JTAG <jtag>` "reset halt" command from + working properly. Also, since PB4 is SPI3_MISO, the SPI3 peripheral + is not fully usable. + +.. _maple-ret6-sdio: + +* **SDIO lines not broken out**: The RET6 Edition's SDIO peripheral is + not usable, as some of its data lines are either not broken out or + used for other purposes. This is also due to the RET6 Edition's + board layout being that of the Maple Rev 5. + +.. _maple-ret6-adc-led: + +* **ADC on BOARD_LED_PIN**: We originally sold the Maple RET6 Edition + advertising 16 analog input lines. However, one of them (the one on + pin 13) is also connected to the built-in LED. The voltage drop + across the LED means that the analog to digital converter on that + pin is not really useful. While it is still usable, its readings + will be incorrect. + +Recommended Reading +------------------- + +.. _maple-ret6-stdocs: + +STMicro documentation for STM32F103RE microcontroller: + +* `Datasheet + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00191185.pdf>`_ + (PDF); covers STM32F103xC, STM32F103xD, STM32F103xE. +* `Reference Manual RM0008 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00171190.pdf>`_ + (PDF); definitive resource for peripherals on the STM32F1 line. +* `Programming Manual PM0056 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/PROGRAMMING_MANUAL/CD00228163.pdf>`_ + (PDF); assembly language and register reference. +* `STM32F103RE <http://www.st.com/internet/mcu/product/164485.jsp>`_ + overview page with links to further references. diff --git a/docs/source/hardware/maple.rst b/docs/source/hardware/maple.rst new file mode 100644 index 0000000..b187115 --- /dev/null +++ b/docs/source/hardware/maple.rst @@ -0,0 +1,618 @@ +.. highlight:: sh + +.. _maple: + +Maple +===== + +This page is a general resource for information specific to the Maple. + +.. contents:: Contents + :local: + +.. TODO [dma.rst] Ref to dma.rst in sequel instead of libmaple-dma +.. TODO [nvic.rst] Ref to nvic.rst in sequel + +Technical Specifications +------------------------ + +* MCU: :ref:`STM32F103RBT6 <maple-stdocs>`, a 32-bit ARM Cortex M3 + microprocessor +* Clock Speed: **72 MHz** +* **128 KB Flash** and **20 KB SRAM** +* 43 :ref:`digital I/O pins (GPIOs) <gpio>` +* 15 :ref:`PWM <pwm>` pins at 16 bit resolution +* 15 :ref:`analog input (ADC) <adc>` pins at 12-bit resolution +* 2 :ref:`SPI <spi>` peripherals +* 2 :ref:`I2C <i2c>` peripherals +* 7 Channels of Direct Memory Access (**DMA**) (:ref:`libmaple-dma`) +* 3 :ref:`USART (serial port) <usart>` peripherals +* One advanced and three general-purpose :ref:`timers <timers>` +* Dedicated :ref:`USB <usb>` port for programming and communications +* :ref:`JTAG <jtag>` +* Nested Vectored Interrupt Controller (NVIC) (including + :ref:`external interrupt <external-interrupts>` on GPIOs) +* Supplies up to 500 mA at 3.3 V, with separate 250 mA digital and + analog regulators for low-noise analog performance +* :ref:`Open source, four layer design <maple-hardware>` +* Support for low power, sleep, and standby modes (<500 μA) +* Operating Voltage: 3.3 V +* Input Voltage (recommended): 4 V — 12 V +* Dimensions: 2.05″ × 2.1″ + +.. _maple-identify-rev: + +Identifying your Rev +-------------------- + +We went through three versions ("Revs") of the Maple hardware: Rev 1, +Rev 3, and Rev 5 [#frev2_4]_; Rev 5, the final design, is currently on +sale. The following sections will help you to help you identify your +Rev. + +Rev 5 +^^^^^ + +These boards went on sale in November 2010. They have white buttons +and "r5" in small print near the "LeafLabs Maple" text next to the +"infinity leaf" logo. The Maple Rev 5 repositioned the double header +on the right hand side to better fit 0.1 inch pitch breadboard. This +necessitated the removal of pins 21 and 22 from the double header; +they are still available, but don't have any headers installed on +them. + +.. figure:: /_static/img/maple_rev5.png + :align: center + :alt: Maple Rev 5 + +Rev 3 +^^^^^ + +This batch of boards went on sale beginning in May 2010. They have a +darker red silkscreen and the "infinity leaf" logo. The Maple Rev 3 +was the first version which includes the built-in button, labeled BUT. + +.. figure:: /_static/img/maple_rev3.png + :align: center + :alt: Maple Rev 3 + +Rev 1 +^^^^^ + +A small number of Maple Rev 1 boards went on sale in late 2009. They +have a light red silkscreen and a single pixelated leaf as a logo. + +.. figure:: /_static/img/maple_rev1.png + :align: center + :alt: Maple Rev 1 + +.. _maple-powering: + +Powering the Maple +------------------ + +The Maple's power source is determined by the header to the left of +the "LeafLabs" label on the silkscreen. All versions of the Maple can +be powered from the barrel jack connector, USB, or a LiPo battery. We +ship the Maple with a jumper on the USB selector. In order to power +it off of an alternative source, unplug the Maple, then move the +jumper to the desired selector before reconnecting power. + +You can also power the Maple via the pin labeled "Vin" on the lower +header. This pin feeds into both the digital and analog voltage +regulators. However, don't do this while simultaneously powering the +board from another source, or you could damage it. + +When powering the board from a barrel jack, **double check the +polarity of the barrel.** The appropriate polarity is noted on the +silkscreen right next to the connector. + +.. warning:: Silkscreens on Maples up through Rev 5s manufactured in + Spring 2011 falsely indicated that the barrel jack could be + supplied by up to 18V. (Rev5s manufactured after Spring 2011 may + still have this error on the silk, but it has been marked over.) We + recommend a barrel jack input voltage **no greater than 12V**, and + potentially even lower depending upon the current draw requirements + of the application. The same goes for powering off LiPo batteries. + + Please see :ref:`Power Regulation on the Maple + <maple-power-regulation>` for more information. + +.. _maple-power-regulation: + +Power Regulation on the Maple +----------------------------- + +Power regulation on the Maple is provided by two low dropout linear +voltage regulators. (The part is the MCP1703 from Microchip, in the +SOT-23A package. You can download the datasheet `here +<http://ww1.microchip.com/downloads/en/DeviceDoc/22049a.pdf>`_ ). One +of the regulators supplies power to the digital voltage plane; the +other supplies power to the analog voltage plane. + +These voltage regulators nominally take an input of up to 16V. In +addition, while the maximum continuous output current for the board is +250mA, if you are powering the board off higher voltages the current +it can supply goes down, due to the regulators needing to dissipate +the extra power. So if you are powering the board off 12V, the max +current is about 40mA at room temperature. In general (again, at room +temperature) the max power dissipation (PD) for the chip is about +.37W, and output current = PD/(Vin-Vout). For exact max current +calculations, please refer to the datasheet linked above. + +If you are planning to draw a lot of current from the Maple board, it +is necessary to provide input power as close to 3.3V as +possible. Powering the microcontroller circuitry and LEDs on the board +alone takes approximately 30mA, so if you are powering the board with +12V that leaves only 10mA (at best) available for powering any user +circuitry. Attempting to draw more than 10mA runs the risk of shorting +out the power regulators and bricking your board. + +Using the Built-in Battery Charger +---------------------------------- + +Maples Rev 3 and Rev 5 also have a built-in LiPo battery charger. In +order to use it, put a jumper across the CHRG header on the power +selection header and across the USB, or EXT selectors, depending on +whether you're charging the battery via USB cable or barrel jack +connector. The LED labeled CHRG will light up while the battery is +being charged. When the battery is finished charging, the LED labeled +DONE will light up. + +.. _maple-gpios: + +GPIO Information +---------------- + +The Maple features 38 ready-to-use general purpose input/output (see +:ref:`gpio`) pins for digital input/output, numbered ``D0`` through +``D37``. These numbers correspond to the numeric values next to each +header on the Maple silkscreen. + +.. _maple-ret6-but: + +Pin ``D38`` is the board's :ref:`button pin <lang-board-values-but>`. +It is thus mainly useful as an :ref:`input <lang-pin-levels>`. The +pin will :ref:`read <lang-digitalread>` ``HIGH`` when the :ref:`button +is pressed <lang-isbuttonpressed>`. + +More GPIOs (numbered ``D39``\ --``D42`` on the back of the Maple's +silkscreen) are available if you use the :ref:`lang-disabledebugports` +function; see the :ref:`board-specific debug pin constants +<lang-board-values-debug>` for more information. (See :ref:`this +erratum <maple-nrst-pb4>` for information about the pin numbered +``43`` on the silkscreen). + +.. TODO [0.1.0] silkscreen pictures which expand abbreviations + +.. _maple-pin-map-master: + +Master Pin Map +^^^^^^^^^^^^^^ + +This table shows a summary of the available functionality on every +GPIO pin, by peripheral type. The "5 V?" column documents whether or +not the pin is :ref:`5 volt tolerant <gpio-5v-tolerant>`. + +Note that this table is not exhaustive; on some pins, more peripherals +are available than are listed here. + +.. csv-table:: + :header: Pin, :ref:`GPIO <gpio>`, :ref:`ADC <adc>`, :ref:`Timer <timers>`, :ref:`I2C <i2c>`, :ref:`UART <usart>`, :ref:`SPI <spi>`, 5 V? + + D0, PA3, CH3, 2_CH4, -, 2_RX, -, - + D1, PA2, CH2, 2_CH3, -, 2_TX, -, - + D2, PA0, CH0, 2_CH1_ETR, -, 2_CTS, -, - + D3, PA1, CH1, 2_CH2, -, 2_RTS, -, - + D4, PB5, -, -, 1_SMBA, -, -, - + D5, PB6, -, 4_CH1, 1_SCL, -, -, Yes + D6, PA8, -, 1_CH1, -, 1_CK, -, Yes + D7, PA9, -, 1_CH2, -, 1_TX, -, Yes + D8, PA10, -, 1_CH3, -, 1_RX, -, Yes + D9, PB7, -, 4_CH2, 1_SDA, -, -, Yes + D10, PA4, CH4, -, -, 2_CK, 1_NSS, - + D11, PA7, CH7, 3_CH2, -, -, 1_MOSI, - + D12, PA6, CH6, 3_CH1, -, -, 1_MISO, - + D13, PA5, CH5, -, -, -, 1_SCK, - + D14, PB8, -, 4_CH3, -, -, -, Yes + D15, PC0, CH10, -, -, -, -, - + D16, PC1, CH11, -, -, -, -, - + D17, PC2, CH12, -, -, -, -, - + D18, PC3, CH13, -, -, -, -, - + D19, PC4, CH14, -, -, -, -, - + D20, PC5, CH15, -, -, -, -, - + D21, PC13, -, -, -, -, -, - + D22, PC14, -, -, -, -, -, - + D23, PC15, -, -, -, -, -, - + D24, PB9, -, 4_CH4, -, -, -, Yes + D25, PD2, -, 3_ETR, -, -, -, Yes + D26, PC10, -, -, -, -, -, Yes + D27, PB0, CH8, 3_CH3, -, -, -, - + D28, PB1, CH9, 3_CH4, -, -, -, - + D29, PB10, -, -, 2_SCL, 3_TX, -, Yes + D30, PB11, -, -, 2_SDA, 3_RX, -, Yes + D31, PB12, -, -, 2_SMBA, 3_CK, 2_NSS, Yes + D32, PB13, -, -, -, 3_CTS, 2_SCK, Yes + D33, PB14, -, -, -, 3_RTS, 2_MISO, Yes + D34, PB15, -, -, -, -, 2_MOSI, Yes + D35, PC6, -, -, -, -, -, Yes + D36, PC7, -, -, -, -, -, Yes + D37, PC8, -, -, -, -, -, Yes + D38, PC9, -, -, -, -, -, Yes + D39, PA13, -, -, -, -, -, Yes + D40, PA14, -, -, -, -, -, Yes + D41, PA15, -, -, -, -, -, Yes + D42, PB3, -, -, -, -, -, Yes + +.. _maple-gpio-port-map: + +GPIO Port Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows what pins are associated with each +:ref:`GPIO port <gpio-ports>`. + +.. csv-table:: + :header: GPIOA, GPIOB, GPIOC + + PA0: D2, PB0: D27, PC0: D15 + PA1: D3, PB1: D28, PC1: D16 + PA2: D1, PB2: -, PC2: D17 + PA3: D0, PB3: D42, PC3: D18 + PA4: D10, PB4: D43, PC4: D19 + PA5: D13, PB5: D4, PC5: D20 + PA6: D12, PB6: D5, PC6: D35 + PA7: D11, PB7: D9, PC7: D36 + PA8: D6, PB8: D14, PC8: D37 + PA9: D7, PB9: D24, PC9: D38 + PA10: D8, PB10: D29, PC10: D26 + PA11: -, PB11: D30, PC11: - + PA12: -, PB12: D31, PC12: - + PA13: D39, PB13: D32, PC13: D21 + PA14: D40, PB14: D33, PC14: D22 + PA15: D41, PB15: D34, PC15: D23 + +.. _maple-timer-map: + +Timer Pin Map +^^^^^^^^^^^^^ + +The following table shows what pins are associated with a particular +timer's capture/compare channels. + +.. csv-table:: + :header: Timer, Ch. 1, Ch. 2, Ch. 3, Ch. 4 + :delim: | + + 1 | D6 | D7 | D8 | - + 2 | D2 | D3 | D1 | D0 + 3 | D12 | D11 | D27 | D28 + 4 | D5 | D9 | D14 | D24 + +.. _maple-exti-map: + +EXTI Line Pin Map +^^^^^^^^^^^^^^^^^ + +The following table shows which pins connect to which :ref:`EXTI lines +<external-interrupts-exti-line>` on the Maple. + +.. list-table:: + :widths: 1 1 + :header-rows: 1 + + * - EXTI Line + - Pins + * - EXTI0 + - D2, D15, D27 + * - EXTI1 + - D3, D16, D28 + * - EXTI2 + - D1, D17, D25 + * - EXTI3 + - D0, D18, D42 + * - EXTI4 + - D10, D19 + * - EXTI5 + - D4, D13, D20 + * - EXTI6 + - D5, D12, D35 + * - EXTI7 + - D9, D11, D36 + * - EXTI8 + - D6, D14, D37 + * - EXTI9 + - D7, D24, D38 + * - EXTI10 + - D8, D26, D29 + * - EXTI11 + - D30 + * - EXTI12 + - D31 + * - EXTI13 + - D21, D32, D39 + * - EXTI14 + - D22, D33, D40 + * - EXTI15 + - D23, D34, D41 + +.. _maple-usart-map: + +USART Pin Map +^^^^^^^^^^^^^ + +The Maple has three serial ports (also known as :ref:`USARTs +<usart>`): ``Serial1``, ``Serial2``, and ``Serial3``. They communicate +using the pins given in the following table. + +.. csv-table:: + :header: Serial Port, TX, RX, CK, CTS, RTS + :delim: | + + ``Serial1`` | D7 | D8 | D6 | | + ``Serial2`` | D1 | D0 | D10 | D2 | D3 + ``Serial3`` | D29 | D30 | D31 | D32 | D33 + +.. _maple-adc-bank: + +Low-Noise ADC Pins +^^^^^^^^^^^^^^^^^^ + +The six pins at the bottom right of the board (D15—D20) generally +offer lower-noise ADC performance than other pins on the board. If +you’re concerned about getting good ADC readings, we recommend using +one of these pins to take your measurements. + +Maple has an electrically isolated analog power plane with its own +regulator, and a geometrically isolated ground plane. Pins D15—D20 are +laid out to correspond with these analog planes, and our measurements +indicate that they generally have the lowest noise of all the analog +lines. However, analog performance may vary depending upon the +activity of the other GPIOs. Consult the :ref:`Maple hardware design +files <maple-hardware>` for more details. + +Board-Specific Values +--------------------- + +This section lists the Maple's :ref:`board-specific values +<lang-board-values>`. + +- ``CYCLES_PER_MICROSECOND``: 72 +- ``BOARD_BUTTON_PIN``: 38 +- ``BOARD_LED_PIN``: 13 +- ``BOARD_NR_GPIO_PINS``: 44 (however, :ref:`pin D43 is not usable + <maple-nrst-pb4>`) +- ``BOARD_NR_PWM_PINS``: 15 +- ``boardPWMPins``: 0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 14, 24, 27, 28 +- ``BOARD_NR_ADC_PINS``: 15 +- ``boardADCPins``: 0, 1, 2, 3, 10, 11, 12, 15, 16, 17, 18, 19, 20, 27, 28 +- ``BOARD_NR_USED_PINS``: 7 +- ``boardUsedPins``: ``BOARD_LED_PIN``, ``BOARD_BUTTON_PIN``, + ``BOARD_JTMS_SWDIO_PIN``, ``BOARD_JTCK_SWCLK_PIN``, + ``BOARD_JTDI_PIN``, ``BOARD_JTDO_PIN``, ``BOARD_NJTRST_PIN`` +- ``BOARD_NR_USARTS``: 3 +- ``BOARD_USART1_TX_PIN``: 7 +- ``BOARD_USART1_RX_PIN``: 8 +- ``BOARD_USART2_TX_PIN``: 1 +- ``BOARD_USART2_RX_PIN``: 0 +- ``BOARD_USART3_TX_PIN``: 29 +- ``BOARD_USART3_RX_PIN``: 30 +- ``BOARD_NR_SPI``: 2 +- ``BOARD_SPI1_NSS_PIN``: 10 +- ``BOARD_SPI1_MOSI_PIN``: 11 +- ``BOARD_SPI1_MISO_PIN``: 12 +- ``BOARD_SPI1_SCK_PIN``: 13 +- ``BOARD_SPI2_NSS_PIN``: 31 +- ``BOARD_SPI2_MOSI_PIN``: 34 +- ``BOARD_SPI2_MISO_PIN``: 33 +- ``BOARD_SPI2_SCK_PIN``: 32 +- ``BOARD_JTMS_SWDIO_PIN``: 39 +- ``BOARD_JTCK_SWCLK_PIN``: 40 +- ``BOARD_JTDI_PIN``: 41 +- ``BOARD_JTDO_PIN``: 42 +- ``BOARD_NJTRST_PIN``: :ref:`43 <maple-nrst-pb4>` + +.. _maple-hardware: + +Hardware Design Files +--------------------- + +The hardware schematics and board layout files are available in the +`Maple GitHub repository <https://github.com/leaflabs/maple>`_. The +design files for Rev 1, Rev 3, and Rev 5 are respectively in the +``maple-r1``, ``maple-r3``, and ``maple-r5`` subdirectories. A +schematic for a JTAG adapter suitable for use with Maple is available +in the ``jtagadapter`` directory. + +From the GitHub repository main page, you can download the entire +repository by clicking the "Download" button. If you are familiar +with `Git <http://git-scm.com/>`_, you can also clone the repository +at the command line with :: + + $ git clone git://github.com/leaflabs/maple.git + +.. _maple-failure-modes: + +Failure Modes +------------- + +The following are known failure modes. The failure modes aren't +design errors, but are easy ways to break or damage your board +permanently. + +* **High voltage on non-tolerant pins**: not all header pins are 5V + compatible; so e.g. connecting certain serial devices in the wrong + way could over-voltage the pins. The :ref:`pin-mapping master table + <maple-pin-map-master>` details which pins are :ref:`5 V tolerant + <gpio-5v-tolerant>`. + +Errata +------ + +This section documents design flaws and other errors. + +General +^^^^^^^ + +.. _maple-barrel-jack: + +* **Barrel jack power supply voltage mistake**: The acceptable voltage + range given next to the barrel jack on the Maple through Rev 5s + manufactured in Spring 2011 is **incorrect**. The given range is 7V + — 18V. In fact, **18V is too high** and should not be supplied to + your board. The original voltage regulators used on the Maple were + rated up to 18V. However, the voltage regulators on current Maple + Revs are rated up to only 16V, and due to the current draw + requirements of the board, operate properly only up to 12V. The + recommended maximum voltage you should apply is **12V**, and + potentially even lower depending upon the current draw requirements + of the application. Please see :ref:`Power Regulation on the Maple + <maple-power-regulation>` for more information. + +.. _maple-nrst-pb4: + +* **Reset and PB4 tied together**: The Maple's reset line is also + connected to PB4, which is labeled on the silkscreen as pin 43. + Thus, attempting to use pin 43 as a GPIO can reset your board. This + has other implications. Since PB4 is also the JTAG NJTRST line, + this prevents the :ref:`JTAG <jtag>` "reset halt" command from + working properly. + +.. _maple-power-supply: + +* **Power supply marketing mistake**: We originally sold the Maple + advertising that it was capable of supplying up to 800 mA; the + correct value is 500 mA. + +.. _maple-pwm-marketing: + +* **PWM marketing mistake**: We originally advertised the Maple as + having 22 PWM-capable pins; the correct number is 15. + +.. _maple-adc-marketing: + +* **ADC marketing mistake**: We originally advertised the Maple as + having 16 analog input pins. Due to :ref:`the following issue + <maple-adc-led>`, the correct number is 15. + +.. _maple-adc-led: + +* **ADC on BOARD_LED_PIN**: We originally sold the Maple RET6 Edition + advertising 16 analog input lines. However, one of them (the one on + pin 13) is also connected to the built-in LED. The voltage drop + across the LED means that the analog to digital converter on that + pin is not really useful. While it is still usable, its readings + will be incorrect. + + +By Rev +^^^^^^ + +The following subsections lists known issues and warnings for each +revision of the Maple board. + +Rev 5 +~~~~~ + +* **Pin 3 AIN missing**: Pin 3 is capable of analog input, but on Rev + 5s manufactured during Fall 2010, the corresponding "AIN" is missing + from its silkscreen. This mistake was fixed in later manufacturing + runs. + +Rev 3 +~~~~~ + +* **Pin 3 AIN missing**: Pin 3 is capable of analog input, but the + corresponding "AIN" is missing from the Rev 3 silkscreen. + +.. _maple-rev3-bad-buttons: + +* **Bad/Sticky Buttons**: a number of Rev 3 boards sold in May-June 2010 + have questionable RESET and BUT buttons. + + What seems to have happened is that the flux remover we used to + clean the boards before shipping eroded the plastic internals, which + resulted in intermittent functionality. All buttons on all shipped + boards did function in testing, but some may have been unreliable in + regular use. + + If you have this problem, we will be happy to ship you new buttons + if you think you can re-solder them yourself, or you can ship us + your board and we will swap out that part. + + For reference, the button part number is KMR211GLFS and the flux + remover we used is "Precision Electronics Cleaner" from RadioShack, + which is "Safe on most plastics" and contains: dipropylene glycol + monomethyl ether, hydrotreated heavy naphtha, dipropylene glycol + methyl ether acetate (say that three times fast!), and carbon + dioxide. + +* **Resistors on pins 0 and 1**: these header pins, which are RX/TX on + USART2 (:ref:`Serial2 <lang-serial>`), have resistors in-line + between the STM32 and the headers. These resistors increase the + impedance of the lines for ADC reads and affect the open drain GPIO + functionality of the pins. + + These resistors were accidentally copied over from older Arduino USB + designs, where they appear to protect the USB-Serial converter from + TTL voltage on the headers. + +* **Silkscreen Errors**: the silkscreen on the bottom indicated PWM + functionality on pin 25 and listen the external header GND pin as + number 38 (actually 38 is connected to the BUT button). We manually + sharpied over both of these mistakes. + +Rev 1 +~~~~~ + +* **ADC noise**: generally very high, in particular when the USB port + is being used for communications (including keep-alive pings when + connected to a computer). + + This issue was resolved in Rev 3 with a 4-layer design and a + :ref:`geometrically isolated ADC Vref plane <maple-adc-bank>`. + +* **Resistors on pins 0 and 1**: these header pins, which are RX/TX on + USART2 (:ref:`Serial2 <lang-serial>`), have resistors in-line + between the STM32 and the headers. These resistors increase the + impedance of the lines for ADC reads and affect the open drain GPIO + functionality of the pins. + + These resistors were accidentally copied over from older Arduino USB + designs, where they appear to protect the USB-Serial converter from + TTL voltage on the headers. + +* **Silkscreen Differences**: the pin numbering scheme on Rev 1 is + different from Rev 3, and thus Rev 3 software is difficult to use + with Rev 1 boards. Notably, the analog input bank is labeled A0-A4 + on Rev 1 but 15-20 on Rev 3, and the extra header bank does not have + a pinout table on the bottom. + +* **No BUT Button**: the BUT button, useful for serial bootloading, + was only added in Rev 3. As a workaround, you can directly short the + appropriate MCU pin to Vcc; see `this forum posting + <http://forums.leaflabs.com/topic.php?id=32#post-126>`_. + +Recommended Reading +------------------- + +.. _maple-stdocs: + +STMicro documentation for STM32F103RB microcontroller: + +* `Datasheet + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00161566.pdf>`_ + (PDF); covers STM32F103x8, STM32F103xB. +* `Reference Manual RM0008 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00171190.pdf>`_ + (PDF); definitive resource for peripherals on the STM32F1 line. +* `Programming Manual PM0056 + <http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/PROGRAMMING_MANUAL/CD00228163.pdf>`_ + (PDF); assembly language and register reference. +* `STM32F103RB <http://www.st.com/internet/mcu/product/164487.jsp>`_ + overview page with links to further references. + +.. rubric:: Footnotes + +.. [#frev2_4] Revs 2 and 4 were prototypes that didn't pass internal + testing. |