[bsp][stm32]: add stm32h563 rtduino
This commit is contained in:
parent
7bc4f7d6a3
commit
32be3c4a30
|
@ -2,8 +2,8 @@ from building import *
|
|||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd]
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
|
||||
src += ['arduino_main.cpp']
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-13 songw4232 first version
|
||||
* Date Author Notes
|
||||
* 2023-12-30 ChuShicheng first version
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
@ -13,12 +13,12 @@
|
|||
void setup(void)
|
||||
{
|
||||
/* put your setup code here, to run once: */
|
||||
Serial.begin();
|
||||
Serial2.begin();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
/* put your main code here, to run repeatedly: */
|
||||
Serial.println("Hello Arduino!");
|
||||
Serial2.println("Hello Arduino!");
|
||||
delay(800);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# STM32U575-NUCLEO开发板的Arduino生态兼容说明
|
||||
# stm32h563-st-nucleo 开发板的Arduino生态兼容说明
|
||||
|
||||
## 1 RTduino - RT-Thread的Arduino生态兼容层
|
||||
|
||||
STM32U575-NUCLEO开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。
|
||||
stm32h563-st-nucleo 开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。
|
||||
|
||||
### 1.1 如何开启针对本BSP的Arduino生态兼容层
|
||||
|
||||
|
@ -16,36 +16,34 @@ Hardware Drivers Config --->
|
|||
|
||||
## 2 Arduino引脚排布
|
||||
|
||||
该BSP遵照Arduino UNO板的引脚排列方式,并扩展增加了STM32U575-NUCLEO自身的板载资源功能引脚。详见 `pins_arduino.c`
|
||||
|
||||
更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。
|
||||
|
||||
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
|
||||
| --------------------- | --------- | ------- | -------------------------------------------- |
|
||||
| 0 (D0) | PG8 | 是 | Serial-Rx,被RT-Thread的UART设备框架uart1接管 |
|
||||
| 1 (D1) | PG7 | 是 | Serial-Tx,被RT-Thread的UART设备框架uart1接管 |
|
||||
| 2 (D2) | PF15 | 是 | 普通IO |
|
||||
| 3 (D3) | PE13 | 是 | PWM1-CH2,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 4 (D4) | PF14 | 是 | 普通IO |
|
||||
| 5 (D5) | PE11 | 是 | PWM1-CH3,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 6 (D6) | PE9 | 是 | PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 7 (D7) | PF13 | 是 | 普通IO |
|
||||
| 8 (D8) | PF12 | 是 | 普通IO |
|
||||
| 9 (D9) | PD15 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
|
||||
| 10 (D10) | PD14 | 是 | SPI1 片选 CS |
|
||||
| 11 (D11) | PA7 | 是 | SPI1-MOSI,默认被RT-Thread的SPI设备框架spi1总线接管 |
|
||||
| 12 (D12) | PA6 | 是 | SPI1-MISO,默认被RT-Thread的SPI设备框架spi1总线接管 |
|
||||
| 13 (D13) | PA5 | 是 | SPI1-SCK,默认被RT-Thread的SPI设备框架spi1总线接管 |
|
||||
| 14 (D14) | PB9 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
|
||||
| 15 (D15) | PB8 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
|
||||
| A0 | PA3 | 是(但不建议) | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
| A1 | PA2 | 是(但不建议) | ADC1-CH7,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
| A2 | PC3 | 是(但不建议) | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
| A3 | PB0 | 是(但不建议) | ADC1-CH15,默认被RT-Thread的ADC设备框架adc1接管|
|
||||
| A4 | PC1 | 是(但不建议) | ADC1-CH2,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
| A5 | PC0 | 是(但不建议) | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。
|
||||
|
||||
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
|
||||
| ------------------- | --------- | ---- | ------------------------------------------------------------------------- |
|
||||
| 0 (D0) | GET_PIN(B, 7) | 是 | Serial2-RX,默认被RT-Thread的UART设备框架lpuart1接管 |
|
||||
| 1 (D1) | GET_PIN(B, 6) | 是 | Serial2-TX,默认被RT-Thread的UART设备框架lpuart1接管 |
|
||||
| 2 (D2) | GET_PIN(G, 14) | 是 | |
|
||||
| 3 (D3) | GET_PIN(E, 13) | 是 | PWM1-CH3,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 4 (D4) | GET_PIN(E, 14) | 是 | |
|
||||
| 5 (D5) | GET_PIN(E, 11) | 是 | PWM1-CH2,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 6 (D6) | GET_PIN(E, 9) | 是 | PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||
| 7 (D7) | GET_PIN(G, 12) | 是 | |
|
||||
| 8 (D8) | GET_PIN(F, 3) | 是 | |
|
||||
| 9 (D9) | GET_PIN(D, 15) | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
|
||||
| 10 (D10) | GET_PIN(D, 14) | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 |
|
||||
| 11 (D11) | GET_PIN(B, 5) | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
|
||||
| 12 (D12) | GET_PIN(G, 9) | 是 | |
|
||||
| 13 (D13) | GET_PIN(A, 5) | 是 | |
|
||||
| 14 (D14) | GET_PIN(B, 9) | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 |
|
||||
| 15 (D15) | GET_PIN(B, 8) | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 |
|
||||
| 16 (A0) | GET_PIN(A, 6) | 是 | ADC2-CH3,默认被RT-Thread的ADC设备框架adc2接管 |
|
||||
| 17 (A1) | GET_PIN(C, 0) | 是 | ADC2-CH10,默认被RT-Thread的ADC设备框架adc2接管 |
|
||||
| 18 (A2) | GET_PIN(C, 3) | 是 | ADC2-CH13,默认被RT-Thread的ADC设备框架adc2接管 |
|
||||
| 19 (A3) | GET_PIN(B, 1) | 是 | ADC2-CH5,默认被RT-Thread的ADC设备框架adc2接管 |
|
||||
| 20 (A4) | GET_PIN(C, 2) | 是 | ADC2-CH12,默认被RT-Thread的ADC设备框架adc2接管 |
|
||||
| 21 (A5) | GET_PIN(F, 11) | 是 | ADC1-CH2,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
|
||||
> 注意:
|
||||
>
|
||||
> 1. 暂无
|
||||
> 1. xxxxxxxxx
|
||||
> 2. xxxxxxxxx
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-13 songw4232 first version
|
||||
* Date Author Notes
|
||||
* 2023-12-30 ChuShicheng first version
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <board.h>
|
||||
#include "pins_arduino.h"
|
||||
#include <drv_gpio.h>
|
||||
|
||||
/*
|
||||
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
|
||||
|
@ -22,26 +20,26 @@
|
|||
*/
|
||||
const pin_map_t pin_map_table[]=
|
||||
{
|
||||
{D0, GET_PIN(G,8), "uart1"}, /* Serial-RX */
|
||||
{D1, GET_PIN(G,7), "uart1"}, /* Serial-TX */
|
||||
{D2, GET_PIN(F,15)},
|
||||
{D3, GET_PIN(E,13), "pwm1", 3}, /* PWM */
|
||||
{D4, GET_PIN(F,14)},
|
||||
{D5, GET_PIN(E,11), "pwm1", 2}, /* PWM */
|
||||
{D6, GET_PIN(E,9), "pwm1", 1}, /* PWM */
|
||||
{D7, GET_PIN(F,13)},
|
||||
{D8, GET_PIN(F,12)},
|
||||
{D9, GET_PIN(D,15), "pwm4", 4}, /* PWM */
|
||||
{D10, GET_PIN(D,14)},
|
||||
{D11, GET_PIN(A,7), "spi1"}, /* SPI-MOSI */
|
||||
{D12, GET_PIN(A,6), "spi1"}, /* SPI-MISO */
|
||||
{D13, GET_PIN(A,5), "spi1"}, /* SPI-SCK */
|
||||
{D14, GET_PIN(B,9), "i2c1"}, /* I2C-SDA (Wire) */
|
||||
{D15, GET_PIN(B,8), "i2c1"}, /* I2C-SCL (Wire) */
|
||||
{A0, GET_PIN(A,3), "adc1", 8}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A1, GET_PIN(A,2), "adc1", 7}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A2, GET_PIN(C,3), "adc1", 4}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A3, GET_PIN(B,0), "adc1", 15}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A4, GET_PIN(C,1), "adc1", 2}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A5, GET_PIN(C,0), "adc1", 1}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{D0, GET_PIN(B, 7), "lpuart1"}, /* Serial-RX */
|
||||
{D1, GET_PIN(B, 6), "lpuart1"}, /* Serial-TX */
|
||||
{D2, GET_PIN(G, 14)},
|
||||
{D3, GET_PIN(E, 13), "pwm1", 3}, /* PWM */
|
||||
{D4, GET_PIN(E, 14)},
|
||||
{D5, GET_PIN(E, 11), "pwm1", 2}, /* PWM */
|
||||
{D6, GET_PIN(E, 9), "pwm1", 1}, /* PWM */
|
||||
{D7, GET_PIN(G, 12)},
|
||||
{D8, GET_PIN(F, 3)},
|
||||
{D9, GET_PIN(D, 15), "pwm4", 4}, /* PWM */
|
||||
{D10, GET_PIN(D, 14), "pwm4", 3}, /* PWM */
|
||||
{D11, GET_PIN(B, 5), "pwm3", 2}, /* PWM */
|
||||
{D12, GET_PIN(G, 9)},
|
||||
{D13, GET_PIN(A, 5)}, /* LED_BUILTIN */
|
||||
{D14, GET_PIN(B, 9), "i2c1"}, /* I2C-SDA (Wire) */
|
||||
{D15, GET_PIN(B, 8), "i2c1"}, /* I2C-SCL (Wire) */
|
||||
{A0, GET_PIN(A, 6), "adc2", 3}, /* ADC */
|
||||
{A1, GET_PIN(C, 0), "adc2", 10}, /* ADC */
|
||||
{A2, GET_PIN(C, 3), "adc2", 13}, /* ADC */
|
||||
{A3, GET_PIN(B, 1), "adc2", 5}, /* ADC */
|
||||
{A4, GET_PIN(C, 2), "adc2", 12}, /* ADC */
|
||||
{A5, GET_PIN(F, 11), "adc1", 2}, /* ADC */
|
||||
};
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-04-13 songw4232 first version
|
||||
* Date Author Notes
|
||||
* 2023-12-30 ChuShicheng first version
|
||||
*/
|
||||
|
||||
#ifndef Pins_Arduino_h
|
||||
|
@ -35,12 +35,16 @@
|
|||
#define A4 (20)
|
||||
#define A5 (21)
|
||||
|
||||
#define F_CPU 160000000L /* CPU:160MHz */
|
||||
#define RTDUINO_PIN_MAX_LIMIT A5 /* pin number max limit check */
|
||||
|
||||
/* i2c1 : PB9-SDA PB8-SCL */
|
||||
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
|
||||
#define F_CPU 250000000L /* CPU:250MHz */
|
||||
|
||||
/* spi1 : PA5-SCK PA6-MISO PA7-MOSI */
|
||||
#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1"
|
||||
#define LED_BUILTIN D0 /* Default Built-in LED */
|
||||
|
||||
/* i2c1 : PB.9-SDA PB.8-SCL */
|
||||
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
|
||||
|
||||
/* Serial2(lpuart1) : PB.6-TX PB.7-RX */
|
||||
#define RTDUINO_SERIAL2_DEVICE_NAME "lpuart1"
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
||||
|
|
|
@ -0,0 +1,294 @@
|
|||
{
|
||||
"author": "ChuShicheng",
|
||||
"board_name": "stm32h563-st-nucleo",
|
||||
"childseries": "STM32H7",
|
||||
"codedemo": "Hello Arduino",
|
||||
"frequency": "250",
|
||||
"i2c": "i2c1",
|
||||
"ledpin": "D0",
|
||||
"pininfos": [
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D0",
|
||||
"channel": "",
|
||||
"function": "UART",
|
||||
"iomap": "RX",
|
||||
"name": "lpuart1",
|
||||
"notes": "/* Serial-RX */",
|
||||
"rtthread": "",
|
||||
"rttpin": "7",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D1",
|
||||
"channel": "",
|
||||
"function": "UART",
|
||||
"iomap": "TX",
|
||||
"name": "lpuart1",
|
||||
"notes": "/* Serial-TX */",
|
||||
"rtthread": "",
|
||||
"rttpin": "6",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D2",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "",
|
||||
"rtthread": "",
|
||||
"rttpin": "14",
|
||||
"rttport": "G"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D3",
|
||||
"channel": "3",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm1",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "13",
|
||||
"rttport": "E"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D4",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "",
|
||||
"rtthread": "",
|
||||
"rttpin": "14",
|
||||
"rttport": "E"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D5",
|
||||
"channel": "2",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm1",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "11",
|
||||
"rttport": "E"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D6",
|
||||
"channel": "1",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm1",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "9",
|
||||
"rttport": "E"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D7",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "",
|
||||
"rtthread": "",
|
||||
"rttpin": "12",
|
||||
"rttport": "G"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D8",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "",
|
||||
"rtthread": "",
|
||||
"rttpin": "3",
|
||||
"rttport": "F"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D9",
|
||||
"channel": "4",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm4",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "15",
|
||||
"rttport": "D"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D10",
|
||||
"channel": "3",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm4",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "14",
|
||||
"rttport": "D"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D11",
|
||||
"channel": "2",
|
||||
"function": "PWM",
|
||||
"iomap": "",
|
||||
"name": "pwm3",
|
||||
"notes": "/* PWM */",
|
||||
"rtthread": "",
|
||||
"rttpin": "5",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D12",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "",
|
||||
"rtthread": "",
|
||||
"rttpin": "9",
|
||||
"rttport": "G"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D13",
|
||||
"channel": "",
|
||||
"function": "GPIO",
|
||||
"iomap": "",
|
||||
"name": "",
|
||||
"notes": "/* LED_BUILTIN */",
|
||||
"rtthread": "",
|
||||
"rttpin": "5",
|
||||
"rttport": "A"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D14",
|
||||
"channel": "",
|
||||
"function": "I2C",
|
||||
"iomap": "SDA",
|
||||
"name": "i2c1",
|
||||
"notes": "/* I2C-SDA (Wire) */",
|
||||
"rtthread": "",
|
||||
"rttpin": "9",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "D15",
|
||||
"channel": "",
|
||||
"function": "I2C",
|
||||
"iomap": "SCL",
|
||||
"name": "i2c1",
|
||||
"notes": "/* I2C-SCL (Wire) */",
|
||||
"rtthread": "",
|
||||
"rttpin": "8",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A0",
|
||||
"channel": "3",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc2",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "6",
|
||||
"rttport": "A"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A1",
|
||||
"channel": "10",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc2",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "0",
|
||||
"rttport": "C"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A2",
|
||||
"channel": "13",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc2",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "3",
|
||||
"rttport": "C"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A3",
|
||||
"channel": "5",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc2",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "1",
|
||||
"rttport": "B"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A4",
|
||||
"channel": "12",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc2",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "2",
|
||||
"rttport": "C"
|
||||
},
|
||||
{
|
||||
"allow5v": true,
|
||||
"arduino": "A5",
|
||||
"channel": "2",
|
||||
"function": "ADC",
|
||||
"iomap": "",
|
||||
"name": "adc1",
|
||||
"notes": "/* ADC */",
|
||||
"rtthread": "",
|
||||
"rttpin": "11",
|
||||
"rttport": "F"
|
||||
}
|
||||
],
|
||||
"pinmap_image": "",
|
||||
"project_name": "stm32h563-st-nucleo-rtduino",
|
||||
"project_path": "D:/RT-Thread/rt-thread/bsp/stm32/stm32h563-st-nucleo/applications",
|
||||
"pwmtospi": {
|
||||
"miso_pin": "",
|
||||
"miso_port": "",
|
||||
"mosi_pin": "",
|
||||
"mosi_port": "",
|
||||
"sck_pin": "",
|
||||
"sck_port": "",
|
||||
"spi_name": ""
|
||||
},
|
||||
"serial1": "",
|
||||
"serial2": "lpuart1",
|
||||
"serial3": "",
|
||||
"series": "STM32",
|
||||
"spi": "",
|
||||
"spiss": "D0",
|
||||
"timer": ""
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_ARDUINO=y
|
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,13 @@ ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
|||
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_2CYCLES_5
|
||||
ADC1.master=1
|
||||
ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_3
|
||||
ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,MonitoredBy-0\#ChannelRegularConversion,NbrOfConversionFlag
|
||||
ADC2.MonitoredBy-0\#ChannelRegularConversion=__NULL
|
||||
ADC2.NbrOfConversionFlag=1
|
||||
ADC2.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||
ADC2.Rank-0\#ChannelRegularConversion=1
|
||||
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_2CYCLES_5
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
|
@ -20,62 +27,75 @@ Mcu.CPN=STM32H563ZIT6
|
|||
Mcu.ContextProject=TrustZoneDisabled
|
||||
Mcu.Family=STM32H5
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=CORTEX_M33_NS
|
||||
Mcu.IP10=UCPD1
|
||||
Mcu.IP11=USART3
|
||||
Mcu.IP12=USB
|
||||
Mcu.IP2=DEBUG
|
||||
Mcu.IP3=ETH
|
||||
Mcu.IP4=ICACHE
|
||||
Mcu.IP5=LPUART1
|
||||
Mcu.IP6=NVIC
|
||||
Mcu.IP7=PWR
|
||||
Mcu.IP8=RCC
|
||||
Mcu.IP9=SYS
|
||||
Mcu.IPNb=13
|
||||
Mcu.IP1=ADC2
|
||||
Mcu.IP10=SYS
|
||||
Mcu.IP11=UCPD1
|
||||
Mcu.IP12=USART3
|
||||
Mcu.IP13=USB
|
||||
Mcu.IP2=CORTEX_M33_NS
|
||||
Mcu.IP3=DEBUG
|
||||
Mcu.IP4=ETH
|
||||
Mcu.IP5=ICACHE
|
||||
Mcu.IP6=LPUART1
|
||||
Mcu.IP7=NVIC
|
||||
Mcu.IP8=PWR
|
||||
Mcu.IP9=RCC
|
||||
Mcu.IPNb=14
|
||||
Mcu.Name=STM32H563ZITx
|
||||
Mcu.Package=LQFP144
|
||||
Mcu.Pin0=PE2
|
||||
Mcu.Pin1=PE3
|
||||
Mcu.Pin10=PC1
|
||||
Mcu.Pin11=PA1
|
||||
Mcu.Pin12=PA2
|
||||
Mcu.Pin13=PA4
|
||||
Mcu.Pin14=PA7
|
||||
Mcu.Pin15=PC4
|
||||
Mcu.Pin16=PC5
|
||||
Mcu.Pin17=PB0
|
||||
Mcu.Pin18=PB13
|
||||
Mcu.Pin19=PB14
|
||||
Mcu.Pin10=PC0
|
||||
Mcu.Pin11=PC1
|
||||
Mcu.Pin12=PC2
|
||||
Mcu.Pin13=PC3
|
||||
Mcu.Pin14=PA1
|
||||
Mcu.Pin15=PA2
|
||||
Mcu.Pin16=PA4
|
||||
Mcu.Pin17=PA6
|
||||
Mcu.Pin18=PA7
|
||||
Mcu.Pin19=PC4
|
||||
Mcu.Pin2=PE4
|
||||
Mcu.Pin20=PB15
|
||||
Mcu.Pin21=PD8
|
||||
Mcu.Pin22=PD9
|
||||
Mcu.Pin23=PG4
|
||||
Mcu.Pin24=PG7
|
||||
Mcu.Pin25=PC9
|
||||
Mcu.Pin26=PA9
|
||||
Mcu.Pin27=PA11
|
||||
Mcu.Pin28=PA12
|
||||
Mcu.Pin29=PA13(JTMS/SWDIO)
|
||||
Mcu.Pin20=PC5
|
||||
Mcu.Pin21=PB0
|
||||
Mcu.Pin22=PB1
|
||||
Mcu.Pin23=PF11
|
||||
Mcu.Pin24=PE9
|
||||
Mcu.Pin25=PE11
|
||||
Mcu.Pin26=PE13
|
||||
Mcu.Pin27=PB13
|
||||
Mcu.Pin28=PB14
|
||||
Mcu.Pin29=PB15
|
||||
Mcu.Pin3=PE5
|
||||
Mcu.Pin30=PA14(JTCK/SWCLK)
|
||||
Mcu.Pin31=PA15(JTDI)
|
||||
Mcu.Pin32=PG11
|
||||
Mcu.Pin33=PG13
|
||||
Mcu.Pin34=PB3(JTDO/TRACESWO)
|
||||
Mcu.Pin35=PB6
|
||||
Mcu.Pin36=PB7
|
||||
Mcu.Pin37=VP_ICACHE_VS_ICACHE
|
||||
Mcu.Pin38=VP_PWR_VS_SECSignals
|
||||
Mcu.Pin39=VP_SYS_VS_Systick
|
||||
Mcu.Pin30=PD8
|
||||
Mcu.Pin31=PD9
|
||||
Mcu.Pin32=PD14
|
||||
Mcu.Pin33=PD15
|
||||
Mcu.Pin34=PG4
|
||||
Mcu.Pin35=PG7
|
||||
Mcu.Pin36=PC9
|
||||
Mcu.Pin37=PA9
|
||||
Mcu.Pin38=PA11
|
||||
Mcu.Pin39=PA12
|
||||
Mcu.Pin4=PE6
|
||||
Mcu.Pin40=PA13(JTMS/SWDIO)
|
||||
Mcu.Pin41=PA14(JTCK/SWCLK)
|
||||
Mcu.Pin42=PA15(JTDI)
|
||||
Mcu.Pin43=PG11
|
||||
Mcu.Pin44=PG13
|
||||
Mcu.Pin45=PB3(JTDO/TRACESWO)
|
||||
Mcu.Pin46=PB5
|
||||
Mcu.Pin47=PB6
|
||||
Mcu.Pin48=PB7
|
||||
Mcu.Pin49=VP_ICACHE_VS_ICACHE
|
||||
Mcu.Pin5=PC13
|
||||
Mcu.Pin50=VP_PWR_VS_SECSignals
|
||||
Mcu.Pin51=VP_SYS_VS_Systick
|
||||
Mcu.Pin6=PC14-OSC32_IN(OSC32_IN)
|
||||
Mcu.Pin7=PC15-OSC32_OUT(OSC32_OUT)
|
||||
Mcu.Pin8=PF4
|
||||
Mcu.Pin9=PH0-OSC_IN(PH0)
|
||||
Mcu.PinsNb=40
|
||||
Mcu.PinsNb=52
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32H563ZITx
|
||||
|
@ -137,6 +157,8 @@ PA4.GPIOParameters=GPIO_Label
|
|||
PA4.GPIO_Label=VBUS_SENSE
|
||||
PA4.Locked=true
|
||||
PA4.Signal=ADCx_INP18
|
||||
PA6.Locked=true
|
||||
PA6.Signal=ADCx_INP3
|
||||
PA7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PA7.GPIO_Label=RMII_CRS_DV
|
||||
PA7.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
|
@ -154,6 +176,8 @@ PB0.GPIOParameters=GPIO_Label
|
|||
PB0.GPIO_Label=LED1_GREEN
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Output
|
||||
PB1.Locked=true
|
||||
PB1.Signal=ADCx_INP5
|
||||
PB13.GPIOParameters=GPIO_Label
|
||||
PB13.GPIO_Label=UCPD_CC1
|
||||
PB13.Locked=true
|
||||
|
@ -177,6 +201,8 @@ PB3(JTDO/TRACESWO).GPIO_Label=SWO
|
|||
PB3(JTDO/TRACESWO).Locked=true
|
||||
PB3(JTDO/TRACESWO).Mode=Trace_Synchro_4bits_JTAG
|
||||
PB3(JTDO/TRACESWO).Signal=DEBUG_JTDO-SWO
|
||||
PB5.Locked=true
|
||||
PB5.Signal=S_TIM3_CH2
|
||||
PB6.GPIOParameters=GPIO_Label
|
||||
PB6.GPIO_Label=ARD_D1_TX
|
||||
PB6.Locked=true
|
||||
|
@ -187,6 +213,8 @@ PB7.GPIO_Label=ARD_D0_RX
|
|||
PB7.Locked=true
|
||||
PB7.Mode=Asynchronous
|
||||
PB7.Signal=LPUART1_RX
|
||||
PC0.Locked=true
|
||||
PC0.Signal=ADCx_INP10
|
||||
PC1.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PC1.GPIO_Label=RMII_MDC
|
||||
PC1.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
|
@ -205,6 +233,9 @@ PC14-OSC32_IN(OSC32_IN).Signal=RCC_OSC32_IN
|
|||
PC15-OSC32_OUT(OSC32_OUT).Locked=true
|
||||
PC15-OSC32_OUT(OSC32_OUT).Mode=LSE-External-Oscillator
|
||||
PC15-OSC32_OUT(OSC32_OUT).Signal=RCC_OSC32_OUT
|
||||
PC2.Signal=ADCx_INP12
|
||||
PC3.Locked=true
|
||||
PC3.Signal=ADCx_INP13
|
||||
PC4.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
|
||||
PC4.GPIO_Label=RMII_RXD0
|
||||
PC4.GPIO_Mode=GPIO_MODE_AF_PP
|
||||
|
@ -223,6 +254,10 @@ PC5.Mode=RMII
|
|||
PC5.Signal=ETH_RXD1
|
||||
PC9.Mode=EnableDeadBattery
|
||||
PC9.Signal=UCPD1_DB2
|
||||
PD14.Locked=true
|
||||
PD14.Signal=S_TIM4_CH3
|
||||
PD15.Locked=true
|
||||
PD15.Signal=S_TIM4_CH4
|
||||
PD8.GPIOParameters=GPIO_Label
|
||||
PD8.GPIO_Label=T_VCP_TX
|
||||
PD8.Locked=true
|
||||
|
@ -233,6 +268,10 @@ PD9.GPIO_Label=T_VCP_RX
|
|||
PD9.Locked=true
|
||||
PD9.Mode=Asynchronous
|
||||
PD9.Signal=USART3_RX
|
||||
PE11.Locked=true
|
||||
PE11.Signal=S_TIM1_CH2
|
||||
PE13.Locked=true
|
||||
PE13.Signal=S_TIM1_CH3
|
||||
PE2.GPIOParameters=GPIO_Label
|
||||
PE2.GPIO_Label=TRACE_CK
|
||||
PE2.Locked=true
|
||||
|
@ -258,6 +297,11 @@ PE6.GPIO_Label=TRACE_D3
|
|||
PE6.Locked=true
|
||||
PE6.Mode=Trace_Synchro_4bits_JTAG
|
||||
PE6.Signal=DEBUG_TRACED3
|
||||
PE9.Locked=true
|
||||
PE9.Signal=S_TIM1_CH1
|
||||
PF11.Locked=true
|
||||
PF11.Mode=IN2-Single-Ended
|
||||
PF11.Signal=ADC1_INP2
|
||||
PF4.GPIOParameters=GPIO_Label
|
||||
PF4.GPIO_Label=LED2_YELLOW
|
||||
PF4.Locked=true
|
||||
|
@ -407,12 +451,34 @@ RCC.VCOInputFreq_Value=2000000
|
|||
RCC.VCOOutputFreq_Value=500000000
|
||||
RCC.VCOPLL2OutputFreq_Value=516000000
|
||||
RCC.VCOPLL3OutputFreq_Value=516000000
|
||||
SH.ADCx_INP10.0=ADC2_INP10,IN10-Single-Ended
|
||||
SH.ADCx_INP10.ConfNb=1
|
||||
SH.ADCx_INP12.0=ADC2_INP12,IN12-Single-Ended
|
||||
SH.ADCx_INP12.ConfNb=1
|
||||
SH.ADCx_INP13.0=ADC2_INP13,IN13-Single-Ended
|
||||
SH.ADCx_INP13.ConfNb=1
|
||||
SH.ADCx_INP18.0=ADC1_INP18,IN18-Single-Ended
|
||||
SH.ADCx_INP18.ConfNb=1
|
||||
SH.ADCx_INP3.0=ADC2_INP3,IN3-Single-Ended
|
||||
SH.ADCx_INP3.ConfNb=1
|
||||
SH.ADCx_INP5.0=ADC2_INP5,IN5-Single-Ended
|
||||
SH.ADCx_INP5.ConfNb=1
|
||||
SH.GPXTI13.0=GPIO_EXTI13
|
||||
SH.GPXTI13.ConfNb=1
|
||||
SH.GPXTI7.0=GPIO_EXTI7
|
||||
SH.GPXTI7.ConfNb=1
|
||||
SH.S_TIM1_CH1.0=TIM1_CH1
|
||||
SH.S_TIM1_CH1.ConfNb=1
|
||||
SH.S_TIM1_CH2.0=TIM1_CH2
|
||||
SH.S_TIM1_CH2.ConfNb=1
|
||||
SH.S_TIM1_CH3.0=TIM1_CH3
|
||||
SH.S_TIM1_CH3.ConfNb=1
|
||||
SH.S_TIM3_CH2.0=TIM3_CH2
|
||||
SH.S_TIM3_CH2.ConfNb=1
|
||||
SH.S_TIM4_CH3.0=TIM4_CH3
|
||||
SH.S_TIM4_CH3.ConfNb=1
|
||||
SH.S_TIM4_CH4.0=TIM4_CH4
|
||||
SH.S_TIM4_CH4.ConfNb=1
|
||||
USART3.IPParameters=VirtualMode,RxPinLevelInvertParam,OverSampling
|
||||
USART3.OverSampling=UART_OVERSAMPLING_8
|
||||
USART3.RxPinLevelInvertParam=ADVFEATURE_RXINV_ENABLE
|
||||
|
|
|
@ -47,6 +47,7 @@ ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptor
|
|||
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */
|
||||
|
||||
ADC_HandleTypeDef hadc1;
|
||||
ADC_HandleTypeDef hadc2;
|
||||
|
||||
ETH_HandleTypeDef heth;
|
||||
|
||||
|
@ -69,6 +70,7 @@ static void MX_LPUART1_UART_Init(void);
|
|||
static void MX_USART3_UART_Init(void);
|
||||
static void MX_UCPD1_Init(void);
|
||||
static void MX_USB_PCD_Init(void);
|
||||
static void MX_ADC2_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
@ -113,6 +115,7 @@ int main(void)
|
|||
MX_USART3_UART_Init();
|
||||
MX_UCPD1_Init();
|
||||
MX_USB_PCD_Init();
|
||||
MX_ADC2_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
@ -244,6 +247,65 @@ static void MX_ADC1_Init(void)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ADC2 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_ADC2_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN ADC2_Init 0 */
|
||||
|
||||
/* USER CODE END ADC2_Init 0 */
|
||||
|
||||
ADC_ChannelConfTypeDef sConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN ADC2_Init 1 */
|
||||
|
||||
/* USER CODE END ADC2_Init 1 */
|
||||
|
||||
/** Common config
|
||||
*/
|
||||
hadc2.Instance = ADC2;
|
||||
hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV2;
|
||||
hadc2.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE;
|
||||
hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
hadc2.Init.LowPowerAutoWait = DISABLE;
|
||||
hadc2.Init.ContinuousConvMode = DISABLE;
|
||||
hadc2.Init.NbrOfConversion = 1;
|
||||
hadc2.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
hadc2.Init.DMAContinuousRequests = DISABLE;
|
||||
hadc2.Init.SamplingMode = ADC_SAMPLING_MODE_NORMAL;
|
||||
hadc2.Init.Overrun = ADC_OVR_DATA_PRESERVED;
|
||||
hadc2.Init.OversamplingMode = DISABLE;
|
||||
if (HAL_ADC_Init(&hadc2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = ADC_CHANNEL_3;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_2CYCLES_5;
|
||||
sConfig.SingleDiff = ADC_SINGLE_ENDED;
|
||||
sConfig.OffsetNumber = ADC_OFFSET_NONE;
|
||||
sConfig.Offset = 0;
|
||||
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN ADC2_Init 2 */
|
||||
|
||||
/* USER CODE END ADC2_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ETH Initialization Function
|
||||
* @param None
|
||||
|
@ -539,6 +601,22 @@ static void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LED1_GREEN_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PE9 PE11 PE13 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_11|GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PD14 PD15 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : LED3_RED_Pin */
|
||||
GPIO_InitStruct.Pin = LED3_RED_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
@ -552,6 +630,14 @@ static void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(UCPD_FLT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PB5 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||
/* USER CODE END MX_GPIO_Init_2 */
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ void HAL_MspInit(void)
|
|||
/* USER CODE END MspInit 1 */
|
||||
}
|
||||
|
||||
static uint32_t HAL_RCC_ADC_CLK_ENABLED=0;
|
||||
|
||||
/**
|
||||
* @brief ADC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
|
@ -100,21 +102,81 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
|||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_ADC_CLK_ENABLE();
|
||||
HAL_RCC_ADC_CLK_ENABLED++;
|
||||
if(HAL_RCC_ADC_CLK_ENABLED==1){
|
||||
__HAL_RCC_ADC_CLK_ENABLE();
|
||||
}
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
/**ADC1 GPIO Configuration
|
||||
PA4 ------> ADC1_INP18
|
||||
PF11 ------> ADC1_INP2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = VBUS_SENSE_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(VBUS_SENSE_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC1_MspInit 1 */
|
||||
}
|
||||
else if(hadc->Instance==ADC2)
|
||||
{
|
||||
/* USER CODE BEGIN ADC2_MspInit 0 */
|
||||
|
||||
/* USER CODE END ADC2_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADCDAC;
|
||||
PeriphClkInitStruct.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_HCLK;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
HAL_RCC_ADC_CLK_ENABLED++;
|
||||
if(HAL_RCC_ADC_CLK_ENABLED==1){
|
||||
__HAL_RCC_ADC_CLK_ENABLE();
|
||||
}
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**ADC2 GPIO Configuration
|
||||
PC0 ------> ADC2_INP10
|
||||
PC2 ------> ADC2_INP12
|
||||
PC3 ------> ADC2_INP13
|
||||
PA6 ------> ADC2_INP3
|
||||
PB1 ------> ADC2_INP5
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_3;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN ADC2_MspInit 1 */
|
||||
|
||||
/* USER CODE END ADC2_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -132,17 +194,51 @@ void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
|
|||
|
||||
/* USER CODE END ADC1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_ADC_CLK_DISABLE();
|
||||
HAL_RCC_ADC_CLK_ENABLED--;
|
||||
if(HAL_RCC_ADC_CLK_ENABLED==0){
|
||||
__HAL_RCC_ADC_CLK_DISABLE();
|
||||
}
|
||||
|
||||
/**ADC1 GPIO Configuration
|
||||
PA4 ------> ADC1_INP18
|
||||
PF11 ------> ADC1_INP2
|
||||
*/
|
||||
HAL_GPIO_DeInit(VBUS_SENSE_GPIO_Port, VBUS_SENSE_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_11);
|
||||
|
||||
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC1_MspDeInit 1 */
|
||||
}
|
||||
else if(hadc->Instance==ADC2)
|
||||
{
|
||||
/* USER CODE BEGIN ADC2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END ADC2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
HAL_RCC_ADC_CLK_ENABLED--;
|
||||
if(HAL_RCC_ADC_CLK_ENABLED==0){
|
||||
__HAL_RCC_ADC_CLK_DISABLE();
|
||||
}
|
||||
|
||||
/**ADC2 GPIO Configuration
|
||||
PC0 ------> ADC2_INP10
|
||||
PC2 ------> ADC2_INP12
|
||||
PC3 ------> ADC2_INP13
|
||||
PA6 ------> ADC2_INP3
|
||||
PB1 ------> ADC2_INP5
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_3);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_6);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_1);
|
||||
|
||||
/* USER CODE BEGIN ADC2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,35 @@ config SOC_STM32H563ZI
|
|||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
config BSP_USING_ARDUINO
|
||||
bool "Compatible with Arduino Ecosystem (RTduino)"
|
||||
select PKG_USING_RTDUINO
|
||||
select BSP_USING_STLINK_TO_USART
|
||||
select BSP_USING_LPUART1
|
||||
select BSP_USING_GPIO
|
||||
# select BSP_USING_ADC
|
||||
# select BSP_USING_ADC1
|
||||
# select BSP_USING_ADC2
|
||||
# select BSP_USING_PWM
|
||||
# select BSP_USING_PWM1
|
||||
# select BSP_USING_PWM1_CH1
|
||||
# select BSP_USING_PWM1_CH2
|
||||
# select BSP_USING_PWM1_CH3
|
||||
# select BSP_USING_PWM3
|
||||
# select BSP_USING_PWM3_CH2
|
||||
# select BSP_USING_PWM4
|
||||
# select BSP_USING_PWM4_CH3
|
||||
# select BSP_USING_PWM4_CH4
|
||||
# select BSP_USING_I2C
|
||||
# select BSP_USING_I2C1
|
||||
# imply RTDUINO_USING_SERVO
|
||||
imply RTDUINO_USING_WIRE
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
|
||||
config BSP_USING_GPIO
|
||||
|
@ -21,7 +50,7 @@ menu "On-chip Peripheral Drivers"
|
|||
if BSP_USING_UART
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default y
|
||||
default n
|
||||
|
||||
config BSP_UART1_RX_USING_DMA
|
||||
bool "Enable UART1 RX DMA"
|
||||
|
@ -30,7 +59,7 @@ menu "On-chip Peripheral Drivers"
|
|||
|
||||
config BSP_USING_UART2
|
||||
bool "Enable UART2"
|
||||
default y
|
||||
default n
|
||||
|
||||
config BSP_UART2_RX_USING_DMA
|
||||
bool "Enable UART2 RX DMA"
|
||||
|
@ -56,6 +85,77 @@ menu "On-chip Peripheral Drivers"
|
|||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_ADC
|
||||
bool "Enable ADC"
|
||||
default n
|
||||
select RT_USING_ADC
|
||||
if BSP_USING_ADC
|
||||
config BSP_USING_ADC1
|
||||
bool "Enable ADC1"
|
||||
default n
|
||||
config BSP_USING_ADC2
|
||||
bool "Enable ADC2"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_PWM
|
||||
bool "Enable PWM"
|
||||
default n
|
||||
select RT_USING_PWM
|
||||
if BSP_USING_PWM
|
||||
menuconfig BSP_USING_PWM1
|
||||
bool "Enable timer1 output PWM"
|
||||
default n
|
||||
if BSP_USING_PWM1
|
||||
config BSP_USING_PWM1_CH1
|
||||
bool "Enable PWM1 channel1"
|
||||
default n
|
||||
config BSP_USING_PWM1_CH2
|
||||
bool "Enable PWM1 channel2"
|
||||
default n
|
||||
config BSP_USING_PWM1_CH3
|
||||
bool "Enable PWM1 channel3"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_PWM3
|
||||
bool "Enable timer3 output PWM"
|
||||
default n
|
||||
if BSP_USING_PWM3
|
||||
config BSP_USING_PWM3_CH2
|
||||
bool "Enable PWM3 channel2"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_PWM4
|
||||
bool "Enable timer4 output PWM"
|
||||
default n
|
||||
if BSP_USING_PWM4
|
||||
config BSP_USING_PWM4_CH3
|
||||
bool "Enable PWM4 channel3"
|
||||
default n
|
||||
config BSP_USING_PWM4_CH4
|
||||
bool "Enable PWM4 channel4"
|
||||
default n
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS (software simulation)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number (PB.8)"
|
||||
default 24
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 sda pin number (PB.9)"
|
||||
default 25
|
||||
endif
|
||||
|
||||
source "$BSP_DIR/../libraries/HAL_Drivers/drivers/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
|
Loading…
Reference in New Issue