Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lfmiao0
rt-thread
提交
1d152b18
R
rt-thread
项目概览
lfmiao0
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1d152b18
编写于
4月 07, 2019
作者:
dingo1688
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibox bsp add spi1 and fal support
上级
7d2471c4
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
239 addition
and
27 deletion
+239
-27
bsp/stm32/stm32f103-hw100k-ibox/README.md
bsp/stm32/stm32f103-hw100k-ibox/README.md
+5
-2
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/CubeMX_Config.ioc
...m32f103-hw100k-ibox/board/CubeMX_Config/CubeMX_Config.ioc
+39
-23
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/Src/main.c
...tm32/stm32f103-hw100k-ibox/board/CubeMX_Config/Src/main.c
+41
-0
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
...3-hw100k-ibox/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
+49
-2
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
+46
-0
bsp/stm32/stm32f103-hw100k-ibox/board/SConscript
bsp/stm32/stm32f103-hw100k-ibox/board/SConscript
+3
-0
bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h
bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h
+34
-0
bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c
...32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c
+22
-0
未找到文件。
bsp/stm32/stm32f103-hw100k-ibox/README.md
浏览文件 @
1d152b18
...
...
@@ -41,8 +41,8 @@
|
**板载外设**
|
**支持情况**
|
**备注**
|
| :----------------- | :----------: | :------------------------------------- |
| 以太网 | 支持 | W5500 使用 SPI2 |
| RS485 | 支持 |
使用 UART4 |
| LoRa |
暂不支持 | 使用 SPI1 LSD4RF
|
| RS485 | 支持 |
MAX485
使用 UART4 |
| LoRa |
支持 | 利尔达 LSD4RF-2F717N30 使用 SPI1
|
|
**片上外设**
|
**支持情况**
|
**备注**
|
| GPIO | 支持 | PA0, PA1... PG15 ---> PIN: 0, 1...144 |
| UART | 支持 | UART1 |
...
...
@@ -52,6 +52,7 @@
| ADC | 支持 | ADC1_CHANEL_10, ADC1_CHANNEL_11 |
| PWM | 暂不支持 | |
| IWG | 支持 | 命令:iwdg_sample wdt |
| FLASH | 支持 | 已适配 FAL |
|
**扩展模块**
|
**支持情况**
|
**备注**
|
| WIFI ESP8266 | 支持 | 硬十 ESP-02 使用 UART3 |
...
...
@@ -114,6 +115,8 @@ msh >
-
此开发板外部高速晶振是 12MHz ;
-
使用 WIFI ESP8266 , 需将 CH_PD (PG1) 引脚拉高 ;
-
使用 W5500,需插上网线 ;
-
测试 Lora 模块,可直接使用 sx12xx 软件包 ;
-
使用 MAX485, 可使用 软件包中 串口例程,增加收发使能引脚的控制 ;
## 联系人信息
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/CubeMX_Config.ioc
浏览文件 @
1d152b18
...
...
@@ -10,41 +10,45 @@ KeepUser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
A6
Mcu.PinsNb=2
5
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103ZETx
...
...
@@ -74,6 +78,12 @@ PA2.Mode=Asynchronous
PA2.Signal=USART2_TX
PA3.Mode=Asynchronous
PA3.Signal=USART2_RX
PA5.Mode=Full_Duplex_Master
PA5.Signal=SPI1_SCK
PA6.Mode=Full_Duplex_Master
PA6.Signal=SPI1_MISO
PA7.Mode=Full_Duplex_Master
PA7.Signal=SPI1_MOSI
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
PB10.Mode=Asynchronous
...
...
@@ -132,7 +142,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_RTC_Init-RTC-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_IWDG_Init-IWDG-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_SPI2_Init-SPI2-false-HAL-true,9-MX_UART4_Init-UART4-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_RTC_Init-RTC-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_IWDG_Init-IWDG-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,8-MX_SPI2_Init-SPI2-false-HAL-true,9-MX_UART4_Init-UART4-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true
,11-MX_SPI1_Init-SPI1-false-HAL-true
RCC.ADCFreqValue=12000000
RCC.ADCPresc=RCC_ADCPCLK2_DIV6
RCC.AHBFreq_Value=72000000
...
...
@@ -167,6 +177,12 @@ SH.ADCx_IN10.0=ADC1_IN10,IN10
SH.ADCx_IN10.ConfNb=1
SH.ADCx_IN11.0=ADC1_IN11,IN11
SH.ADCx_IN11.ConfNb=1
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_8
SPI1.CalculateBaudRate=9.0 MBits/s
SPI1.Direction=SPI_DIRECTION_2LINES
SPI1.IPParameters=VirtualType,Mode,Direction,BaudRatePrescaler,CalculateBaudRate
SPI1.Mode=SPI_MODE_MASTER
SPI1.VirtualType=VM_MASTER
SPI2.CalculateBaudRate=18.0 MBits/s
SPI2.Direction=SPI_DIRECTION_2LINES
SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/Src/main.c
浏览文件 @
1d152b18
...
...
@@ -68,6 +68,7 @@ IWDG_HandleTypeDef hiwdg;
RTC_HandleTypeDef
hrtc
;
SPI_HandleTypeDef
hspi1
;
SPI_HandleTypeDef
hspi2
;
UART_HandleTypeDef
huart4
;
...
...
@@ -90,6 +91,7 @@ static void MX_USART3_UART_Init(void);
static
void
MX_SPI2_Init
(
void
);
static
void
MX_UART4_Init
(
void
);
static
void
MX_USART2_UART_Init
(
void
);
static
void
MX_SPI1_Init
(
void
);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
...
...
@@ -135,6 +137,7 @@ int main(void)
MX_SPI2_Init
();
MX_UART4_Init
();
MX_USART2_UART_Init
();
MX_SPI1_Init
();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
...
...
@@ -301,6 +304,44 @@ static void MX_RTC_Init(void)
}
/**
* @brief SPI1 Initialization Function
* @param None
* @retval None
*/
static
void
MX_SPI1_Init
(
void
)
{
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE END SPI1_Init 0 */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE END SPI1_Init 1 */
/* SPI1 parameter configuration*/
hspi1
.
Instance
=
SPI1
;
hspi1
.
Init
.
Mode
=
SPI_MODE_MASTER
;
hspi1
.
Init
.
Direction
=
SPI_DIRECTION_2LINES
;
hspi1
.
Init
.
DataSize
=
SPI_DATASIZE_8BIT
;
hspi1
.
Init
.
CLKPolarity
=
SPI_POLARITY_LOW
;
hspi1
.
Init
.
CLKPhase
=
SPI_PHASE_1EDGE
;
hspi1
.
Init
.
NSS
=
SPI_NSS_SOFT
;
hspi1
.
Init
.
BaudRatePrescaler
=
SPI_BAUDRATEPRESCALER_8
;
hspi1
.
Init
.
FirstBit
=
SPI_FIRSTBIT_MSB
;
hspi1
.
Init
.
TIMode
=
SPI_TIMODE_DISABLE
;
hspi1
.
Init
.
CRCCalculation
=
SPI_CRCCALCULATION_DISABLE
;
hspi1
.
Init
.
CRCPolynomial
=
10
;
if
(
HAL_SPI_Init
(
&
hspi1
)
!=
HAL_OK
)
{
Error_Handler
();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE END SPI1_Init 2 */
}
/**
* @brief SPI2 Initialization Function
* @param None
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c
浏览文件 @
1d152b18
...
...
@@ -226,7 +226,35 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
{
GPIO_InitTypeDef
GPIO_InitStruct
=
{
0
};
if
(
hspi
->
Instance
==
SPI2
)
if
(
hspi
->
Instance
==
SPI1
)
{
/* USER CODE BEGIN SPI1_MspInit 0 */
/* USER CODE END SPI1_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SPI1_CLK_ENABLE
();
__HAL_RCC_GPIOA_CLK_ENABLE
();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
GPIO_InitStruct
.
Pin
=
GPIO_PIN_5
|
GPIO_PIN_7
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_AF_PP
;
GPIO_InitStruct
.
Speed
=
GPIO_SPEED_FREQ_HIGH
;
HAL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
GPIO_InitStruct
.
Pin
=
GPIO_PIN_6
;
GPIO_InitStruct
.
Mode
=
GPIO_MODE_INPUT
;
GPIO_InitStruct
.
Pull
=
GPIO_NOPULL
;
HAL_GPIO_Init
(
GPIOA
,
&
GPIO_InitStruct
);
/* USER CODE BEGIN SPI1_MspInit 1 */
/* USER CODE END SPI1_MspInit 1 */
}
else
if
(
hspi
->
Instance
==
SPI2
)
{
/* USER CODE BEGIN SPI2_MspInit 0 */
...
...
@@ -267,7 +295,26 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
void
HAL_SPI_MspDeInit
(
SPI_HandleTypeDef
*
hspi
)
{
if
(
hspi
->
Instance
==
SPI2
)
if
(
hspi
->
Instance
==
SPI1
)
{
/* USER CODE BEGIN SPI1_MspDeInit 0 */
/* USER CODE END SPI1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_SPI1_CLK_DISABLE
();
/**SPI1 GPIO Configuration
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
*/
HAL_GPIO_DeInit
(
GPIOA
,
GPIO_PIN_5
|
GPIO_PIN_6
|
GPIO_PIN_7
);
/* USER CODE BEGIN SPI1_MspDeInit 1 */
/* USER CODE END SPI1_MspDeInit 1 */
}
else
if
(
hspi
->
Instance
==
SPI2
)
{
/* USER CODE BEGIN SPI2_MspDeInit 0 */
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
浏览文件 @
1d152b18
...
...
@@ -35,6 +35,49 @@ menu "Onboard Peripheral Drivers"
hex
default 0x00
endif
config BSP_USING_LORA
bool "Enable LoRa Driver (spi1)"
default n
select PKG_USING_SX12XX
select SX12XX_DEVICE_EXTERN_CONFIG
select BSP_USING_SPI1
if BSP_USING_LORA
if SX12XX_DEVICE_EXTERN_CONFIG
config SX12XX_SPI_DEVICE
string "SPI device name"
default "spi10"
config SX12XX_RST_PIN
int "Reset PIN number"
default 7
config SX12XX_DO0_PIN
int "DO0 PIN number"
default 103
config SX12XX_DO1_PIN
int "DO1 PIN number"
default 104
config SX12XX_DO2_PIN
int "DO2 PIN number"
default 105
config SX12XX_DO3_PIN
int "DO3 PIN number"
default 106
config SX12XX_DO4_PIN
int "DO4 PIN number"
default 107
config SX12XX_DO5_PIN
int "DO5 PIN number"
default 108
endif
endif
endmenu
...
...
@@ -84,6 +127,9 @@ menu "On-chip Peripheral Drivers"
bool "Enable UART4 RX DMA"
depends on BSP_USING_UART4 && RT_SERIAL_USING_DMA
endif
config BSP_USING_ON_CHIP_FLASH
bool "Enable on-chip FLASH"
default n
menuconfig BSP_USING_I2C1
bool "Enable I2C1 BUS (software simulation)"
default n
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/SConscript
浏览文件 @
1d152b18
...
...
@@ -16,6 +16,9 @@ if GetDepend(['BSP_USING_ETH']):
if
GetDepend
([
'BSP_USING_WIFI_OR_GPRS'
]):
src
+=
Glob
(
'ports/esp02_device.c'
)
if
GetDepend
([
'BSP_USING_ON_CHIP_FLASH'
]):
src
+=
Glob
(
'ports/on_chip_flash_init.c'
)
path
=
[
cwd
]
path
+=
[
cwd
+
'/CubeMX_Config/Inc'
]
path
+=
[
cwd
+
'/ports'
]
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h
0 → 100644
浏览文件 @
1d152b18
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-12-5 SummerGift first version
*/
#ifndef _FAL_CFG_H_
#define _FAL_CFG_H_
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 496 * 1024, 0}, \
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 496* 1024 , 16 * 1024, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c
0 → 100644
浏览文件 @
1d152b18
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-11-27 SummerGift add spi flash port file
*/
#include <rtthread.h>
#include "fal.h"
#if defined(BSP_USING_ON_CHIP_FLASH)
static
int
rt_hw_on_chip_flash_init
(
void
)
{
fal_init
();
return
RT_EOK
;
}
INIT_COMPONENT_EXPORT
(
rt_hw_on_chip_flash_init
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录