【MM32 eMiniBoard测评报告】+驱动串口屏试验
本帖最后由 yljon 于 2020-4-26 21:27 编辑试验目标:使用MM32 eMiniBoard开发板驱动串口屏试验
一、初识开发板,准备好硬件
拿到开发板,看上去很规整,全正面贴片,无手插件,无背面贴片元件:
1.供电是USB口,我要准备USB线
2.看见串口是3芯端子,我要准备3芯接头
3.有LED指示灯
有这几样就满足我测试需求了,我又准备了一个我的串口屏,齐活了。
二、搞点资料看看,电路图要搞到
上官网( www.mm32mcu.com )找些资料看看,电路图找到了:
确认了几个信息:
3芯端子是UART2,对应PA_2和PA_3
LED1对应PA15
这个信息在后面写程序要用啊,提前准备着
三、搭建环境,下个驱动才可以烧录
上官网( www.mm32mcu.com )下载USB驱动,将驱动装好后,
用USB线将开发板连接电脑,在设备管理器看见这样:
打开KEIL,在设置里看见这样,至此驱动安装就OK啦。
四、搭建环境,芯片的PACK下载安装
由于我的开发环境是KEIL,下载安装的是MindMotion.MM32L0xx_DFP.1.0.8.pack
在KEIL里看见如下就意味着PACK搞好了。
五、搞定代码,点亮屏幕
官方给的库示例有REG和LIB,我偷懒使用LIB,LED代码直接拿过用,示例中
只有UART1,不过写个UART2也不会太有难度
void LED_Init(void)
{
GPIO_InitTypeDefGPIO_InitStructure;
CFG_GPIO_Clock(GPIOA, ENABLE);
CFG_GPIO_Clock(GPIOB, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin= GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
int UART2PinConfigWithParameter2(void)
{
int result = 0;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_1);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
return result;
}
void UART2InitWithParameter(void)
{
UART_InitTypeDef UART_InitStructure;
UART_StructInit(&UART_InitStructure);
CFG_UART_Clock(UART2, ENABLE);
UART_InitStructure.BaudRate = 9600;
UART_InitStructure.WordLength = UART_WordLength_8b;
UART_InitStructure.StopBits = UART_StopBits_1;
UART_InitStructure.Parity = UART_Parity_No;
UART_InitStructure.Mode = UART_Mode_Rx | UART_Mode_Tx;
UART_InitStructure.HWFlowControl= UART_HWFlowControl_None;
UART_Init(UART2, &UART_InitStructure);
UART_Cmd(UART2, ENABLE);
}
int main(void)
{
u8 ll=0;
SendBuf='n';
SendBuf='0';
SendBuf='.';
SendBuf='v';
SendBuf='a';
SendBuf='l';
SendBuf='=';
SendBuf='1';
SendBuf=0xff;
SendBuf=0xff;
SendBuf=0xff;
delay_init();
LED_Init();
UART2PinConfigWithParameter();
UART2InitWithParameter();
while(1)
{
for (ll=0;ll<11;ll++)
{
UART_SendData(UART2, SendBuf);
mydelay();
}
SendBuf=SendBuf+1;
if(SendBuf=='9')
{
SendBuf='1';
}
delay_ms(500);
LED1_TOGGLE();
LED2_TOGGLE();
LED3_TOGGLE();
LED4_TOGGLE();
delay_ms(500);
}
}
六、学习将视频转GIF,看着方便
将上述代码编译烧录,看看效果,还可以啊,哈哈哈哈
七、开发板评价
1. 灵动的这个系列的开发板总体制作精良,用心了
2. 代码风格和ST类似,上手也快
3. 外设功能和ST有细微差异,看过手册也都能明白
4. 这块开发板的其它功能,待后续慢慢搞
5. 最后,为二姨家举办这样的活动,点赞{:handshake:}
看了这么多评测帖子,你这是最走心的一个 wziyi 发表于 2020-4-27 07:10
看了这么多评测帖子,你这是最走心的一个
谢谢{:handshake:} 感谢您的认真分享,优质内容我们送您一份小礼物~ 21ic小喇叭 发表于 2020-4-29 09:33
感谢您的认真分享,优质内容我们送您一份小礼物~
谢谢小喇叭 驱动串口屏速度快吗 gygp 发表于 2020-5-2 08:52
驱动串口屏速度快吗
速度很快,因为背景素材啥的是提前在屏里,每次只通信数据即可 感谢21IC举办的活动,感谢灵动的开发板,这是@21ic小喇叭 送的,三克油{:lol:}
手法666 gejigeji521 发表于 2020-5-21 21:26
手法666
见笑了,后续请多多指教!!!{:handshake:}
页:
[1]