时钟修改
This commit is contained in:
1 parent
f751863707
commit
c7cf944e61
12 files changed
+236
-135
No files matched your search
@@ -236,7 +236,7 @@
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders" />
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/project" />
|
||||
<resource resourceType="PROJECT" workspacePath="/828F" />
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>project</name>
|
||||
<name>828F</name>
|
||||
<comment />
|
||||
<projects>
|
||||
</projects>
|
||||
|
||||
+79
-60
@@ -7,30 +7,40 @@
|
||||
* Date Author Notes
|
||||
* 2025-10-20 Administrator the first version
|
||||
* 2025-11-12 Modified Switch to IDLE interrupt mode (no DMA, no ringbuffer)
|
||||
* 2025-11-21 Fixed Enable RX_IDLE mode correctly for RT-Thread 5.1
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <drivers/serial.h> // ← 显式包含,确保 RT_SERIAL_EVENT_RX_IDLE 可见
|
||||
#include "data_comm.h"
|
||||
|
||||
#define DBG_TAG "SCCM_link"
|
||||
#define DBG_LVL DBG_LOG
|
||||
#include <rtdbg.h>
|
||||
|
||||
#define SAMPLE_UART_NAME "uart1"
|
||||
#define RX_LINE_BUF_SIZE 1024 // 假设 MAX_INPUT_LEN 已定义,如 256
|
||||
#define RX_LINE_BUF_SIZE 1024
|
||||
|
||||
static rt_device_t serial;
|
||||
static struct rt_semaphore rx_sem;
|
||||
|
||||
// 接收回调:注意 size 实际是事件指针(RT-Thread 特性)
|
||||
// 接收回调
|
||||
static rt_err_t uart_rx_ind(rt_device_t dev, rt_size_t size)
|
||||
{
|
||||
rt_uint32_t event = *(rt_uint32_t *)&size; // 强制解释为事件
|
||||
|
||||
// if (event & RT_SERIAL_EVENT_RX_IDLE)
|
||||
// 注意:在 RT-Thread 5.x,当使用 INT_RX 时,size 是接收到的字节数
|
||||
// 但若启用了 RX_IDLE 模式,底层驱动会在 IDLE 时回调,并传入事件
|
||||
// 安全做法:检查是否为事件(高位标志)
|
||||
// if (size & RT_SERIAL_EVENT_RX_IDLE)
|
||||
{
|
||||
LOG_D("RX IDLE event received");
|
||||
rt_sem_release(&rx_sem);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
// 如果是普通数据(size > 0),也可处理,但本例依赖 IDLE 触发
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
// 从串口设备读取一行(以 \n 结尾)
|
||||
static int read_line_from_uart(char *buf, int maxlen)
|
||||
{
|
||||
char ch;
|
||||
@@ -38,14 +48,14 @@ static int read_line_from_uart(char *buf, int maxlen)
|
||||
|
||||
while (len < maxlen - 1)
|
||||
{
|
||||
// 从串口缓冲区读一个字节(非阻塞,因为由 IDLE 触发说明有数据)
|
||||
if (rt_device_read(serial, 0, &ch, 1) <= 0)
|
||||
// 注意:在 INT_RX 模式下,rt_device_read 会从驱动内部 buffer 读取
|
||||
rt_size_t result = rt_device_read(serial, 0, &ch, 1);
|
||||
if (result <= 0)
|
||||
{
|
||||
break; // 无数据(理论上不应发生)
|
||||
break; // 无更多数据
|
||||
}
|
||||
|
||||
buf[len++] = ch;
|
||||
|
||||
if (ch == '\n')
|
||||
{
|
||||
buf[len] = '\0';
|
||||
@@ -53,7 +63,6 @@ static int read_line_from_uart(char *buf, int maxlen)
|
||||
}
|
||||
}
|
||||
|
||||
// 缓冲区满仍未遇到 \n,强制结束(可选策略)
|
||||
buf[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
@@ -63,89 +72,99 @@ void uart_thread_entry(void *parameter)
|
||||
char input[RX_LINE_BUF_SIZE];
|
||||
int len;
|
||||
|
||||
// 初始化信号量
|
||||
rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
|
||||
|
||||
// 查找串口设备
|
||||
serial = rt_device_find(SAMPLE_UART_NAME);
|
||||
if (!serial)
|
||||
{
|
||||
rt_kprintf("Cannot find %s\n", SAMPLE_UART_NAME);
|
||||
LOG_E("Cannot find %s", SAMPLE_UART_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
// 配置串口:设置内部接收缓冲区大小(必须 >= 最大可能的一行)
|
||||
// Step 1: 设置串口基本参数(波特率等)
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
config.bufsz = RX_LINE_BUF_SIZE; // 关键:驱动内部 buffer 要够大
|
||||
config.baud_rate = BAUD_RATE_115200; // 根据需要调整
|
||||
config.data_bits = DATA_BITS_8;
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.parity = PARITY_NONE;
|
||||
config.bufsz = RX_LINE_BUF_SIZE; // 驱动内部接收 buffer 大小
|
||||
rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, &config);
|
||||
|
||||
// 打开串口:使用中断接收(INT_RX),不使用 DMA
|
||||
// Step 2: 【关键】启用 RX IDLE 模式
|
||||
// rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, (void*)RT_SERIAL_RX_IDLE);
|
||||
|
||||
// Step 3: 打开串口(使用中断接收)
|
||||
rt_err_t result = rt_device_open(serial, RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX);
|
||||
if (result != RT_EOK)
|
||||
{
|
||||
rt_kprintf("Failed to open %s with INT, error=%d\n", SAMPLE_UART_NAME, result);
|
||||
LOG_E("Failed to open %s, error=%d", SAMPLE_UART_NAME, result);
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置接收回调(用于接收 IDLE 事件)
|
||||
// Step 4: 设置回调
|
||||
rt_device_set_rx_indicate(serial, uart_rx_ind);
|
||||
|
||||
rt_kprintf("UART thread (IDLE mode) running on %s...\n", SAMPLE_UART_NAME);
|
||||
LOG_I("SCCM thread (IDLE mode) running on %s", SAMPLE_UART_NAME);
|
||||
|
||||
while (1)
|
||||
{
|
||||
// 等待空闲中断通知
|
||||
if (rt_sem_take(&rx_sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||
{
|
||||
// 读取完整行
|
||||
len = read_line_from_uart(input, sizeof(input));
|
||||
if (len <= 0) continue;
|
||||
{
|
||||
// 等待数据就绪
|
||||
if (rt_sem_take(&rx_sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||
{
|
||||
// 处理接收到的数据(提取完整行)
|
||||
while ((len = get_line(input, sizeof(input))) > 0)
|
||||
{
|
||||
// 动态分配请求结构体(见之前完整代码)
|
||||
struct proc_request *req = rt_malloc(sizeof(struct proc_request));
|
||||
if (!req) continue;
|
||||
|
||||
// 构造请求
|
||||
struct proc_request *req = rt_malloc(sizeof(struct proc_request));
|
||||
if (!req) continue;
|
||||
rt_strncpy(req->input, input, sizeof(req->input));
|
||||
req->input_len = len;
|
||||
//req->input[len]='\0';
|
||||
|
||||
rt_strncpy(req->input, input, sizeof(req->input) - 1);
|
||||
req->input_len = len;
|
||||
req->sem = rt_malloc(sizeof(struct rt_semaphore));
|
||||
if (!req->sem) {
|
||||
rt_free(req);
|
||||
continue;
|
||||
}
|
||||
rt_sem_init(req->sem, "uart_resp", 0, RT_IPC_FLAG_FIFO);
|
||||
|
||||
req->sem = rt_malloc(sizeof(struct rt_semaphore));
|
||||
if (!req->sem)
|
||||
{
|
||||
rt_free(req);
|
||||
continue;
|
||||
}
|
||||
rt_sem_init(req->sem, "uart_resp", 0, RT_IPC_FLAG_FIFO);
|
||||
// 发送到处理线程
|
||||
if (rt_mq_send(proc_mq, &req, sizeof(req)) == RT_EOK)
|
||||
{
|
||||
// 等待处理完成
|
||||
if (rt_sem_take(req->sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||
{
|
||||
rt_device_write(serial, 0, req->output, req->output_len);
|
||||
}
|
||||
}
|
||||
|
||||
// 发送至处理队列
|
||||
if (rt_mq_send(proc_mq, &req, sizeof(req)) == RT_EOK)
|
||||
{
|
||||
// 等待响应
|
||||
if (rt_sem_take(req->sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||
{
|
||||
rt_device_write(serial, 0, req->output, req->output_len);
|
||||
}
|
||||
}
|
||||
|
||||
// 清理资源
|
||||
rt_sem_detach(req->sem);
|
||||
rt_free(req->sem);
|
||||
rt_free(req);
|
||||
}
|
||||
}
|
||||
// 清理
|
||||
rt_sem_detach(req->sem); // 或 rt_sem_delete
|
||||
rt_free(req->sem);
|
||||
rt_free(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 启动 UART 线程
|
||||
int start_uart_thread(void)
|
||||
{
|
||||
rt_thread_t tid = rt_thread_create("data_uart",
|
||||
uart_thread_entry,
|
||||
RT_NULL,
|
||||
2048, // 栈大小(2KB 足够)
|
||||
25, // 优先级
|
||||
10); // 时间片
|
||||
2048,
|
||||
25,
|
||||
10);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(tid);
|
||||
LOG_I("Create SCCM_uart thread");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("Failed to create SCCM_uart thread!");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -438,7 +438,7 @@ rt_err_t db_send_command(enum db_cmd_type type, const char* sql, rt_int32_t time
|
||||
void thread_DB_SQLite(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
tid = rt_thread_create("db_sql", db_sqlite, RT_NULL, 1024 *32, 3, 10);
|
||||
tid = rt_thread_create("db_sql", db_sqlite, RT_NULL, 1024 *32, 20, 10);
|
||||
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Stream0_IRQHandler(void);
|
||||
void USART1_IRQHandler(void);
|
||||
void USART2_IRQHandler(void);
|
||||
void SDMMC1_IRQHandler(void);
|
||||
|
||||
+20
-2
@@ -45,6 +45,7 @@ SD_HandleTypeDef hsd1;
|
||||
|
||||
UART_HandleTypeDef huart1;
|
||||
UART_HandleTypeDef huart2;
|
||||
DMA_HandleTypeDef hdma_usart1_rx;
|
||||
|
||||
SDRAM_HandleTypeDef hsdram1;
|
||||
|
||||
@@ -56,6 +57,7 @@ SDRAM_HandleTypeDef hsdram1;
|
||||
void SystemClock_Config(void);
|
||||
static void MPU_Config(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_DMA_Init(void);
|
||||
static void MX_FMC_Init(void);
|
||||
static void MX_SDMMC1_SD_Init(void);
|
||||
static void MX_USART1_UART_Init(void);
|
||||
@@ -101,6 +103,7 @@ __WEAK int main(void)
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_FMC_Init();
|
||||
MX_SDMMC1_SD_Init();
|
||||
MX_USART1_UART_Init();
|
||||
@@ -306,6 +309,22 @@ static void MX_USART2_UART_Init(void)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable DMA controller clock
|
||||
*/
|
||||
static void MX_DMA_Init(void)
|
||||
{
|
||||
|
||||
/* DMA controller clock enable */
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
|
||||
/* DMA interrupt init */
|
||||
/* DMA1_Stream0_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
|
||||
|
||||
}
|
||||
|
||||
/* FMC initialization function */
|
||||
static void MX_FMC_Init(void)
|
||||
{
|
||||
@@ -329,7 +348,7 @@ static void MX_FMC_Init(void)
|
||||
hsdram1.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;
|
||||
hsdram1.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16;
|
||||
hsdram1.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
|
||||
hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_1;
|
||||
hsdram1.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_2;
|
||||
hsdram1.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
|
||||
hsdram1.Init.SDClockPeriod = FMC_SDRAM_CLOCK_DISABLE;
|
||||
hsdram1.Init.ReadBurst = FMC_SDRAM_RBURST_DISABLE;
|
||||
@@ -368,7 +387,6 @@ static void MX_GPIO_Init(void)
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
extern DMA_HandleTypeDef hdma_usart1_rx;
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
@@ -226,6 +227,25 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF4_USART1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USART1 DMA Init */
|
||||
/* USART1_RX Init */
|
||||
hdma_usart1_rx.Instance = DMA1_Stream0;
|
||||
hdma_usart1_rx.Init.Request = DMA_REQUEST_USART1_RX;
|
||||
hdma_usart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_usart1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart1_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart1_rx.Init.Mode = DMA_CIRCULAR;
|
||||
hdma_usart1_rx.Init.Priority = DMA_PRIORITY_LOW;
|
||||
hdma_usart1_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
if (HAL_DMA_Init(&hdma_usart1_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(huart,hdmarx,hdma_usart1_rx);
|
||||
|
||||
/* USART1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||
@@ -251,17 +271,17 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_USART2_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
/**USART2 GPIO Configuration
|
||||
PA2 ------> USART2_TX
|
||||
PA3 ------> USART2_RX
|
||||
PD5 ------> USART2_TX
|
||||
PD6 ------> USART2_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* USART2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
|
||||
@@ -295,6 +315,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14|GPIO_PIN_15);
|
||||
|
||||
/* USART1 DMA DeInit */
|
||||
HAL_DMA_DeInit(huart->hdmarx);
|
||||
|
||||
/* USART1 interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(USART1_IRQn);
|
||||
/* USER CODE BEGIN USART1_MspDeInit 1 */
|
||||
@@ -310,10 +333,10 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||
__HAL_RCC_USART2_CLK_DISABLE();
|
||||
|
||||
/**USART2 GPIO Configuration
|
||||
PA2 ------> USART2_TX
|
||||
PA3 ------> USART2_RX
|
||||
PD5 ------> USART2_TX
|
||||
PD6 ------> USART2_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5|GPIO_PIN_6);
|
||||
|
||||
/* USART2 interrupt DeInit */
|
||||
HAL_NVIC_DisableIRQ(USART2_IRQn);
|
||||
@@ -340,7 +363,7 @@ static void HAL_FMC_MspInit(void){
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_FMC;
|
||||
PeriphClkInitStruct.FmcClockSelection = RCC_FMCCLKSOURCE_PLL;
|
||||
PeriphClkInitStruct.FmcClockSelection = RCC_FMCCLKSOURCE_D1HCLK;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern SD_HandleTypeDef hsd1;
|
||||
extern DMA_HandleTypeDef hdma_usart1_rx;
|
||||
extern UART_HandleTypeDef huart1;
|
||||
extern UART_HandleTypeDef huart2;
|
||||
/* USER CODE BEGIN EV */
|
||||
@@ -200,6 +201,20 @@ void SysTick_Handler(void)
|
||||
/* please refer to the startup file (startup_stm32h7xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 stream0 global interrupt.
|
||||
*/
|
||||
void DMA1_Stream0_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Stream0_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart1_rx);
|
||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Stream0_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles USART1 global interrupt.
|
||||
*/
|
||||
|
||||
+81
-59
@@ -4,8 +4,29 @@ CAD.pinconfig=
|
||||
CAD.provider=
|
||||
CORTEX_M7.IPParameters=default_mode_Activation
|
||||
CORTEX_M7.default_mode_Activation=1
|
||||
Dma.Request0=USART1_RX
|
||||
Dma.RequestsNb=1
|
||||
Dma.USART1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART1_RX.0.EventEnable=DISABLE
|
||||
Dma.USART1_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART1_RX.0.Instance=DMA1_Stream0
|
||||
Dma.USART1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART1_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART1_RX.0.Mode=DMA_CIRCULAR
|
||||
Dma.USART1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART1_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART1_RX.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Dma.USART1_RX.0.Priority=DMA_PRIORITY_LOW
|
||||
Dma.USART1_RX.0.RequestNumber=1
|
||||
Dma.USART1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Dma.USART1_RX.0.SignalID=NONE
|
||||
Dma.USART1_RX.0.SyncEnable=DISABLE
|
||||
Dma.USART1_RX.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Dma.USART1_RX.0.SyncRequestNumber=1
|
||||
Dma.USART1_RX.0.SyncSignalID=NONE
|
||||
FMC.CASLatency1=FMC_SDRAM_CAS_LATENCY_2
|
||||
FMC.ColumnBitsNumber1=FMC_SDRAM_COLUMN_BITS_NUM_9
|
||||
FMC.IPParameters=ColumnBitsNumber1
|
||||
FMC.IPParameters=ColumnBitsNumber1,CASLatency1
|
||||
File.Version=6
|
||||
GPIO.groupedBy=
|
||||
KeepUserPlacement=false
|
||||
@@ -14,60 +35,61 @@ MMTConfigApplied=false
|
||||
Mcu.CPN=STM32H743IIT6
|
||||
Mcu.Family=STM32H7
|
||||
Mcu.IP0=CORTEX_M7
|
||||
Mcu.IP1=FMC
|
||||
Mcu.IP2=MEMORYMAP
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=SDMMC1
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IP7=USART1
|
||||
Mcu.IP8=USART2
|
||||
Mcu.IPNb=9
|
||||
Mcu.IP1=DMA
|
||||
Mcu.IP2=FMC
|
||||
Mcu.IP3=MEMORYMAP
|
||||
Mcu.IP4=NVIC
|
||||
Mcu.IP5=RCC
|
||||
Mcu.IP6=SDMMC1
|
||||
Mcu.IP7=SYS
|
||||
Mcu.IP8=USART1
|
||||
Mcu.IP9=USART2
|
||||
Mcu.IPNb=10
|
||||
Mcu.Name=STM32H743IITx
|
||||
Mcu.Package=LQFP176
|
||||
Mcu.Pin0=PF0
|
||||
Mcu.Pin1=PF1
|
||||
Mcu.Pin10=PA3
|
||||
Mcu.Pin11=PB0
|
||||
Mcu.Pin12=PB1
|
||||
Mcu.Pin13=PF11
|
||||
Mcu.Pin14=PF12
|
||||
Mcu.Pin15=PF13
|
||||
Mcu.Pin16=PF14
|
||||
Mcu.Pin17=PF15
|
||||
Mcu.Pin18=PG0
|
||||
Mcu.Pin19=PG1
|
||||
Mcu.Pin10=PB1
|
||||
Mcu.Pin11=PF11
|
||||
Mcu.Pin12=PF12
|
||||
Mcu.Pin13=PF13
|
||||
Mcu.Pin14=PF14
|
||||
Mcu.Pin15=PF15
|
||||
Mcu.Pin16=PG0
|
||||
Mcu.Pin17=PG1
|
||||
Mcu.Pin18=PE7
|
||||
Mcu.Pin19=PE8
|
||||
Mcu.Pin2=PF2
|
||||
Mcu.Pin20=PE7
|
||||
Mcu.Pin21=PE8
|
||||
Mcu.Pin22=PE9
|
||||
Mcu.Pin23=PE10
|
||||
Mcu.Pin24=PE11
|
||||
Mcu.Pin25=PE12
|
||||
Mcu.Pin26=PE13
|
||||
Mcu.Pin27=PE14
|
||||
Mcu.Pin28=PE15
|
||||
Mcu.Pin29=PB14
|
||||
Mcu.Pin20=PE9
|
||||
Mcu.Pin21=PE10
|
||||
Mcu.Pin22=PE11
|
||||
Mcu.Pin23=PE12
|
||||
Mcu.Pin24=PE13
|
||||
Mcu.Pin25=PE14
|
||||
Mcu.Pin26=PE15
|
||||
Mcu.Pin27=PB14
|
||||
Mcu.Pin28=PB15
|
||||
Mcu.Pin29=PD8
|
||||
Mcu.Pin3=PF3
|
||||
Mcu.Pin30=PB15
|
||||
Mcu.Pin31=PD8
|
||||
Mcu.Pin32=PD9
|
||||
Mcu.Pin33=PD10
|
||||
Mcu.Pin34=PD14
|
||||
Mcu.Pin35=PD15
|
||||
Mcu.Pin36=PG2
|
||||
Mcu.Pin37=PG4
|
||||
Mcu.Pin38=PG5
|
||||
Mcu.Pin39=PG8
|
||||
Mcu.Pin30=PD9
|
||||
Mcu.Pin31=PD10
|
||||
Mcu.Pin32=PD14
|
||||
Mcu.Pin33=PD15
|
||||
Mcu.Pin34=PG2
|
||||
Mcu.Pin35=PG4
|
||||
Mcu.Pin36=PG5
|
||||
Mcu.Pin37=PG8
|
||||
Mcu.Pin38=PC8
|
||||
Mcu.Pin39=PC9
|
||||
Mcu.Pin4=PF4
|
||||
Mcu.Pin40=PC8
|
||||
Mcu.Pin41=PC9
|
||||
Mcu.Pin42=PC10
|
||||
Mcu.Pin43=PC11
|
||||
Mcu.Pin44=PC12
|
||||
Mcu.Pin45=PD0
|
||||
Mcu.Pin46=PD1
|
||||
Mcu.Pin47=PD2
|
||||
Mcu.Pin40=PC10
|
||||
Mcu.Pin41=PC11
|
||||
Mcu.Pin42=PC12
|
||||
Mcu.Pin43=PD0
|
||||
Mcu.Pin44=PD1
|
||||
Mcu.Pin45=PD2
|
||||
Mcu.Pin46=PD5
|
||||
Mcu.Pin47=PD6
|
||||
Mcu.Pin48=PG15
|
||||
Mcu.Pin49=PE0
|
||||
Mcu.Pin5=PF5
|
||||
@@ -75,9 +97,9 @@ Mcu.Pin50=PE1
|
||||
Mcu.Pin51=VP_SYS_VS_Systick
|
||||
Mcu.Pin52=VP_MEMORYMAP_VS_MEMORYMAP
|
||||
Mcu.Pin6=PC0
|
||||
Mcu.Pin7=PA2
|
||||
Mcu.Pin8=PH2
|
||||
Mcu.Pin9=PH3
|
||||
Mcu.Pin7=PH2
|
||||
Mcu.Pin8=PH3
|
||||
Mcu.Pin9=PB0
|
||||
Mcu.PinsNb=53
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
@@ -85,6 +107,7 @@ Mcu.UserName=STM32H743IITx
|
||||
MxCube.Version=6.15.0
|
||||
MxDb.Version=DB.6.0.150
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.DMA1_Stream0_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
@@ -98,10 +121,6 @@ NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
PA2.Mode=Asynchronous
|
||||
PA2.Signal=USART2_TX
|
||||
PA3.Mode=Asynchronous
|
||||
PA3.Signal=USART2_RX
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Output
|
||||
PB1.Locked=true
|
||||
@@ -128,6 +147,10 @@ PD14.Signal=FMC_D0_DA0
|
||||
PD15.Signal=FMC_D1_DA1
|
||||
PD2.Mode=SD_4_bits_Wide_bus
|
||||
PD2.Signal=SDMMC1_CMD
|
||||
PD5.Mode=Asynchronous
|
||||
PD5.Signal=USART2_TX
|
||||
PD6.Mode=Asynchronous
|
||||
PD6.Signal=USART2_RX
|
||||
PD8.Signal=FMC_D13_DA13
|
||||
PD9.Signal=FMC_D14_DA14
|
||||
PE0.Signal=FMC_NBL0
|
||||
@@ -197,7 +220,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_FMC_Init-FMC-false-HAL-true,4-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FMC_Init-FMC-false-HAL-true,5-MX_SDMMC1_SD_Init-SDMMC1-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true,8-MX_LTDC_Init-LTDC-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||
RCC.ADCFreq_Value=150000000
|
||||
RCC.AHB12Freq_Value=240000000
|
||||
RCC.AHB4Freq_Value=240000000
|
||||
@@ -231,8 +254,7 @@ RCC.DIVR1Freq_Value=480000000
|
||||
RCC.DIVR2Freq_Value=150000000
|
||||
RCC.DIVR3Freq_Value=129000000
|
||||
RCC.FDCANFreq_Value=160000000
|
||||
RCC.FMCCLockSelection=RCC_FMCCLKSOURCE_PLL
|
||||
RCC.FMCFreq_Value=160000000
|
||||
RCC.FMCFreq_Value=240000000
|
||||
RCC.FamilyName=M
|
||||
RCC.HCLK3ClockFreq_Value=240000000
|
||||
RCC.HCLKFreq_Value=240000000
|
||||
@@ -240,7 +262,7 @@ RCC.HPRE=RCC_HCLK_DIV2
|
||||
RCC.HRTIMFreq_Value=240000000
|
||||
RCC.I2C123Freq_Value=120000000
|
||||
RCC.I2C4Freq_Value=120000000
|
||||
RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,D1PPRE,D2PPRE1,D2PPRE2,D3PPRE,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVN1,DIVN2,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCCLockSelection,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HPRE,HRTIMFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLL3FRACN,PLLFRACN,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI23Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMC1CLockSelection,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
|
||||
RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,D1PPRE,D2PPRE1,D2PPRE2,D3PPRE,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVN1,DIVN2,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1,DIVQ1Freq_Value,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,HPRE,HRTIMFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLL2FRACN,PLL3FRACN,PLLFRACN,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI23Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMC1CLockSelection,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
|
||||
RCC.LPTIM1Freq_Value=120000000
|
||||
RCC.LPTIM2Freq_Value=120000000
|
||||
RCC.LPTIM345Freq_Value=120000000
|
||||
|
||||
@@ -91,10 +91,12 @@ extern "C"
|
||||
*
|
||||
*/
|
||||
#define BSP_USING_UART1
|
||||
//#define BSP_UART1_RX_USING_DMA
|
||||
#define BSP_UART1_TX_PIN "PB14"
|
||||
#define BSP_UART1_RX_PIN "PB15"
|
||||
|
||||
#define BSP_USING_UART2
|
||||
//#define BSP_UART2_RX_USING_DMA
|
||||
#define BSP_UART2_TX_PIN "PA2"
|
||||
#define BSP_UART2_RX_PIN "PA3"
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@ struct dma_config {
|
||||
rt_uint32_t dma_rcc;
|
||||
IRQn_Type dma_irq;
|
||||
|
||||
#if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
||||
#if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)|| defined(SOC_SERIES_STM32F3)
|
||||
rt_uint32_t channel;
|
||||
#endif
|
||||
|
||||
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4)
|
||||
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32WL) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4)\
|
||||
|| defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32WB) || defined(SOC_SERIES_STM32L5)
|
||||
rt_uint32_t request;
|
||||
#endif
|
||||
};
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user