OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6683|回复: 1

各位大神看看,为啥程序用usart4一发数据就死掉,显示HardFault_Handler\

[复制链接]

1

主题

1

帖子

0

精华

新手上路

积分
26
金钱
26
注册时间
2012-12-29
在线时间
0 小时
发表于 2012-12-29 15:22:45 | 显示全部楼层 |阅读模式

  void UART4_Configuration(void)    
 {
  /* USART1 configuration ------------------------------------------------------*/
  /* USART1 configured as follow:
        - BaudRate = 9600 baud
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
        - USART Clock disabled
        - USART CPOL: Clock is active low
        - USART CPHA: Data is captured on the second edge
        - USART LastBit: The clock pulse of the last data bit is not output to
                         the SCLK pin
  */
  USART_ClockInitTypeDef USART_ClockInitStructure;
  USART_InitStructure.USART_BaudRate = 9600;   ///////////////波特率设置
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  /* Configure the USART4 */
  USART_Init(UART4, &USART_InitStructure);


 USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
 USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
 USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
 USART_ClockInitStructure.USART_LastBit = USART_LastBit_Enable;
 USART_ClockInit(UART4, &USART_ClockInitStructure);


  USART_ITConfig(UART4, USART_IT_RXNE, ENABLE);
    /* Enable USART4 */
     USART_Cmd(UART4, ENABLE);
   MY_NVIC_Init(2,2,UART4_IRQChannel,1);//组2,最低优先级
  }

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2012-12-29 16:53:57 | 显示全部楼层
中断服务函数在哪里?
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-20 04:41

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表