我在初始化函数的时候,没有开启任何中断,程序也就是一个简单的串口接收处理,我上传代码,帮忙看看哪里出了问题?static struct usart_module ext3_uart_module;
/**
* Configure UART console.
*/
static void configure_console(void)
{
struct usart_config usart_conf;
usart_get_config_defaults(&usart_conf);
usart_conf.mux_setting = EXT3_UART_SERCOM_MUX_SETTING ;
usart_conf.pinmux_pad0 = EXT3_UART_SERCOM_PINMUX_PAD0;
usart_conf.pinmux_pad1 = EXT3_UART_SERCOM_PINMUX_PAD1;
usart_conf.pinmux_pad2 = EXT3_UART_SERCOM_PINMUX_PAD2;
usart_conf.pinmux_pad3 = EXT3_UART_SERCOM_PINMUX_PAD3;
usart_conf.baudrate = 57600;
stdio_serial_init(&ext3_uart_module, EXT3_UART_MODULE, &usart_conf); usart_enable(&ext3_uart_module);
}
int main(void)
{
struct port_config pin;
uint8_t *tmp_data;
system_init();
/*Configure UART console.*/
configure_console();
/* Output example information */
puts(STRING_HEADER);
/*Configures PORT for LED0*/
port_get_config_defaults(&pin);
pin.direction = PORT_PIN_DIR_OUTPUT;
port_pin_set_config(LED0_PIN, &pin);
port_pin_set_output_level(LED0_PIN, LED0_INACTIVE);
/*main loop*/
while(1)
{
usart_serial_getchar(&ext3_uart_module,tmp_data);
}
}
while循环中的代码
static inline void usart_serial_getchar(
struct usart_module *const module,
volatile uint8_t *c)
{
volatile uint8_t temp = 0;
SercomUsart *const usart_hw = &(module->hw->USART);
while(!(usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_RXC));
temp= (volatile uint8_t)(usart_hw->DATA.bit.DATA);
*c = temp;
}
现在程序跑起来 经常会进入
/**
* \brief Default interrupt handler for unused IRQs.
*/
void Dummy_Handler(void)
{
while (1) {
}
}
现在也不知道是什么原因导致的! |