前言
前两天刚好有事回家,直到今天才到快递站取回板子准备测评工作。在此,首先非常感谢EEWORLD论坛,提供平台及举办各种开发板和模组的测评活动,也感谢国民技术提供的测评板。话不多说,下面就开始进入本期的开箱介绍。
1、开箱
打开包装盒,可以看到,官方除了提供开发板外,还很贴心的提供了一根mini-usb接口的通讯线。
拿出开发板,板载外设也是一目了然。除了常见的led,按键外,测评板将mcu上所有IO引脚引出,方便后续对mcu的开发及使用。此外,板上还集成了NS-LINK模块,通过板上的mini-usb接口(DEBUG USB),可以很方便的对开发板进行烧录或调试。
2、资料下载
关于资料部分,论坛上有开发资料包,也可以直接到官方服务器下载,地址如下:
【国民技术 N32 MCU 开发资料包】--N32L43x系列
FTP服务器:ftp://58.250.18.138
可以看到,官方提供的资料还是很齐全的,从基本的mcu用户和数据手册,硬件原理图,到开发环境的搭建说明等,对于新手来说还是特别友好的。
3、开发环境搭建
关于开发环境的搭建,从文档资料可以看到,官方提供了多种开发环境应用文档指导。这里我选择较为熟悉的MDK keil作为基本的开发环境,只需要安装好官方提供的pack包,就可以直接在MDK keil下编译及调试工程项目了。
4、工程demo演示
关于工程demo的演示,就usart输出"hello world"作为演示工程。
从原理图可以看出,PA9,PA10可复用为USART输出脚使用,这里我直接使用USB-TTL模块,需要把J5上的跳线断开。
/*****************************************************************************
* Copyright (c) 2019, Nations Technologies Inc.
*
* All rights reserved.
* ****************************************************************************
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Nations' name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ****************************************************************************/
/**
* @File main.c
* @author Nations
* @version v1.0.0
*
* @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
*/
#include <stdio.h>
#include "main.h"
/** @addtogroup N32L43X_StdPeriph_Examples
* @{
*/
/** @addtogroup USART_Printf
* @{
*/
USART_InitType USART_InitStructure;
/**
* @brief Main program
*/
int main(void)
{
/* System Clocks Configuration */
RCC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();
/* USARTy and USARTz configuration ------------------------------------------------------*/
USART_StructInit(&USART_InitStructure);
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("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
printf("hello world. \r\n");
while (1)
{
}
}
/**
* @brief Configures the different system clocks.
*/
void RCC_Configuration(void)
{
/* Enable GPIO clock */
GPIO_APBxClkCmd(USARTx_GPIO_CLK, ENABLE);
/* Enable USARTx Clock */
USART_APBxClkCmd(USARTx_CLK, ENABLE);
}
/**
* @brief Configures the different GPIO ports.
*/
void GPIO_Configuration(void)
{
GPIO_InitType GPIO_InitStructure;
/* Initialize GPIO_InitStructure */
GPIO_InitStruct(&GPIO_InitStructure);
/* Configure USARTx Tx as alternate function push-pull */
GPIO_InitStructure.Pin = USARTx_TxPin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Alternate = USARTx_Tx_GPIO_AF;
GPIO_InitPeripheral(USARTx_GPIO, &GPIO_InitStructure);
/* Configure USARTx Rx as alternate function push-pull and pull-up */
GPIO_InitStructure.Pin = USARTx_RxPin;
GPIO_InitStructure.GPIO_Pull = GPIO_Pull_Up;
GPIO_InitStructure.GPIO_Alternate = USARTx_Rx_GPIO_AF;
GPIO_InitPeripheral(USARTx_GPIO, &GPIO_InitStructure);
}
/* retarget the C library printf function to the USART */
int fputc(int ch, FILE* f)
{
USART_SendData(USARTx, (uint8_t)ch);
while (USART_GetFlagStatus(USARTx, USART_FLAG_TXDE) == RESET)
;
return (ch);
}
#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
*/
void assert_failed(const uint8_t* expr, const 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)
{
}
}
#endif
/**
* @}
*/
/**
* @}
*/
本帖最后由 emmnn 于 2022-7-4 21:35 编辑
引用: freebsder 发表于 2022-7-5 17:56 谢谢分享,期待后续!