xref: /aosp_15_r20/external/pigweed/pw_sys_io_baremetal_stm32f429/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_sys_io_baremetal_stm32f429:
2
3-----------------------------
4pw_sys_io_baremetal_stm32f429
5-----------------------------
6``pw_sys_io_baremetal_stm32f429`` implements the ``pw_sys_io`` facade over
7UART.
8
9The STM32F429 baremetal sys IO backend provides device startup code and a UART
10driver layer that allows applications built against the ``pw_sys_io`` interface
11to run on a STM32F429 chip and do simple input/output via UART. The code is
12optimized for the STM32F429I-DISC1, using USART1 (which is connected to the
13virtual COM port on the embedded ST-LINKv2 chip). However, this should work with
14all STM32F429 variations (and even some STM32F4xx chips).
15
16This backend has no configuration options. The point of it is to provide bare-
17minimum platform code needed to do UART reads/writes.
18
19Setup
20=====
21This module requires relatively minimal setup:
22
231. Write code against the ``pw_sys_io`` facade.
242. Set the backend, in a way appropriate to your build system:
25
26   *  In GN, specify the ``dir_pw_sys_io_backend`` GN global variable to point to this
27      backend.
28   *  In Bazel, set the ``--@pigweed//pw_sys_io:backend`` label flag to
29      ``@pigweed//pw_sys_io_baremetal_stm32f429``. Also, add the
30      ``@pigweed//pw_sys_io_baremetal_stm32f429:compatible`` constraint to
31      your platform, to indicate that the platform is compatible with
32      this backend.
33
343. Build an executable with a main() function using a toolchain that
35   supports Cortex-M4.
36
37.. note::
38   This module provides early firmware init and a linker script, so it will
39   conflict with other modules that do any early device init or provide a linker
40   script.
41
42Module usage
43============
44After building an executable that utilizes this backend, flash the
45produced .elf binary to the development board. Then, using a serial
46communication terminal like minicom/screen (Linux/Mac) or TeraTerm (Windows),
47connect to the device at a baud rate of 115200 (8N1). If you're not using a
48STM32F429I-DISC1 development board, manually connect a USB-to-serial TTL adapter
49to pins ``PA9`` (MCU TX) and ``PA10`` (MCU RX), making sure to match logic
50levels (e.g. 3.3V versus 1.8V).
51
52Sample connection diagram
53-------------------------
54
55.. code-block:: text
56
57   --USB Serial--+    +-----STM32F429 MCU-----
58                 |    |
59              TX o--->o PA10/USART1_RX
60                 |    |
61              RX o<---o PA9/USART1_TX
62                 |    |
63   --------------+    +-----------------------
64
65Dependencies
66============
67- :ref:`module-pw_sys_io`
68- :ref:`module-pw_preprocessor`
69