本帖最后由 深夜星空 于 2013-4-15 11:05 编辑
小弟刚刚接触STM32,还需前辈们多多指点:
我用的是IAR6.4 ,固件库函数V3.5,板子是在网上买的STM32F107VC的实验板,想做CAN通信实验,使能CAN的接收中断,问题就处在配置中断上面了
头文件这样时:
#include "stm32f10x.h"
#include <stdio.h>
//#include "stm32_eval.h"
//#include "stm3210c_eval_lcd.h"
#include "Delay.c"
#include "Periph_Configuration.c"
中断的函数:
void NVIC_Config(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = CAN2_RX0_IRQn; *************************错误指向这里
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
错误提示:Error[Pe020]: identifier "CAN2_RX0_IRQn" is undefined E:\毕业设计\程序\CAN-485\main.c 74
头文件是这样时
#include "stm32f10x.h"
#include <stdio.h>
#include "stm32_eval.h"
//#include "stm3210c_eval_lcd.h"
#include "Delay.c"
#include "Periph_Configuration.c"
错误又指向了stm32_eval.h中
#ifdef USE_STM32100B_EVAL
#include "stm32f10x.h"
#include "stm32100b_eval/stm32100b_eval.h"
#elif defined USE_STM3210B_EVAL
#include "stm32f10x.h"
#include "stm3210b_eval/stm3210b_eval.h"
#elif defined USE_STM3210E_EVAL
#include "stm32f10x.h"
#include "stm3210e_eval/stm3210e_eval.h"
#elif defined USE_STM3210C_EVAL
#include "stm32f10x.h"
#include "stm3210c_eval/stm3210c_eval.h"
#elif defined USE_STM32L152_EVAL
#include "stm32l1xx.h"
#include "stm32l152_eval/stm32l152_eval.h"
#elif defined USE_STM32100E_EVAL
#include "stm32f10x.h"
#include "stm32100e_eval/stm32100e_eval.h"
#else
#error "Please select first the STM32 EVAL board to be used (in stm32_eval.h)"****************错误指向这里
#endif
在工程选项里也添加了STM32F10X_MD USE_STDPERIPH_DRIVER STM3210B_EVAL 这三行,还是不行。
求前辈们指点
|