关于沁恒CH32V307的串口接收中断只会触发一次的问题记录
李昂不想烧板子:
在测试中断函数的执行时发现,中断函数只能触发一次。需要添加指定的代码才能连续触发。
关于沁恒CH32V307的串口接收中断只会触发一次的问题记录
2301_82064932:
请问你在哪个地方发现问题的?
珠海泰为 MCU 空白工程 创建时 KEil 报错Error: L6218E: Undefined symbol assert_Fail (referred from misc.o).
李昂不想烧板子:
好的 感谢指导,我去试一下。
珠海泰为 MCU 空白工程 创建时 KEil 报错Error: L6218E: Undefined symbol assert_Fail (referred from misc.o).
bulesourse:
上面代码不完整补充一下:
[code=csharp]
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
[/code]
我的这个报错,在按照上面的方法定义了assert_failed()后就消失了。
你这个警告是不是与这个错误没有关系了?
珠海泰为 MCU 空白工程 创建时 KEil 报错Error: L6218E: Undefined symbol assert_Fail (referred from misc.o).
bulesourse:
一、这个assert_failed()是断言机制assert_param()函数的一部分。
打开断言机制的方法有两个:
1.取消注释stm32f10x_conf.h第56行:
[code=csharp]
/* #define USE_FULL_ASSERT 1 */
[/code]
2.魔术棒C/C++中定义USE_FULL_ASSERT
以上关于assert_param()的用法,在stm32f10x_conf.h里可以找到详细描述。
二、至于
[code=csharp]
Error: L6218E: Undefined symbol assert_failed (referred from misc.o).
[/code]
这个报错,应该是与assert_failed()函数没有定义有关。
在stm32f10x_conf.h里,只对assert_failed()进行了声明,需要自己定义函数实体。
st官方的模板是在main.c里对assert_failed()进行定义。其写法如下:
[code=csharp]
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
[/code]
友情链接:
©Copyright © 2022 2006年世界杯歌曲_冰岛世界杯排名 - guoyunzhan.com All Rights Reserved.