You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: variants/STM32MP157_DK/README.md
+47-3Lines changed: 47 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,9 @@ After uploading the user can use `sh run_arduino_<sketch name>.sh start` in the
77
77
sh run_arduino_<sketch name>.sh minicom
78
78
Launch minicom interactive serial communication program.
79
79
80
+
sh run_arduino_<sketch name>.sh log
81
+
Print debugging log in OpenAMP trace buffer.
82
+
80
83
sh run_arduino_<sketch name>.sh stop
81
84
Stop the coprocessor.
82
85
@@ -87,6 +90,40 @@ See the source code [run_arduino_gen.sh] for the full help page and the more det
87
90
88
91
[run_arduino_gen.sh] is the shell script that produces a copy of the script called `run_arduino_<sketch name>.sh` but with the sketch binary self-contained.
89
92
93
+
## Virtual Serial
94
+
95
+
With Virtual Serial, you can easily implement inter-core communication between the Linux host and Arduino coprocessor. Virtual Serial uses OpenAMP rpmsg framework. This is available as `VirtIOSerial` object and you can use it as a standard Arduino Serial object.
96
+
97
+
Enable `VirtIOSerial` in Arduino IDE->Tools->Virtual serial support. You can optionally alias generic `Serial` object with `VirtIOSerial` as well.
98
+
99
+
When enabled, `/dev/ttyRPMSG0` is available to the Linux host. You can use it as a normal serial tty. `sh run_arduino_<sketch name>.sh` provides `monitor`, `minicom`, `send-msg`, `send-file` as a convenience. See above command descriptions.
100
+
101
+
See [OpenAMP] and [Linux RPMsg] to learn more.
102
+
103
+
## Debugging
104
+
105
+
For printf-style debugging, `core_debug()` is highly recommended instead of using Arduino Serial. In STM32MP1, `core_debug()` utilizes OpenAMP trace buffer and it has a minimal real-time impact (other than the overhead of printf) because it is not bound to the speed of a hardware IO peripheral while printing it.
106
+
107
+
Create [build_opt.h] in the sketch directory and simply put `-DCORE_DEBUG`. Additionally you can resize the buffer size of logging by redefining `VIRTIO_LOG_BUFFER_SIZE` (2kb by default). As an example you can create a file like the following:
108
+
109
+
```
110
+
build_opt.h (in the same directory of your Sketch)
111
+
-----------------------------
112
+
113
+
-DCORE_DEBUG
114
+
-DVIRTIO_LOG_BUFFER_SIZE=4086
115
+
```
116
+
117
+
Don't forget to change any of Arduino IDE option to reflect this as in the warning section in [build_opt.h description in wiki]. This is important because if `-DCORE_DEBUG` is not configured correctly `core_debug()` silently becomes an empty function without triggering any build error.
118
+
119
+
Also, need to add `#include "core_debug.h"` in your code in order to use `core_debug()`.
120
+
121
+
You can use `sh run_arduino_<sketch name>.sh log` command or `cat /sys/kernel/debug/remoteproc/remoteproc0/trace0` command to print out the debug log in the Linux host.
122
+
123
+
Note that when overflow occurs the trace buffer is re-written from the beginning, removing existing logs. Consider increasing `VIRTIO_LOG_BUFFER_SIZE` in this case, as mentioned above.
124
+
125
+
See [virtio_log.h] for more information.
126
+
90
127
## Pin mapping
91
128
92
129
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.
@@ -122,7 +159,7 @@ There are additional pins for LEDs and buttons.
122
159
| PA_13 | 17 / LED_RED | USER2_BTN | Active Low, LED LD6, also connected to B4 button |
123
160
| PH_7 | 18 / LED_ORANGE / LED_BUILTIN || Active High, LED LD7 |
124
161
125
-
[`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.
162
+
[`variant.h` of the board] has the complete information about the pinouts.
126
163
127
164
## Uploading
128
165
@@ -166,7 +203,6 @@ And then the Device Tree should enable TIM1 for the coprocessor, although this d
166
203
## Limitations
167
204
168
205
* Ethernet and USB are not supported. Use them in the Linux host.
169
-
* 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).
170
206
* 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.
171
207
*[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.
172
208
* 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.
@@ -184,11 +220,19 @@ And then the Device Tree should enable TIM1 for the coprocessor, although this d
0 commit comments