参考:
https://blog.csdn.net/weixin_42831633/article/details/107123517
另外这里可以找到LL库的example
C:\Users\Administrator\STM32Cube\Repository\STM32Cube_FW_F0_V1.11.0\Projects\STM32F072RB-Nucleo\Examples_LL
串口坑:
1.开RXNE中断,上电时不停通过串口发数据给单片机,会卡在中断里面出不来。。。。
排查后发现,如果用elseif 会没进ORE中断里面。。。然后清不了这个中断,不停进。。。
必须将IF分开来写
2.串口接收时候,必须有
uint8_t data = USART1->RDR; 来清除中断....否则会卡死。。。
读取数据就会清标志了