3运行一个简单的Demo(N32G45XVL)

电子说

1.2w人已加入

描述

3.1 连接硬件

开发板配件中有一条Mini-USB线,连接DEBUG-usb至PC USB端口,如果供电正常,如下灯会亮

demo板

3.2 KEIL 配置

在Keil中配置DAP下载器

demo板

配置完成后,最好查看DAP是否已经识别芯片

demo板

3.3 下载和运行Demo

代码分析

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)
    {
    }
}

下载代码:

demo板

运行代码:

demo板

在串口调试接口看见如下log:

demo板

  审核编辑:汤梓红

 

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分