创新“芯”引擎 | 国民技术N32G457 RT-Thread设计大赛审核后开发板昨天晚上发货白天到手了,为发货快递点赞。先看一下板子嘿嘿。
创建工程参考比赛提供的文章就可以,
https://club.rt-thread.org/ask/article/3274.html
添加支持包
添加板载仿真器
开发板有三个供我们开发的LED灯,分别为PB5、PB4、PA8
但是有问题创建工程后,引脚编号不正确,手中开发板为100pin引脚的芯片。查找国民技术MCU论坛:https://bbs.21ic.com/iclist-1098-1.html
发现基于RT-Thread Studio创建的工程引脚默认的是64引脚的工程。修改drv_gpio.c文件夹下的N32F10X_PIN_NUMBERS定义即引脚号就与芯片引脚一致了。
使用工程测试三个灯发现D2微亮不受控制 检查手册发现D2灯的引脚复用为JTAG引脚的NJTRST功能。因为在rtt库里面没有找到禁用JTAG的程序所以我直接调用国民科技的库直接将JTAG功能禁用,使能SW功能,灯顺利点亮流水灯程序程序源码附上,欢迎大佬指出问题。
#include <stdint.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "n32g45x_gpio.h"
#include "led.h"
#define LED1_PIN 67
#define LED2_PIN 90
#define LED3_PIN 91
void LED_Init(void)
{
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_AFIO,ENABLE);
GPIO_ConfigPinRemap(GPIO_RMP_SW_JTAG_SW_ENABLE, ENABLE);
// 设置引脚为输出方式
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
}
static void led_thread_entry(void* p)
{
LED_Init();
while(1)
{
rt_pin_write(LED1_PIN, PIN_HIGH);
rt_thread_mdelay(400);
rt_pin_write(LED1_PIN, PIN_LOW);
rt_thread_mdelay(400);
rt_pin_write(LED2_PIN, PIN_HIGH);
rt_thread_mdelay(400);
rt_pin_write(LED2_PIN, PIN_LOW);
rt_thread_mdelay(400);
rt_pin_write(LED3_PIN, PIN_HIGH);
rt_thread_mdelay(400);
rt_pin_write(LED3_PIN, PIN_LOW);
rt_thread_mdelay(400);
}
}
static int Thread_LED(void)
{
rt_thread_t thread_led= RT_NULL;
thread_led = rt_thread_create( "led",//线程名字
led_thread_entry,//线程入口函数
RT_NULL,//线程入口函数参数
1024,//分配堆栈大小
5,//线程的优先级
10);//线程所分配的时间片
if(thread_led == RT_NULL)
{
rt_kprintf("Thread_led ERROR");
return RT_ERROR;
}
rt_thread_startup(thread_led); //启动线程
}
INIT_APP_EXPORT(Thread_LED);//将线程初始化添加入系统初始化
如果有帮助点个赞吧哈哈哈
flash/ram 多大
@Juggernaut 512/144
@墨轩1 强大了
👍👍👍
基于RT-Thread Studio创建的工程错误,有人修改下吗
学到了,感谢
@Juggernaut 啥错误,可否具体说一下