3838 views|0 replies

205

Posts

0

Resources
The OP
 

[National Technology Automotive MCU N32A455 Development Board] 01. Build the development environment and create a basic project [Copy link]

1. Unboxing

On the eve of the Spring Festival, I received the N32A455 development board with the National Technology automotive MCU on board! A development board, a MiniUSB data cable...

2. Preparation

2.1. Download development materials:

  • Download the development board related information from ftp://download.nationstech.com: N32A455xx_V1.2.0.zip under ftp://download.nationstech.com/2-Automotive-Grade MCU/
  • Go to https://www.nationstech.com/zlxz455/ to download the relevant information.
  • Download the official information through the evaluation activity link
  • Um... I still recommend downloading from the FTP server, which is updated more timely. The current version that can be downloaded from the official website is version 1.1, and the latest version of the FTP server is 1.2

2.2. Install KEIL integrated development environment chip support package

In the N32A455xx_V1.2.0\6-Software Development Kit directory, double-click Nationstech.N32A455_DFP.1.0.0.pack to install:

3. Get familiar with onboard functions

The development board model we evaluated this time is N32A455VEL7-EVB, so the corresponding schematic is N32A455xx_V1.2.0\5-Hardware Evaulation Board\N32A455VEL7-EVB_V1.1.pdf. According to the N32A455VEL7-EVB development board hardware user guide, the functions of the development board are as follows:

  • Power supply mode of the development board: 12V power supply through the DC socket, 5V power supply through the MiniUSB interface
  • Onboard NSLINK program download and debugging tool, supports JTAG and SWD connection methods, and also has a virtual serial port
  • Support 2-way CAN and 2-way LIN
  • Support TF card, SDIO interface
  • Onboard VS1053B audio circuit
  • Onboard EEPROM
  • Onboard SPI FLASH and QSPI FLASH
  • Onboard 5 mechanical buttons, 1 reset button, 1 wake-up button, 3 function buttons
  • Onboard three-color LED light, adjustable resistor with ADC function
  • All the pins of the chip are led out through the pin header

4. Basic Engineering

The official sample programs are stored in the N32A455xx_V1.2.0\6-Software Development Kit\Nationstech.N32A455_Library.1.1.0 directory. The driver library programs are stored in the firmware folder, and the sample programs based on the development board are stored in the projects\n32a455_EVAL folder. We refer to the examples\GPIO\LedBlink sample program, examples\GPIO\LedBlink sample program, and examples\USART\Printf sample program to create a new basic project.

4.1. Create a project: Project name->Select chip model->OK

4.2. Add project source code: startup program, CMSIS, driver library, user program

4.3.Configure the project

4.4. Programming

#ifndef __MAIN_H__
#define __MAIN_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stdio.h>

#include "n32a455.h"

/* PA11_RLED */
#define RLED_RCC    RCC_APB2_PERIPH_GPIOA
#define RLED_GPIO   GPIOA
#define RLED_PIN    GPIO_PIN_11

/* PB10_BLED */
#define BLED_RCC    RCC_APB2_PERIPH_GPIOB
#define BLED_GPIO   GPIOB
#define BLED_PIN    GPIO_PIN_10

/* PA12_GLED */
#define GLED_RCC    RCC_APB2_PERIPH_GPIOA
#define GLED_GPIO   GPIOA
#define GLED_PIN    GPIO_PIN_12

/* PD12_KEY */
#define S3_RCC      RCC_APB2_PERIPH_GPIOD
#define S3_GPIO     GPIOD
#define S3_PIN      GPIO_PIN_12

/* PC6_KEY  */
#define S4_RCC      RCC_APB2_PERIPH_GPIOC
#define S4_GPIO     GPIOC
#define S4_PIN      GPIO_PIN_6

/* PC7_KEY  */
#define S5_RCC      RCC_APB2_PERIPH_GPIOC
#define S5_GPIO     GPIOC
#define S5_PIN      GPIO_PIN_7

#ifdef __cplusplus
}
#endif

#endif

#include "main.h"

void LED_Init(void)
{
    GPIO_InitType GPIO_InitStructure;

    RCC_EnableAPB2PeriphClk(RLED_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = RLED_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
    GPIO_InitPeripheral(RLED_GPIO, &GPIO_InitStructure);

    GPIO_WriteBit(RLED_GPIO, RLED_PIN, Bit_SET);

    RCC_EnableAPB2PeriphClk(BLED_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = BLED_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
    GPIO_InitPeripheral(BLED_GPIO, &GPIO_InitStructure);

    GPIO_WriteBit(BLED_GPIO, BLED_PIN, Bit_SET);

    RCC_EnableAPB2PeriphClk(GLED_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = GLED_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
    GPIO_InitPeripheral(GLED_GPIO, &GPIO_InitStructure);

    GPIO_WriteBit(GLED_GPIO, GLED_PIN, Bit_SET);
}

void LED_ON(GPIO_Module *GPIOn, uint16_t PINn)
{
    GPIO_WriteBit(GPIOn, PINn, Bit_RESET);
}

void LED_OFF(GPIO_Module *GPIOn, uint16_t PINn)
{
    GPIO_WriteBit(GPIOn, PINn, Bit_SET);
}

void LED_Toggle(GPIO_Module *GPIOn, uint16_t PINn)
{
    if (GPIO_ReadOutputDataBit(GPIOn, PINn) == Bit_RESET)
    {
        GPIO_WriteBit(GPIOn, PINn, Bit_SET);
    }
    else
    {
        GPIO_WriteBit(GPIOn, PINn, Bit_RESET);
    }
}

void KEY_Init(void)
{
    GPIO_InitType GPIO_InitStructure;

    RCC_EnableAPB2PeriphClk(S3_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = S3_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPU;
    GPIO_InitPeripheral(S3_GPIO, &GPIO_InitStructure);

    RCC_EnableAPB2PeriphClk(S4_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = S4_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPU;
    GPIO_InitPeripheral(S4_GPIO, &GPIO_InitStructure);

    RCC_EnableAPB2PeriphClk(S5_RCC, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = S5_PIN;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPU;
    GPIO_InitPeripheral(S5_GPIO, &GPIO_InitStructure);
}

void USART_Configuration(void)
{
    GPIO_InitType GPIO_InitStructure;
    USART_InitType USART_InitStructure;

    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA | RCC_APB2_PERIPH_AFIO, ENABLE);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.Pin        = GPIO_PIN_9;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AF_PP;
    GPIO_InitPeripheral(GPIOA, &GPIO_InitStructure);

    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_USART1, ENABLE);

    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.Mode                = USART_MODE_TX;
    USART_InitStructure.HardwareFlowControl = USART_HFCTRL_NONE;
    USART_Init(USART1, &USART_InitStructure);

    USART_Enable(USART1, ENABLE);
}

int main(void)
{
    LED_Init();

    KEY_Init();

    USART_Configuration();

    printf("\r\nN32A455VEL7-EVB V1.1 %s %s", __DATE__, __TIME__);

    while (1)
    {
        GPIO_WriteBit(RLED_GPIO, RLED_PIN, GPIO_ReadInputDataBit(S3_GPIO, S3_PIN));
        GPIO_WriteBit(BLED_GPIO, BLED_PIN, GPIO_ReadInputDataBit(S4_GPIO, S4_PIN));
        GPIO_WriteBit(GLED_GPIO, GLED_PIN, GPIO_ReadInputDataBit(S5_GPIO, S5_PIN));
    }
}

int fputc(int ch, FILE* f)
{
    USART_SendData(USART1, (uint8_t)ch);
    while (USART_GetFlagStatus(USART1, USART_FLAG_TXDE) == RESET);

    return (ch);
}

5. Compile and run

5.1. Printing Output

5.2. Run the video

15

6. Attachments

N32A455VEL7-EVB V1.1_2024.02.07.zip (444.47 KB, downloads: 6)
This post is from Automotive Electronics
Personal signatureWe are a team and we work as a team !

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
BlueNRG-1/2 Flash operations require mutual exclusion with BLE events

When using the Flash of BlueNRG-1/2 to store application data, you may encounter problems such as no Bluetooth signal o ...

T6963C negative display problem

480893 I'm working on T6963C recently, and I don't quite understand the manual regarding negative display under text fea ...

【Development and application based on NUCLEO-F746ZG motor】14. Parameter configuration - motor parameter configuration

This post was last edited by annysky2012 on 2021-10-20 21:59 I haven't updated for a few days. The weather has turned c ...

How to generate bin format files in MDK

In the integrated development environment of Realview MDK , by default, debug files in *.axf format and executable files ...

[Flower carving hands-on] Interesting and fun music visualization series of small projects (19) - full-body fiber optic lamp

I suddenly had the urge to do a series of topics on music visualization. This topic is a bit difficult and covers a wide ...

[Flower carving hands-on] Interesting and fun music visualization series of small projects (22) - LED infinite cube

I suddenly had the urge to do a series of topics on music visualization. This topic is a bit difficult and covers a wide ...

Ebyte E103-W01 module adapter board trial

When I first received the package from Ebyte and opened it, I was confused. There was only the adapter base plate. After ...

What exactly is the problem?

After my graphics card broke last time, I bought a second-hand graphics card (1060 3G), and I also had a graphics card t ...

Are analog electronics such as triodes still used in electronic design today?

I would like to ask all the senior experts, do we still use analog electronic designs such as triodes in electronic desi ...

[Good book reading - "Switching Power Supply Simulation and Design - Based on SPICE"] - 005 BUCK Working Mode

This post was last edited by zyb329321151 on 2024-7-17 22:39 Buck converter ( BUCK ) operating mode discussion In a b ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list