UART ARM3 MSS处理程序输入后两次致电两次
原始问题:
为什么我的UART ARM3 MSS功能称为两次?
更新:答案: 因为每个传入的字节都会导致中断。 @第一个中断1个字母在里面。在第二个中断之后,其余数据就在内部。
新问题: 当我编写一个字符串时:“测试”并击中plink/putty中的输入:
- 首次称为't'的ISR在缓冲区中可用。
这是调试图片: debug
- 然后下次'e',s','s','t t ','\ n'在缓冲区中。 在这里,类似的“ tatus \ n”而不是“状态\ n” tatus
为什么第一个t覆盖?
问题
(我现在看到有时将整个单词写入缓冲区中。 但不是每次。 我将尝试记录所有传入的数据,直到'\ n'被摧毁。 )
***第一个“ T”去了哪里?** ***为什么要
覆盖
MSS_UART_init(&g_mss_uart0, MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY);
它
?
这是我的处理程序描述 它打印出读取的内容。 它也将其传递到以后处理的“命令”和“ value_str”变量。
Interrupt -> uart handler -> nothing
But it behaves like
Interrupt -> uart handler -> Interrupt -> uart handler -> nothing
uart处理程序定义:
void uart3_rx_handler(mss_uart_instance_t *this_uart)
{
unsigned int rx_size = MSS_UART_get_rx(this_uart, g_rx_buff, sizeof(g_rx_buff));
(void)rx_size;
// int size =(int)(rx_size);
uart_calls_cnt++;
uart_handler_flag = 0;
// clear read in variables
if (strchr((char *)g_rx_buff, '\n') != NULL) {
// copy into read in variables
memset(command, 0, 255); // prepare command
memset(value_str, 0, 255); // prepare command
strcpy(value_str, (char *)g_rx_buff); // get user input into command
strcpy(command, (char *)g_rx_buff); // get user input into command
value_str[strcspn(value_str, "\n")] = 0; // delete appended \n : works for LF, CR, CRLF, LFCR, ...
command[strcspn(command, "\n")] = 0; // delete appended \n : works for LF, CR, CRLF, LFCR, ...
memset(&g_rx_buff[0], 0, 128); // clear rx buffer
uart_handler_flag = 1; // so the while(1) loop @ scanf () will break and programm will proceed
} else {
// nothing..
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论