mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-06-13 04:33:18 +08:00
Add RTC device
This commit is contained in:
@@ -38,6 +38,9 @@ if GetDepend(['BSP_USING_SPI']):
|
||||
if GetDepend(['BSP_USING_ADC']):
|
||||
src += ['drv_adc.c']
|
||||
|
||||
if GetDepend('BSP_USING_RTC'):
|
||||
src += ['drv_rtc.c']
|
||||
|
||||
if GetDepend(['RT_USING_WDT']):
|
||||
src += ['drv_wdt.c']
|
||||
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-07-25 Rbb666 first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <sys/time.h>
|
||||
#include "drv_common.h"
|
||||
|
||||
#ifdef BSP_USING_RTC
|
||||
|
||||
//#define DRV_DEBUG
|
||||
#define LOG_TAG "drv.rtc"
|
||||
#include <drv_log.h>
|
||||
|
||||
cyhal_rtc_t rtc_obj;
|
||||
|
||||
static rt_rtc_dev_t ifx32_rtc_dev;
|
||||
|
||||
static int get_day_of_week(int day, int month, int year)
|
||||
{
|
||||
int ret;
|
||||
int k = 0;
|
||||
int j = 0;
|
||||
if (month < CY_RTC_MARCH)
|
||||
{
|
||||
month += CY_RTC_MONTHS_PER_YEAR;
|
||||
year--;
|
||||
}
|
||||
|
||||
k = (year % 100);
|
||||
j = (year / 100);
|
||||
ret = (day + (13 * (month + 1) / 5) + k + (k / 4) + (j / 4) + (5 * j)) % 7;
|
||||
ret = ((ret + 6) % 7);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static rt_err_t set_rtc_time_stamp(time_t time_stamp)
|
||||
{
|
||||
struct tm tm = {0};
|
||||
struct tm new_time = {0};
|
||||
|
||||
gmtime_r(&time_stamp, &tm);
|
||||
if (tm.tm_year < 100)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
new_time.tm_sec = tm.tm_sec ;
|
||||
new_time.tm_min = tm.tm_min ;
|
||||
new_time.tm_hour = tm.tm_hour;
|
||||
new_time.tm_mday = tm.tm_mday;
|
||||
new_time.tm_mon = tm.tm_mon;
|
||||
new_time.tm_year = tm.tm_year;
|
||||
new_time.tm_wday = get_day_of_week(tm.tm_mday, tm.tm_mon, tm.tm_year);
|
||||
|
||||
if (cyhal_rtc_write(&rtc_obj, &new_time) != RT_EOK)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
LOG_D("set rtc time.");
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t ifx_rtc_get_timeval(struct timeval *tv)
|
||||
{
|
||||
struct tm tm_new = {0};
|
||||
struct tm date_time = {0};
|
||||
|
||||
cyhal_rtc_read(&rtc_obj, &date_time);
|
||||
|
||||
tm_new.tm_sec = date_time.tm_sec;
|
||||
tm_new.tm_min = date_time.tm_min;
|
||||
tm_new.tm_hour = date_time.tm_hour;
|
||||
tm_new.tm_mday = date_time.tm_mday;
|
||||
tm_new.tm_mon = date_time.tm_mon;
|
||||
tm_new.tm_year = date_time.tm_year;
|
||||
|
||||
tv->tv_sec = timegm(&tm_new);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t _rtc_init(void)
|
||||
{
|
||||
if (cyhal_rtc_init(&rtc_obj) != RT_EOK)
|
||||
{
|
||||
LOG_E("rtc init failed.");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t _rtc_get_secs(time_t *sec)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
ifx_rtc_get_timeval(&tv);
|
||||
*(time_t *) sec = tv.tv_sec;
|
||||
LOG_D("RTC: get rtc_time %d", *sec);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t _rtc_set_secs(time_t *sec)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
|
||||
if (set_rtc_time_stamp(*sec))
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
}
|
||||
LOG_D("RTC: set rtc_time %d", *sec);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static const struct rt_rtc_ops _rtc_ops =
|
||||
{
|
||||
_rtc_init,
|
||||
_rtc_get_secs,
|
||||
_rtc_set_secs,
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
ifx_rtc_get_timeval,
|
||||
RT_NULL,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief RTC initialization function.
|
||||
*
|
||||
* @return RT_EOK indicates successful initialization, other value indicates failed;
|
||||
*/
|
||||
static int rt_hw_rtc_init(void)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
|
||||
ifx32_rtc_dev.ops = &_rtc_ops;
|
||||
|
||||
if (rt_hw_rtc_register(&ifx32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL) != RT_EOK)
|
||||
{
|
||||
LOG_E("rtc init failed");
|
||||
result = RT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_D("rtc init success");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(rt_hw_rtc_init);
|
||||
#endif
|
||||
@@ -67,7 +67,6 @@ static void uart_isr(struct rt_serial_device *serial)
|
||||
struct ifx_uart *uart = (struct ifx_uart *) serial->parent.user_data;
|
||||
RT_ASSERT(uart != RT_NULL);
|
||||
|
||||
#ifdef BSP_USING_UART5
|
||||
if ((uart->config->usart_x->INTR_RX_MASKED & SCB_INTR_RX_MASKED_NOT_EMPTY_Msk) != 0)
|
||||
{
|
||||
/* Clear UART "RX fifo not empty interrupt" */
|
||||
@@ -75,7 +74,6 @@ static void uart_isr(struct rt_serial_device *serial)
|
||||
|
||||
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BSP_USING_UART0
|
||||
@@ -162,16 +160,28 @@ void uart5_isr_callback(void)
|
||||
*/
|
||||
static rt_err_t ifx_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
struct ifx_uart *uart = (struct ifx_uart *) serial->parent.user_data;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
struct ifx_uart *uart = (struct ifx_uart *) serial->parent.user_data;
|
||||
RT_ASSERT(uart != RT_NULL);
|
||||
|
||||
cy_en_scb_uart_status_t result;
|
||||
|
||||
const cyhal_uart_cfg_t uart_config =
|
||||
{
|
||||
.data_bits = 8,
|
||||
.stop_bits = 1,
|
||||
.parity = CYHAL_UART_PARITY_NONE,
|
||||
.rx_buffer = NULL,
|
||||
.rx_buffer_size = 0
|
||||
};
|
||||
|
||||
/* Initialize retarget-io to use the debug UART port */
|
||||
result = cy_retarget_io_init(uart->config->tx_pin, uart->config->rx_pin,
|
||||
CY_RETARGET_IO_BAUDRATE);
|
||||
result = cyhal_uart_init(uart->config->uart_obj, uart->config->tx_pin, uart->config->rx_pin, NC, NC, NULL, &uart_config);
|
||||
|
||||
if (result == CY_RSLT_SUCCESS)
|
||||
{
|
||||
result = cyhal_uart_set_baud(uart->config->uart_obj, cfg->baud_rate, NULL);
|
||||
}
|
||||
|
||||
RT_ASSERT(result != RT_ERROR);
|
||||
|
||||
@@ -229,10 +239,13 @@ static int ifx_uarths_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch;
|
||||
rt_uint8_t read_data;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
struct ifx_uart *uart = (struct ifx_uart *) serial->parent.user_data;
|
||||
RT_ASSERT(uart != RT_NULL);
|
||||
|
||||
ch = -1;
|
||||
if (RT_EOK == cyhal_uart_getc(&cy_retarget_io_uart_obj, (uint8_t *)&read_data, 1))
|
||||
if (RT_EOK == cyhal_uart_getc(uart->config->uart_obj, (uint8_t *)&read_data, 1))
|
||||
{
|
||||
ch = read_data & 0xff;
|
||||
}
|
||||
@@ -258,15 +271,17 @@ void rt_hw_uart_init(void)
|
||||
int index;
|
||||
|
||||
rt_size_t obj_num = sizeof(uart_obj) / sizeof(struct ifx_uart);
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
struct serial_configure serial_config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
rt_err_t result = 0;
|
||||
|
||||
for (index = 0; index < obj_num; index++)
|
||||
{
|
||||
uart_obj[index].config = &uart_config[index];
|
||||
uart_obj[index].serial.ops = &_uart_ops;
|
||||
uart_obj[index].serial.config = config;
|
||||
uart_obj[index].serial.config = serial_config;
|
||||
|
||||
uart_obj[index].config->uart_obj = rt_malloc(sizeof(cyhal_uart_t));
|
||||
RT_ASSERT(uart_obj[index].config->uart_obj != RT_NULL);
|
||||
/* register uart device */
|
||||
result = rt_hw_serial_register(&uart_obj[index].serial,
|
||||
uart_obj[index].config->name,
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
struct ifx_uart_config
|
||||
{
|
||||
cyhal_uart_t *uart_obj;
|
||||
|
||||
const char *name;
|
||||
rt_uint32_t tx_pin;
|
||||
rt_uint32_t rx_pin;
|
||||
|
||||
@@ -95,6 +95,10 @@ if GetDepend(['RT_USING_SPI']):
|
||||
if GetDepend(['RT_USING_I2C']):
|
||||
src += ['mtb-hal-cat1/source/cyhal_i2c.c']
|
||||
|
||||
if GetDepend('BSP_USING_RTC'):
|
||||
src += ['mtb-pdl-cat1/drivers/source/cy_rtc.c']
|
||||
src += ['mtb-hal-cat1/source/cyhal_rtc.c']
|
||||
|
||||
if GetDepend(['RT_USING_WDT']):
|
||||
src += ['mtb-pdl-cat1/drivers/source/cy_wdt.c']
|
||||
src += ['mtb-hal-cat1/source/cyhal_wdt.c']
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2021 Cypress Semiconductor Corporation (an Infineon company) or
|
||||
* an affiliate of Cypress Semiconductor Corporation
|
||||
*
|
||||
* Copyright 2018-2021 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -72,6 +70,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \cond INTERNAL */
|
||||
/** Generate a result code specific to the HAL driver */
|
||||
#define CYHAL_RSLT_CREATE(type, driver, code) \
|
||||
(CY_RSLT_CREATE(type, CY_RSLT_MODULE_ABSTRACTION_HAL, ((uint16_t)driver | (uint16_t)code)))
|
||||
/** \endcond */
|
||||
|
||||
/** \addtogroup group_hal_results_rtc RTC HAL Results
|
||||
* RTC specific return codes
|
||||
* \ingroup group_hal_results
|
||||
@@ -80,10 +84,10 @@ extern "C" {
|
||||
|
||||
/** RTC not initialized */
|
||||
#define CY_RSLT_RTC_NOT_INITIALIZED \
|
||||
(CY_RSLT_CREATE_EX(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_HAL, CYHAL_RSLT_MODULE_RTC, 0))
|
||||
(CYHAL_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_RTC, 0))
|
||||
/** Bad argument */
|
||||
#define CY_RSLT_RTC_BAD_ARGUMENT \
|
||||
(CY_RSLT_CREATE_EX(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_HAL, CYHAL_RSLT_MODULE_RTC, 1))
|
||||
(CYHAL_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_RTC, 1))
|
||||
|
||||
/**
|
||||
* \}
|
||||
@@ -145,23 +149,6 @@ typedef struct
|
||||
typedef void (*cyhal_rtc_event_callback_t)(void *callback_arg, cyhal_rtc_event_t event);
|
||||
|
||||
/** Initialize the RTC peripheral
|
||||
*
|
||||
* Power up the RTC in preparation for access. This function must be called
|
||||
* before any other RTC functions are called. This does not change the state
|
||||
* of the RTC. It just enables access to it.
|
||||
* @note Before calling this, make sure all necessary System Clocks are setup
|
||||
* correctly. Generally this means making sure the RTC has access to a crystal
|
||||
* oscillator for optimal accuracy and operation in low power.
|
||||
* @note Previously set time configurations are retained. This will only reset
|
||||
* the time if no prior configuration can be determined.
|
||||
*
|
||||
* @param[out] obj Pointer to an RTC object. The caller must allocate the memory
|
||||
* for this object but the init function will initialize its contents.
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_rtc_init(cyhal_rtc_t *obj);
|
||||
|
||||
/** Initialize the RTC peripheral using a configurator generated configuration struct
|
||||
*
|
||||
* Power up the RTC in preparation for access. This function must be called
|
||||
* before any other RTC functions are called. This does not change the state
|
||||
@@ -174,10 +161,9 @@ cy_rslt_t cyhal_rtc_init(cyhal_rtc_t *obj);
|
||||
*
|
||||
* @param[out] obj Pointer to an RTC object. The caller must allocate the memory
|
||||
* for this object but the init function will initialize its contents.
|
||||
* @param[in] cfg Configuration structure generated by a configurator.
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_rtc_init_cfg(cyhal_rtc_t *obj, const cyhal_rtc_configurator_t *cfg);
|
||||
cy_rslt_t cyhal_rtc_init(cyhal_rtc_t *obj);
|
||||
|
||||
/** Deinitialize RTC
|
||||
*
|
||||
@@ -213,25 +199,7 @@ cy_rslt_t cyhal_rtc_read(cyhal_rtc_t *obj, struct tm *time);
|
||||
*/
|
||||
cy_rslt_t cyhal_rtc_write(cyhal_rtc_t *obj, const struct tm *time);
|
||||
|
||||
/** Write the specified time and date values to the RTC peripheral
|
||||
* @param[in] obj RTC object
|
||||
* @param[in] sec Second to set (0-59)
|
||||
* @param[in] min Minute to set (0-59)
|
||||
* @param[in] hour Hour to set (0-23)
|
||||
* @param[in] day Day of month to set (1-31)
|
||||
* @param[in] month Month to set (1-12)
|
||||
* @param[in] year 4-digit year to set
|
||||
* @return The status of the write request
|
||||
*/
|
||||
cy_rslt_t cyhal_rtc_write_direct(cyhal_rtc_t *obj, uint32_t sec, uint32_t min, uint32_t hour,
|
||||
uint32_t day, uint32_t month, uint32_t year);
|
||||
|
||||
/** Set the start and end time for Day Light Savings
|
||||
*
|
||||
* Calling this function will allow alarms to account for daylight saving time.
|
||||
* This means that the RTC will be adjusted when a daylight saving time
|
||||
* transition occurs, meaning times passed to \ref cyhal_rtc_set_alarm()
|
||||
* will be interpreted as being in DST/not in DST as appropriate.
|
||||
*
|
||||
* @param[in] obj RTC object
|
||||
* @param[in] start When Day Light Savings time should start
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
# Cypress CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit 说明
|
||||
# Cypress Psoc6-CY8CKIT-062S2-43012 说明
|
||||
|
||||
## 简介
|
||||
|
||||
本文档为Cypress为PSoC6 BLE Pioneer Kit开发板提供的 BSP (板级支持包) 说明。
|
||||
本文档为 `RT-Thread` 为 `PSoC6 CY8CKIT-062S2-43012`开发板提供的 BSP (板级支持包) 说明。
|
||||
|
||||
主要内容如下:
|
||||
|
||||
@@ -10,89 +10,91 @@
|
||||
- BSP 快速上手
|
||||
- 进阶使用方法
|
||||
|
||||
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
|
||||
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 `RT-Thread` 驱动更多板载资源。
|
||||
|
||||
## 开发板介绍
|
||||
|
||||
CY8CKIT-062-BLE PSoC6 BLE Pioneer Kit 是赛普拉斯推出的一款32位双核CPU子系统( ARM Cortex-M4 和 ARM Cortex-M0)的开发板,具有单周期乘法的150-MHz Arm Cortex-M4F CPU (浮点和
|
||||
存储器保护单元),100-MHz Cortex M0+ CPU,带单周期乘法和MPU,可以充分发挥 PSoC6 双核芯片性能。
|
||||
`PSoC6 CY8CKIT-062S2-43012` 是赛普拉斯推出的一款32位双核CPU子系统( ARM Cortex-M4 和 ARM Cortex-M0)的开发板,具有单周期乘法的150-MHz Arm Cortex-M4F CPU (浮点和存储器保护单元),100-MHz Cortex M0+ CPU,带单周期乘法和MPU,可以充分发挥 PSoC6 双核芯片性能。
|
||||
|
||||
开发板外观详细信息:https://www.cypress.com/file/390496/download
|
||||
开发板外观详细信息:[CY8CPROTO-062-4343W - Infineon Technologies](https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/)
|
||||
|
||||
该开发板核心 **板载资源** 如下:
|
||||
|
||||
该开发板常用 **板载资源** 如下:
|
||||
|
||||
- MCU:CY8C6347BZI-BLD53,Cortex-M4主频 150MHz,Cortex-M0主频 100MHz,1 MB 应用闪存,32 KB EEPROM 区域和32 KB 安全闪存 ,288 KB 集成SRAM
|
||||
MCU手册更多详细信息请参考文档 https://www.cypress.com/file/457541/download
|
||||
|
||||
- 开发环境:ModusToolbox 2.0
|
||||
PSoC® Creator™ 下载链接 https://www.cypress.com/products/modustoolbox-software-environment
|
||||
|
||||
- MCU:CY8C624ABZI-S2D44,Cortex-M4主频 150MHz,Cortex-M0主频 100MHz,2MB Flash 和 1MB SRAM
|
||||
MCU手册更多详细信息请参考文档 [PSoC 6 MCU: CY8C62x8, CY8C62xA Datasheet (infineon.com)](https://www.infineon.com/dgdl/Infineon-PSOC_6_MCU_CY8C62X8_CY8C62XA-DataSheet-v17_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee7d03a70b1)
|
||||
- 板载资源:microSD card , 64-Mb Quad-SPI NOR flash, CYW43012 Wi-Fi + Bluetooth Combo Chip
|
||||
- 开发环境:ModusToolbox 2.0/MDK V5
|
||||
PSoC® Creator™ 下载链接 [ModusToolbox™ Software - Infineon Technologies](https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/)
|
||||
- 开发板:CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit
|
||||
开发板更多详细信息请参考文档 https://www.cypress.com/file/390496/download
|
||||
|
||||
|
||||
## 外设支持
|
||||
|
||||
本 BSP 目前对外设的支持情况详细信息请参考文档 https://www.cypress.com/file/390496/download
|
||||
本 BSP 目前对外设的支持情况如下:
|
||||
|
||||
| **片上外设** | **支持情况** | **备注** |
|
||||
| :----------: | :----------: | :-----------: |
|
||||
| USB 转串口 | 支持 | — |
|
||||
| GPIO | 支持 | — |
|
||||
| UART | 支持 | UART0-5 |
|
||||
| I2C | 支持 | 软件+硬件 I2C |
|
||||
| RTC | 支持 | — |
|
||||
| WDT | 支持 | — |
|
||||
| PWM | 支持 | — |
|
||||
| SPI | 支持 | — |
|
||||
| HardTimer | 暂不支持 | — |
|
||||
| DAC | 暂不支持 | — |
|
||||
| Flash | 暂不支持 | — |
|
||||
| SDIO | 暂不支持 | — |
|
||||
| USB Device | 暂不支持 | — |
|
||||
| USB Host | 暂不支持 | — |
|
||||
|
||||
## 使用说明
|
||||
|
||||
使用说明分为如下两个章节:
|
||||
|
||||
- 快速上手
|
||||
|
||||
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
|
||||
|
||||
- 进阶使用
|
||||
|
||||
本章节是为需要在 RT-Thread 操作系统上使用赛普拉斯开发板资源的开发者准备的。
|
||||
|
||||
|
||||
### 快速上手
|
||||
|
||||
本 BSP 以 ModusToolbox 2.0开发环境(GCC),介绍如何将系统运行起来。
|
||||
本 BSP 是以 MDK V5 开发环境(编译器:ARMClang ),接下来介绍如何将系统运行起来。
|
||||
|
||||
#### 硬件连接
|
||||
|
||||
使用Type-C数据线连接开发板到 PC.
|
||||
使用数据线连接开发板到 PC。
|
||||
|
||||
#### 编译下载
|
||||
1, 安装ModusToolbox 2.0时请使用默认路径
|
||||
|
||||
2, 打开ModusToolbox 2.0时workspace选择工程所在目录下(例如workspace: C:\Git\rt-thread\bsp\cypress)
|
||||
1、配置工程:
|
||||
|
||||
3, 在Project Explorer的空白处右键,点击import,General->Existing Projects into Workspace ->next,点击Browse选择
|
||||
此BSP所在目录加载工程->Finish
|
||||
首先打开 MDK ,若没有安装 `Cypress-PSoC6` 的芯片支持包会提示在线安装,根据提示安装即可。若受网络问题,可以进入 [keil](https://www.keil.com/dd2/pack) 官网下载安装包,离线安装。
|
||||
|
||||
4, 下载lib:在左下角Quick Panel的Tools栏,点击library Manager-> BSPs下面勾选CY8CKIT-062-BLE (若已勾选可以不用再选)
|
||||
-> Libraries里PSoC6 Base Libraries下面全部勾选core-lib,psoc6cm0p,psoc6hal,psoc6make,psoc6pdl -> 点击apply 进行下载
|
||||

|
||||
|
||||
5, 编译此工程
|
||||
2、 编译此工程:在安装好芯片支持包后,在 `MDK`工程中进行编译。
|
||||
|
||||
6, 下载此工程
|
||||
3、下载此工程:
|
||||
|
||||
|
||||
工程默认配置使用 SWD方式下载程序,Type-C数据线连接开发板,编译之后直接点击下载按钮即可。
|
||||
工程默认配置使用板载 `DAP-LINK` 使用 `SWD` 方式下载程序,使用数据线连接开发板,编译之后直接点击下载按钮即可。
|
||||
|
||||
#### 运行结果
|
||||
|
||||
下载程序成功之后,系统会自动运行。打开终端工具串口小助手,复位设备后,可以看到 RT-Thread 的输出信息:
|
||||
下载程序成功之后,系统会自动运行。打开终端工具串口助手,选择波特率为 115200。复位设备后,LED 将会以 500HZ 的频率闪烁,而且在终端上可以看到 `RT-Thread` 的输出信息:
|
||||
|
||||
注:推荐使用串口调试助手如:sscom
|
||||
注:推荐使用串口调试助手如:`MobaXterm`
|
||||
|
||||
```
|
||||
|
||||
\ | /
|
||||
- RT - Thread Operating System
|
||||
/ | \ 4.0.3 build Jan 6 2020
|
||||
2006 - 2019 Copyright by rt-thread team
|
||||
hello rt-thread
|
||||
msh >hello rt-thread
|
||||
hello rt-thread
|
||||
```
|
||||
/ | \ 4.1.1 build Jul 25 2022 18:03:35
|
||||
2006 - 2022 Copyright by RT-Thread team
|
||||
msh >
|
||||
```
|
||||
|
||||
## 联系人信息
|
||||
|
||||
维护人:
|
||||
|
||||
- [amyqian379](https://github.com/amyqian379)
|
||||
- [Rbb666](https://github.com/Rbb666)
|
||||
@@ -196,6 +196,23 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
select RT_USING_RTC
|
||||
default n
|
||||
if BSP_USING_RTC
|
||||
choice
|
||||
prompt "Select clock source"
|
||||
default BSP_RTC_USING_LSE
|
||||
|
||||
config BSP_RTC_USING_LSE
|
||||
bool "RTC USING LSE"
|
||||
|
||||
config BSP_RTC_USING_LSI
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
config BSP_USING_WDT
|
||||
bool "Enable Watchdog Timer"
|
||||
select RT_USING_WDT
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Reference in New Issue
Block a user