Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 1 | .. _chapter-pw-sys-io-baremetal-stm32f429: |
Armando Montanez | a69244e | 2019-11-15 11:25:10 -0800 | [diff] [blame] | 2 | |
| 3 | .. default-domain:: cpp |
| 4 | |
| 5 | .. highlight:: sh |
| 6 | |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 7 | ----------------------------- |
| 8 | pw_sys_io_baremetal_stm32f429 |
| 9 | ----------------------------- |
Armando Montanez | d2e4903 | 2019-12-06 13:06:01 -0800 | [diff] [blame] | 10 | |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 11 | ``pw_sys_io_baremetal_stm32f429`` implements the ``pw_sys_io`` facade over |
Armando Montanez | d2e4903 | 2019-12-06 13:06:01 -0800 | [diff] [blame] | 12 | UART. |
| 13 | |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 14 | The STM32F429 baremetal sys IO backend provides device startup code and a UART |
| 15 | driver layer that allows applications built against the ``pw_sys_io`` interface |
Armando Montanez | d2e4903 | 2019-12-06 13:06:01 -0800 | [diff] [blame] | 16 | to run on a STM32F429 chip and do simple input/output via UART. The code is |
| 17 | optimized for the STM32F429I-DISC1, using USART1 (which is connected to the |
| 18 | virtual COM port on the embedded ST-LINKv2 chip). However, this should work with |
| 19 | all STM32F429 variations (and even some STM32F4xx chips). |
Armando Montanez | a69244e | 2019-11-15 11:25:10 -0800 | [diff] [blame] | 20 | |
| 21 | This backend has no configuration options. The point of it is to provide bare- |
| 22 | minimum platform code needed to do UART reads/writes. |
| 23 | |
| 24 | Setup |
| 25 | ===== |
| 26 | This module requires relatively minimal setup: |
| 27 | |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 28 | 1. Write code against the ``pw_sys_io`` facade. |
| 29 | 2. Specify the ``dir_pw_sys_io_backend`` GN global variable to point to this |
Armando Montanez | a69244e | 2019-11-15 11:25:10 -0800 | [diff] [blame] | 30 | backend. |
| 31 | 3. Build an executable with a main() function using a toolchain that |
| 32 | supports Cortex-M4. |
| 33 | |
| 34 | .. note:: |
| 35 | This module provides early firmware init and a linker script, so it will |
| 36 | conflict with other modules that do any early device init or provide a linker |
| 37 | script. |
| 38 | |
| 39 | Module usage |
| 40 | ============ |
Tennessee Carmel-Veilleux | e716e0a | 2020-01-14 14:56:59 -0500 | [diff] [blame] | 41 | After building an executable that utilizes this backend, flash the |
Armando Montanez | a69244e | 2019-11-15 11:25:10 -0800 | [diff] [blame] | 42 | produced .elf binary to the development board. Then, using a serial |
Tennessee Carmel-Veilleux | e716e0a | 2020-01-14 14:56:59 -0500 | [diff] [blame] | 43 | communication terminal like minicom/screen (Linux/Mac) or TeraTerm (Windows), |
| 44 | connect to the device at a baud rate of 115200 (8N1). If you're not using a |
| 45 | STM32F429I-DISC1 development board, manually connect a USB-to-serial TTL adapter |
| 46 | to pins ``PA9`` (MCU TX) and ``PA10`` (MCU RX), making sure to match logic |
| 47 | levels (e.g. 3.3V versus 1.8V). |
| 48 | |
| 49 | Sample connection diagram |
| 50 | ------------------------- |
| 51 | |
| 52 | .. code-block:: text |
| 53 | |
| 54 | --USB Serial--+ +-----STM32F429 MCU----- |
| 55 | | | |
| 56 | TX o--->o PA10/USART1_RX |
| 57 | | | |
| 58 | RX o<---o PA9/USART1_TX |
| 59 | | | |
| 60 | --------------+ +----------------------- |
Armando Montanez | a69244e | 2019-11-15 11:25:10 -0800 | [diff] [blame] | 61 | |
| 62 | Dependencies |
| 63 | ============ |
Armando Montanez | 0054a9b | 2020-03-13 13:06:24 -0700 | [diff] [blame] | 64 | * ``pw_sys_io`` facade |
| 65 | * ``pw_preprocessor`` module |