stm32 uart4和uart5的中断问题

[复制链接]
12556|12
 楼主| zhong5411 发表于 2012-1-7 17:07 | 显示全部楼层 |阅读模式
本帖最后由 zhong5411 于 2012-1-7 17:31 编辑

/*******************************************************************************
* Function Name  : NVIC_Configuration
* Description    : Configures Vector Table base location.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
    /* 配置中断使用组合1*/
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
   /* Configure and enable USART3 interrupt*/
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

  /* Configure and enable UART4 interrupt */
NVIC_InitStructure.NVIC_IRQChannel = UART4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
  /*Configure and enable UART5 interrupt */
NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
  
}


错误现象是
Build target 'Target 1'
compiling ZQL_nvic.c...
..\src\ZQL_nvic.c(62): error:  #20: identifier "UART4_IRQn" is undefined
..\src\ZQL_nvic.c:      NVIC_InitStructure.NVIC_IRQChannel = UART4_IRQn;
..\src\ZQL_nvic.c:                                           ^
..\src\ZQL_nvic.c(69): error:  #20: identifier "UART5_IRQn" is undefined
..\src\ZQL_nvic.c:      NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;
..\src\ZQL_nvic.c:                                           ^
..\src\ZQL_nvic.c: ..\src\ZQL_nvic.c: 0 warnings, 2 errors
Target not created

麻烦高手大虾帮忙解决一下
 楼主| zhong5411 发表于 2012-1-7 17:11 | 显示全部楼层
自己顶一下
 楼主| zhong5411 发表于 2012-1-7 17:14 | 显示全部楼层
在线等高手
 楼主| zhong5411 发表于 2012-1-7 17:35 | 显示全部楼层
库用的是3.0的,启动代码用的是高容量的
;* File Name          : startup_stm32f10x_hd.s
;* Author             : MCD Application Team
;* Version            : V3.0.0
;* Date               : 04/06/2009
李富贵 发表于 2012-1-7 17:55 | 显示全部楼层
猪都知道,要什么高手?

NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannel = UART4_IRQn;
NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;
 楼主| zhong5411 发表于 2012-1-7 18:27 | 显示全部楼层
5# 李富贵

估计你还没弄明白USART和UART是怎么回事
李富贵 发表于 2012-1-7 21:28 | 显示全部楼层
你不会搜一下USART3_IRQn在哪个h文件里面定义的?
nongfuxu 发表于 2012-1-8 10:10 | 显示全部楼层
哈哈,到了下午与晚上,火气还这么DA!;P
yanwuhen620 发表于 2013-3-8 17:01 | 显示全部楼层
得进入stm32的启动文件里面设置一下高容量STM32,即在stm32f10x.h文件中的#define STM32F10X_MD更改为#define STM32F10X_HD UART4.和UART5就可以使用中断啦!
jcsasm 发表于 2013-8-28 15:18 | 显示全部楼层
haov000 发表于 2013-8-30 11:56 | 显示全部楼层
目测选择芯片的宏定义搞错了
lixmlxm 发表于 2015-5-16 11:15 | 显示全部楼层
我芯片选择正确了也没有用
yangxf1217 发表于 2017-8-22 17:48 | 显示全部楼层
搞定了吗?我也遇到
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

8

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部