电子说
开发板配件中有一条Mini-USB线,连接DEBUG-usb至PC USB端口,如果供电正常,如下灯会亮
在Keil中配置DAP下载器
配置完成后,最好查看DAP是否已经识别芯片
代码分析
int main(void)
{
/* System Clocks Configuration */
RCC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();
/* USARTy and USARTz configuration ----------------------------------*/
USART_InitStructure.BaudRate = 115200;
USART_InitStructure.WordLength = USART_WL_8B;
USART_InitStructure.StopBits = USART_STPB_1;
USART_InitStructure.Parity = USART_PE_NO;
USART_InitStructure.HardwareFlowControl = USART_HFCTRL_NONE;
USART_InitStructure.Mode = USART_MODE_RX | USART_MODE_TX;
/* Configure USARTx */
USART_Init(USARTx, &USART_InitStructure);
/* Enable the USARTx */
USART_Enable(USARTx, ENABLE);
/* Output a message on Hyperterminal using printf function */
printf("nrUSART Printf Example: retarget the C library printf function to the USARTnr");
while (1)
{
}
}
下载代码:
运行代码:
在串口调试接口看见如下log:
全部0条评论
快来发表一下你的评论吧 !