I followed the course how to use a serial port today.After I wrote all the codes,two errors occurred.I spent much time to find out how to solve the program.After continuous efforts,it was solved.So I want to share two kinds of errors,in order to solve quickly the next time it appears.
..\..\Drivers\SYSTEM\usart\usart.c(55): error: #20: identifier "USART" is undefined
USART->DR = (uint8_t)ch;
'The first error is' error: #20: identifier "xxx" is undefined'.What problem made it arise?It's the reason that I didn't defined 'USART',I just defined'USART1'Just revised 'USART' to 'USART1'.
..\..\Drivers\SYSTEM\usart\usart.c(106): warning: #223-D: function "HAL_NVIC_ENABLEIRQ" declared implicitly
HAL_NVIC_ENABLEIRQ(USART1_IRQn);
The second error is' warning: #223-D: function "xxx" declared implicitly'.
This question had bothered me for a long time.Until I found this bug and found it very simple. Just add '——' in front of HAL.After that,it's ok.
Therefore, we need to be careful when programming.