Skip to content

Commit 788b613

Browse files
committed
!fixup README: proofread and add device tree section
1 parent f4de5ab commit 788b613

File tree

1 file changed

+42
-11
lines changed

1 file changed

+42
-11
lines changed

variants/STM32MP157_DK/README.md

+42-11
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ This variant currently supports the following boards:
55
* [STM32MP157A-DK1]
66
* [STM32MP157C-DK2]
77

8-
This port targets the Cortex-M4 coprocessor. __Note that the corprocessor is not a stand-alone microcontroller: the Arduino firmware for the coprocessor must be managed by the host Linux (Cortex-A side).__
8+
This port targets the Cortex-M4 coprocessor. __Note that the coprocessor is not a stand-alone microcontroller: the Arduino firmware for the coprocessor must be managed by the host Linux (Cortex-A side).__ In other words, [Cortex-M4 Engineering mode] is not supported and only Production mode is supported.
99

1010
Because every OS may have different software configurations (especially Device Tree) not all Linux distributions for these boards are supported. The currently supported distributions are the following:
1111

1212
* [STM32MP15 Starter Package]
1313
* [STM32 MPU OpenSTLinux Distribution]
1414
* [Balena OS]
1515

16-
Note that the first two OSes should select `stm32mp157c-dk2-m4-examples-sdcard` kernel configuration on boot time. See [ST Wiki page on boot mode] for more detail.
16+
Note that the first two OSes should select `stm32mp157c-dk2-m4-examples-sdcard` boot mode (or device tree configuration) on boot time. `stm32mp157c-dk2-sdcard` boot mode is also known to work but it is not guaranteed. See [ST Wiki page on boot mode] for more detail. If you are using it for your own OS, see the [Linux Device Tree considerations](#Linux-Device-Tree-considerations) section.
1717

1818
## How to use
1919

20-
After Verify and Upload, you will see a message simillar to the following in Arduino IDE:
20+
After Verify and Upload, you will see a message similar to the following in Arduino IDE:
2121

2222
<Arduino build output path>/run_arduino.sh generated successfully.
2323
This file should be uploaded manually by SCP, SFTP, Kermit, or etc.
@@ -31,7 +31,7 @@ After uploading the user can use `sh run_arduino.sh start` in the console of hos
3131

3232
Note: `sh run_arduino.sh start` is a one-shot command: the Arduino firmware only runs for the current boot. If you want to make it run after reboot, you need to use `sh run_arduino.sh install` command.
3333

34-
`run_arduino.sh` help page:
34+
`run_arduino.sh` help page summary:
3535

3636
Usage: sh run_arduino.sh [start|stop|restart|generate|install|uninstall]
3737

@@ -40,7 +40,7 @@ Note: `sh run_arduino.sh start` is a one-shot command: the Arduino firmware only
4040

4141
sh run_arduino.sh start
4242
Upload the binary to the coprocessor then start it.
43-
This command must be excuted while the script contains the binary
43+
This command must be executed while the script contains the binary
4444
after generate command is run.
4545

4646
sh run_arduino.sh install
@@ -55,6 +55,8 @@ Note: `sh run_arduino.sh start` is a one-shot command: the Arduino firmware only
5555
sh run_arduino.sh restart
5656
Restart the coprocessor.
5757

58+
See the source code for the full help page and the more details about [run_arduino.sh].
59+
5860
## Pin mapping
5961

6062
The boards have two pin headers: Raspberry Pi HAT headers and Arduino shield headers. This project currently supports Arduino Shield headers only, leaving RPi HAT headers for the Linux applications.
@@ -84,13 +86,13 @@ Note that PWM N channel (e.g. TIM1_CH3N) outputs negative output to the correspo
8486

8587
There are additional pins for LEDs and buttons.
8688

87-
| ST | Arduino | Arduino | Comment |
89+
| ST | Arduino | Arduino (cont.) | Comment |
8890
|-------|-------------------------------|----------------------|--------------------------------------------------|
8991
| PA_14 | 16 / LED_GREEN | USER1_BTN / USER_BTN | Active Low, LED LD5, also connected to B3 button |
9092
| PA_13 | 17 / LED_RED | USER2_BTN | Active Low, LED LD6, also connected to B4 button |
91-
| PH_7 | 18 / LED_ORANGE / LED_BUILTIN | | Active High, LED LD7 |
93+
| PH_7 | 18 / LED_ORANGE / LED_BUILTIN | | Active High, LED LD7 |
9294

93-
[`variant.h` of the board](https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/STM32MP157_DK/variant.h) has the complete information about the pinout.
95+
[`variant.h` of the board](https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/STM32MP157_DK/variant.h) has the complete information about the pinouts.
9496

9597
## Uploading
9698

@@ -109,25 +111,54 @@ password: (none by default)
109111

110112
* **C-Kermit** is a combined network and serial communication software package that allows users to transfer files over serial connection. [The ST Wiki page on C-Kermit] describes how to use it.
111113

114+
## Linux Device Tree considerations
115+
116+
To use the Arduino firmware for a custom OS, the user need to take into account in the Linux Device Tree, since a peripheral cannot be shared between the Linux host and the Arduino firmware, and Arduino must occupy some peripherals.
117+
118+
For example, Arduino uses TIM1 for PWM `analogWrite()` implementation. The Device Tree must disable TIM1 for Linux usage like the following:
119+
```
120+
&timers1 {
121+
status = "disabled";
122+
};
123+
```
124+
125+
And then the Device Tree should enable TIM1 for the coprocessor, although this doesn't seems to be a strict requirement it is safer to do this:
126+
```
127+
&m4_timers1 {
128+
pinctrl-names = "rproc_default";
129+
pinctrl-0 = <&timer1_pins>;
130+
status = "okay";
131+
};
132+
```
133+
134+
[stm32mp157c-dk2-m4-examples.dts] is a great example to begin with. For the full list of peripherals used by the Arduino firmware, see [PeripheralPins.c](/variants/STM32MP157_DK/PeripheralPins.c) of the board.
135+
112136
## Limitations
113137

114-
* Currently there is no easy way for communication between the Linux host and Arduino coprocessor. There is ongoing work for virtual serial communications using OpenAMP rpmsg framework. Currently one possible way is to wire between UART7 (Arduino SCL/SDA pins) and USART3 (Linux RPi HAT GPIO14/GPIO15 pins), however, users should maually modify [Linux Device tree to enable `usart3` and recompile it](usart3).
138+
* Ethernet and USB are not supported. Use them in the Linux host.
139+
* Currently there is no easy way for communication between the Linux host and Arduino coprocessor. There is ongoing work for virtual serial communications using OpenAMP rpmsg framework. Currently one possible way is to wire between UART7 (Arduino SCL/SDA pins) and USART3 (Linux RPi HAT GPIO14/GPIO15 pins), however, users should manually modify [Linux Device tree to enable `usart3` and recompile it](usart3).
115140
* I2C pins on Raspberry Pi HAT header (GPIO2 and GPIO3) are not available in Linux host. This is because the Discovery board shares I2C pins on Arduino header and those on the HAT header.
116-
* [Early firmware loading from U-Boot stage] is not supported. Only firmware loading on Linux boot stage by systemd supported. The binary itself may support it but there is no out-of-box tool to configure U-Boot to load the firmware in this project yet.
117-
* EEPROM library: Those devices do not have non-volatile memory. The emulation is done using RETRAM. Therefore data will be preserved *only* when VBAT is supplied (e.g. A coin battery is connected to CN3 on STM32MP157A_DK1) and the coprocessor is waken up from sleep.
141+
* [Early firmware loading from U-Boot stage] is not supported. Only firmware loading on Linux boot stage by systemd supported. The binary itself may be loaded by U-Boot without any problems, but there is no out-of-box tool to configure U-Boot to load the firmware using Arduino IDE yet.
142+
* EEPROM library: Those devices do not have non-volatile memory. The emulation is done using RETRAM. Therefore data will be preserved *only* when VBAT is supplied (e.g. A coin battery is connected to CN3 on STM32MP157A_DK1) and the coprocessor is waken up from sleep. This implies that cold boot the board may cause data loss, even if VBAT is supplied. See [discussions on RETRAM] for more detail.
118143

119144

120145

121146
[STM32MP157A-DK1]: https://www.st.com/en/evaluation-tools/stm32mp157a-dk1.html
122147
[STM32MP157C-DK2]: https://www.st.com/en/evaluation-tools/stm32mp157c-dk2.html
123148

149+
[Cortex-M4 Engineering mode]: https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_development_guidelines
124150
[STM32MP15 Starter Package]: https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package
125151
[STM32 MPU OpenSTLinux Distribution]: https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package
126152
[Balena OS]: https://github.com/kbumsik/balena-st-stm32mp
127153
[ST Wiki page on boot mode]: https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package#Getting_started_with_STM32CubeMP1_Package
128154

155+
[run_arduino.sh]: https://github.com/stm32duino/Arduino_Tools/blob/master/linux/run_arduino_gen.sh
156+
129157
[The ST Wiki page on C-Kermit]: https://wiki.st.com/stm32mpu/wiki/How_to_transfer_a_file_over_serial_console
130158
[a bug in OpenSTLinux]: https://community.st.com/s/question/0D50X0000B9vHa4/cannot-get-download-a-file-using-kermit
131159

160+
[stm32mp157c-dk2-m4-examples.dts]: https://github.com/STMicroelectronics/meta-st-stm32mp/blob/d8cbac759e1275b1a27d4ba38b64a0d83d0e8c9f/recipes-kernel/linux/linux-stm32mp/4.19/4.19.49/0029-ARM-stm32mp1-r2-DEVICETREE.patch#L4334
161+
132162
[usart3]: https://github.com/STMicroelectronics/meta-st-stm32mp/blob/d8cbac759e1275b1a27d4ba38b64a0d83d0e8c9f/recipes-kernel/linux/linux-stm32mp/4.19/4.19.49/0029-ARM-stm32mp1-r2-DEVICETREE.patch#L4274
133163
[Early firmware loading from U-Boot stage]: https://wiki.st.com/stm32mpu/wiki/How_to_start_the_coprocessor_from_the_bootloader
164+
[discussions on RETRAM]: https://community.st.com/s/question/0D50X0000B44pHUSQY/doesnt-the-mcu-coprocessor-have-nonvolatile-memory

0 commit comments

Comments
 (0)