This document records the execution instruction of the BSP (board support package) provided by the RT-Thread development team for the STM32MP157A-DK1 development board.
By reading the Quickly Get Started section developers can quickly get their hands on this BSP and run RT-Thread on the board. More advanced features will be introduced in the Advanced Features section to help developers take advantage of RT-Thread to drive more on-board resources.
![board](figures/board.png)
## STM32MP157A-DK1 Board Resources Introduction
该开发板常用 **板载资源** 如下:
The STM32MP157A-DK1 is a development board based on a dual Cortex-A7 and Cortex-M4 core. The Cortex-A7 core operates at 800 MHZ and the Cortex-M4 operates at 209MHZ. There is no Flash inside the STM32MP157A.
开发板更多详细信息请参考 ST 官方文档 [STM32MP157A-DK1 开发板介绍](https://www.st.com/content/st_com/zh/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32mp157a-dk1.html)。
The mainly-used **on-board resources** are shown as follows:
For more details about this board, please refer to the ST official documentation: [STM32MP157A-DK1 Development board introduction](https://www.st.com/content/st_com/zh/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32mp157a-dk1.html)
Use a USB cable to connect the development board to the PC and turn on the power switch.
#### Compile And Download
### 快速上手
Double-click the project.eww file, to open the IAR project, compile and download the program to the board.
本 BSP 为开发者提供 IAR 工程。下面以 IAR 开发环境为例,介绍如何将系统运行起来。
> By default, the project uses ST_LINK simulator to download the program, when the ST_LINK connects the board, clicking the download button can download the program to the board.
#### 硬件连接
#### Running Results
使用数据线连接开发板到 PC,打开电源开关。
After the program is successfully downloaded, the system runs automatically. Observe the running results of the LED on the development board, the blue LD8 will flash periodically, and the terminal will periodically output"Hello RT-Thread!"
Connect the serial port of the board to PC, communicate with it via a serial terminal tool (115200-8-1-N). Restart the board and the startup information of RT-Thread will be observed:
Before you use a device, you need to find out if the device exists, and you can use the name of the DAC device that is enrolled with the command `dac probe` . As shown as follows.
```c
```
msh />dac probe dac1
probe dac1 success
```
使能设备的某个通道可以使用命令 `dac enable` 后面跟通道号。
Enable the channel of the device can use the command `dac enable` followed by the channel number.
```c
msh/>dacenable1
dac1channel1enablessuccess
```
```shell
msh />dac probe dac1
probe dac1 success
```
设置 DAC 设备某个通道的数据可以使用命令 `dac write` 后面跟通道号。
Set up the data of the channel for a DAC device can use the command `dac write` followed by the channel number.
```c
```
msh />dac write 1 1000
dac1 channel 1 write value is 1000
```
关闭设备的某个通道可以使用命令 `dac disable` 后面跟通道号。
Disable the channel of the device can use the command `dac disable` followed by the channel number.
* Open the [Env](https://www.rt-thread.io/download.html?download=Env) tool under this BSP;
* Enter the `menuconfig` command, enter the Hardware Drivers config and open LPTIM, save and exit;
* Enter the `scons --target=iar` command to regenerate project;
* The LPTIM device timing overflow will trigger an interrupt, which will print the string "hello rt-thread!";
* Enter the `lptim_sample` on the terminal to obtain the Finsh command of the LPTIM device;
*`lptim_sample run` command can turn on the LPTIM device;
*`lptim_sample set` command can set the LPTIM separation frequency.
1. 在 bsp 下打开 env 工具。
### Advanced Features
2. 输入`menuconfig`命令配置工程,配置好之后保存退出。
This BSP only enables GPIO and serial port 4 by default. If need more advanced features, you need to configure the BSP with RT-Thread Env tools, as follows:
3. 输入`pkgs --update`命令更新软件包。
* Open the [Env](https://www.rt-thread.io/download.html?download=Env) tool under this BSP;
* Enter the `menuconfig` command to configure the project, then save and exit;
* Enter the `pkgs --update` command to update the packages;
* Enter the `scons --target=iar `command to regenerate the project.
开发板更多详细信息请参考 ST 官方文档 [STM32MP157A-DK1 开发板介绍](https://www.st.com/content/st_com/zh/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32mp157a-dk1.html)。