Skip to content

Commit 29a0dde

Browse files
committed
update README.md and main.c file
update template.uvprojx and enable to automatic operate after burning support SPI/I2C/timer/pwm/ADC/RTC/WDG/FLASH/OTGFS/RNG/UDID on-chip peripheral driver take CubeMX_Config.ioc Rename to STM32F413ZH.ioc
1 parent ee2cec1 commit 29a0dde

19 files changed

+1645
-1317
lines changed

bsp/stm32/stm32f413-st-nucleo/.config

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ CONFIG_RT_USING_PIN=y
130130
# CONFIG_RT_USING_RTC is not set
131131
# CONFIG_RT_USING_SDIO is not set
132132
# CONFIG_RT_USING_SPI is not set
133-
# CONFIG_RT_USING_WDT is not set
133+
CONFIG_RT_USING_WDT=y
134134
# CONFIG_RT_USING_AUDIO is not set
135135
# CONFIG_RT_USING_SENSOR is not set
136136
# CONFIG_RT_USING_TOUCH is not set
@@ -366,6 +366,13 @@ CONFIG_BSP_USING_UART=y
366366
# CONFIG_BSP_USING_UART2 is not set
367367
CONFIG_BSP_USING_UART3=y
368368
# CONFIG_BSP_UART3_RX_USING_DMA is not set
369+
# CONFIG_BSP_USING_SPI is not set
370+
# CONFIG_BSP_USING_I2C1 is not set
371+
# CONFIG_BSP_USING_TIM is not set
372+
# CONFIG_BSP_USING_PWM is not set
373+
# CONFIG_BSP_USING_ADC is not set
374+
# CONFIG_BSP_USING_ONCHIP_RTC is not set
375+
# CONFIG_BSP_USING_WDT is not set
369376
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
370377
# CONFIG_BSP_USING_USBD is not set
371378
# CONFIG_BSP_USING_RNG is not set

bsp/stm32/stm32f413-st-nucleo/README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
- MCU:STM32F413ZH,主频 100MHz,1536KB FLASH ,320KB RAM
2626
- 常用外设
27-
- LED:8个,user LED (绿色,PC9,LD1;蓝色,PB7,LD2;红色,PB14,LD3), USB communication (LD4), over current (LD5), power LED (黄色,LD6), USB FAULT (LD7), VBUS (LD8)。
27+
- LED:8个,user LED [SB2跳帽需连接](黄色,PB0,LD1;蓝色,PB7,LD2;红色,PB14,LD3), USB communication (LD4), over current (LD5), power LED (黄色,LD6), USB FAULT (LD7), VBUS (LD8)。
2828
- 按键:2个,B1(USER,PC13),B2(RESET)
2929
- 常用接口:USB 支持 3 种不同接口:虚拟 COM 端口、大容量存储和调试端口等。
3030
- 调试接口,板载 ST-LINK/V2-1 调试器。
@@ -35,12 +35,27 @@
3535

3636
本 BSP 目前对外设的支持情况如下:
3737

38+
| **板载外设** | **支持情况** | **备注** |
39+
| :------------ | :----------: | :-----------------------------------: |
40+
|STLINK TO USART| 支持 | UART3 |
41+
3842
| **片上外设** | **支持情况** | **备注** |
3943
| :------------ | :----------: | :-----------------------------------: |
4044
| GPIO | 支持 | |
41-
| UART | 支持 | UART2,UART3 |
42-
| Onchip Flash | 支持 | |
43-
| USB Device | 支持 | |
45+
| UART | 支持 | UART2/3 |
46+
| SPI | 支持 | SPI2 |
47+
| I2C | 支持 | I2C1(软件模拟) |
48+
| TIMER | 支持 | TIM11/13/14 |
49+
| PWM | 支持 | PWM2_CH4 |
50+
| ADC | 支持 | ADC1_IN5 |
51+
| RTC | 支持 | 支持外部晶振和内部低速时钟 |
52+
| WDT | 支持 | 独立看门狗 |
53+
| Onchip Flash | 支持 | 片上Flash |
54+
| USB OTG_FS | 支持 | OTGFS as USB device |
55+
| Onchip Flash | 支持 | 片上Flash |
56+
| USB Device | 支持 | OTGFS as USB device |
57+
| RNG | 支持 | Random Number Generator |
58+
| UDID | 支持 | Unique Device Identifier |
4459

4560
## 使用说明
4661

@@ -67,11 +82,11 @@
6782

6883
双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。
6984

70-
> 工程默认配置使用 xxx 仿真器下载程序,在通过 xxx 连接开发板的基础上,点击下载按钮即可下载程序到开发板
85+
> 工程默认配置使用 板载ST-LINK 仿真器下载程序,在通过 Micro USB线 连接开发板的基础上,点击下载按钮即可下载程序到开发板
7186
7287
#### 运行结果
7388

74-
下载程序成功之后,系统会自动运行,观察开发板上 LD2 的运行效果,蓝色 LD2 会周期性闪烁
89+
下载程序成功之后,系统会自动运行,在SB2跳帽连接时,当按下用户按键USER KEY时,观察开发板上 LD1、LD2、LD2 的运行效果,三个LED会顺序周期性交替闪烁
7590

7691
连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:
7792

@@ -84,7 +99,7 @@ msh >
8499
```
85100
### 进阶使用
86101

87-
此 BSP 默认只开启了 GPIO 和 串口 3 的功能,更多高级功能需要利用 ENV 工具对 BSP 进行配置,步骤如下:
102+
此 BSP 默认只开启了 GPIO 和 UART3 的功能,更多高级功能需要利用 ENV 工具对 BSP 进行配置,步骤如下:
88103

89104
1. 在 bsp 下打开 env 工具。
90105

bsp/stm32/stm32f413-st-nucleo/applications/main.c

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,50 @@
1212
#include <rtdevice.h>
1313
#include <board.h>
1414

15+
/* defined the LED1 pin: PB0 */
16+
#define LED1_PIN GET_PIN(B, 0)
1517
/* defined the LED2 pin: PB7 */
1618
#define LED2_PIN GET_PIN(B, 7)
19+
/* defined the LED3 pin: PB14 */
20+
#define LED3_PIN GET_PIN(B, 14)
21+
/* defined the USER KEY pin: PC13 */
22+
#define KEY_PIN GET_PIN(C, 13)
1723

1824
int main(void)
1925
{
2026
int count = 1;
21-
/* set LED0 pin mode to output */
27+
/* set LED1 pin mode to output */
28+
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
29+
/* set LED2 pin mode to output */
2230
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
31+
/* set LED3 pin mode to output */
32+
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
33+
/* set USER KEY pin mode to input */
34+
rt_pin_mode(KEY_PIN, PIN_MODE_INPUT_PULLDOWN);
2335

2436
while (count++)
2537
{
26-
rt_pin_write(LED2_PIN, PIN_HIGH);
27-
rt_thread_mdelay(500);
28-
rt_pin_write(LED2_PIN, PIN_LOW);
29-
rt_thread_mdelay(500);
38+
if(rt_pin_read(KEY_PIN))
39+
{
40+
rt_pin_write(LED1_PIN, PIN_HIGH);
41+
rt_pin_write(LED2_PIN, PIN_LOW);
42+
rt_pin_write(LED3_PIN, PIN_LOW);
43+
rt_thread_mdelay(500);
44+
rt_pin_write(LED1_PIN, PIN_LOW);
45+
rt_pin_write(LED2_PIN, PIN_HIGH);
46+
rt_pin_write(LED3_PIN, PIN_LOW);
47+
rt_thread_mdelay(500);
48+
rt_pin_write(LED1_PIN, PIN_LOW);
49+
rt_pin_write(LED2_PIN, PIN_LOW);
50+
rt_pin_write(LED3_PIN, PIN_HIGH);
51+
rt_thread_mdelay(500);
52+
}
53+
else
54+
{
55+
rt_pin_write(LED1_PIN, PIN_LOW);
56+
rt_pin_write(LED2_PIN, PIN_LOW);
57+
rt_pin_write(LED3_PIN, PIN_LOW);
58+
}
3059
}
3160

3261
return RT_EOK;

0 commit comments

Comments
 (0)