1913 views|1 replies

1127

Posts

17

Resources
The OP
 

[National Technology N32G457 Review] 2. Unboxing + Lighting [Copy link]

 This post was last edited by fxyc87 on 2022-1-20 13:01

Previous post: [National Technology N32G457 Review] 1. Data Preparation

Unboxing photos: development board + MINI USB cable

I have made an empty MDK template, project template.7z click here to download

Although it was lighting, I encountered many pitfalls. For example, LED2 could not light up. Later, I read the manual and found out that the pins were used.

#include "n32g45x.h"
#include "n32g45x_gpio.h"


void Delay(uint32_t ms);
static uint32_t Tick=0;

int main(){
    //SystemInit();         .s中已调用,此处无需调用
    SystemCoreClockUpdate();
    SysTick_Config(SystemCoreClock/1000);
    
    //开启IO时钟  GPIOA,B,afio
    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA|RCC_APB2_PERIPH_GPIOB|RCC_APB2_PERIPH_AFIO,ENABLE);
    
    //PB4默认是JW-RESET 需要用该功能,见手册101页
    GPIO_ConfigPinRemap(GPIO_RMP_SW_JTAG_NO_NJTRST,ENABLE);

    //初始化IO
    GPIO_InitType gpio;
    
    gpio.Pin=GPIO_PIN_5|GPIO_PIN_4;        //LED3,LED2
    gpio.GPIO_Mode=GPIO_Mode_Out_PP;
    gpio.GPIO_Speed=GPIO_Speed_50MHz;
    
    GPIO_InitPeripheral(GPIOB,&gpio);
    
    gpio.Pin=GPIO_PIN_8;        //LED1
    gpio.GPIO_Mode=GPIO_Mode_Out_PP;
    gpio.GPIO_Speed=GPIO_Speed_50MHz;
    
    GPIO_InitPeripheral(GPIOA,&gpio);
   
    //点亮指示灯    
    while(1){
        Delay(500);
        GPIO_WriteBit(GPIOA,GPIO_PIN_8,Bit_SET);
        GPIO_WriteBit(GPIOB,GPIO_PIN_4,Bit_SET);
        GPIO_WriteBit(GPIOB,GPIO_PIN_5,Bit_SET);
        Delay(500);
        GPIO_WriteBit(GPIOA,GPIO_PIN_8,Bit_RESET);
        GPIO_WriteBit(GPIOB,GPIO_PIN_4,Bit_RESET);
        GPIO_WriteBit(GPIOB,GPIO_PIN_5,Bit_RESET);
    }
    
}

void Delay(uint32_t ms){
    SysTick->VAL=0;
    Tick=0;
    while(Tick<ms);
}
void SysTick_Handler(void){
    Tick++;
}

//end


Lighting Video


This post is from Domestic Chip Exchange
 
 

1127

Posts

17

Resources
2
 

Development board comments:

The USB interface uses MINI USB, which is a bit low-end because you can hardly find this kind of cable now.

There are also discrepancies between the development board manual and the actual situation. For example, there are three LED indicators, and the LED2 and SWD-RESET pins are multiplexed together. I can't explain this design.

The keys feel good, silent, and very soft

The development board has 4 supporting feet, which feels pretty good.

This post is from Domestic Chip Exchange
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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