灵动Mini-F5333开发板是一款基于MM32F5333D7PV 微控制器的开发板,并具有Arduino Uno接口,利于进行功能扩展。
打开包装后,是开发板、短接子及调节电位器的小螺丝刀,见图1所示。

图1 开发板及配件
开发板有2个Type C型USB接口,其中左侧的可起到供电及USB通讯的作用,而右侧的在起供电作用的同时,还有串口通信的作用。在上电后,可见到LED在按一定的规律在变化。若按下K1键,则只有红灯在闪烁。

图2 上电效果
在使用右侧USB供电的情况下,在设备管理器中还可看到有虚拟的串口出现,见图3所示。

图3虚拟串口
若打开串口,则会观察到有图4所示的输出信息出现。

图4输出信息
为进行测试和后续的开发,需安装相应的MDK软件、芯片支持包及例程。
在安装例程后,MDK的界面如图5所示。


图5打开例程
在下载和安装芯片支持包后,即可见到该芯片支持,见图6所示。


图6芯片支持
经编译,其结果如图7所示,说明编译正常。

图7完成编译
由于开发板并未配置下载调试功能,也没配置专用的调试接口,故需要自行配备调试器来连接,见图8所示。


图8芯片支持
在连接调试器的情况下,其状态如图9所示。

图9连接状态
为进行程序下载,其烧录算法如图9加以设置。

图10 烧录算法
在下载后,其结果如图11所示,说明下载成功。

图11完成下载
在完成程序下载后,其运行效果如图12所示,即4个LED灯在同步进行闪烁,说明下载有效。

图12运行效果
至此,程序开发的环境就搭建好了。
在利用Arduino接口的情况下,可直接将I2C接口的OLED屏插入焊接的插排中来使用。

图13Arduino接口
OLED屏与开发板的连接关系为:
SCL----PB13
SDA----PB14
VCC----VDD
GND----GND
以模拟方式驱动OLED屏所定义的输出高低电平的语句为:
#define SCL_high GPIO_SetBits(GPIOB, GPIO_Pin_13)
#define SCL_low GPIO_ResetBits(GPIOB, GPIO_Pin_13)
#define SDA_high GPIO_SetBits(GPIOB, GPIO_Pin_14)
#defineSDA_low GPIO_ResetBits(GPIOB,GPIO_Pin_14)
对所用引脚的配置函数为:
void GPIO_OLED(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 ;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_High;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStruct);
}
复制代码该显示屏的初始化函数为:
void Init_OLED(void)
{
OLED_WR_Byte(0xAE,OLED_CMD);
OLED_WR_Byte(0x02,OLED_CMD);
OLED_WR_Byte(0x10,OLED_CMD);
OLED_WR_Byte(0x40,OLED_CMD);
OLED_WR_Byte(0x81,OLED_CMD);
OLED_WR_Byte(0xff,OLED_CMD);
OLED_WR_Byte(0xA1,OLED_CMD);
OLED_WR_Byte(0xC8,OLED_CMD);
OLED_WR_Byte(0xA6,OLED_CMD);
OLED_WR_Byte(0xA8,OLED_CMD);
OLED_WR_Byte(0x3f,OLED_CMD);
OLED_WR_Byte(0xD3,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0xd5,OLED_CMD);
OLED_WR_Byte(0x80,OLED_CMD);
OLED_WR_Byte(0xD9,OLED_CMD);
OLED_WR_Byte(0xF1,OLED_CMD);
OLED_WR_Byte(0xDA,OLED_CMD);
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);
OLED_WR_Byte(0x40,OLED_CMD);
OLED_WR_Byte(0x20,OLED_CMD);
OLED_WR_Byte(0x02,OLED_CMD);
OLED_WR_Byte(0x8D,OLED_CMD);
OLED_WR_Byte(0x14,OLED_CMD);
OLED_WR_Byte(0xA4,OLED_CMD);
OLED_WR_Byte(0xA6,OLED_CMD);
OLED_WR_Byte(0xAF,OLED_CMD);
OLED_WR_Byte(0xAF,OLED_CMD);
OLED_Clear();
OLED_Set_Pos(0,0);
}
复制代码实现字符串显示的函数为:
void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size)
{
unsigned char j=0;
while (chr[j]!='\0')
{ OLED_ShowChar(x,y,chr[j],Char_Size);
x+=8;
if(x>120){x=0;y+=2;}
j++;
}
}
复制代码实现显示效果的主程序为:
int main(void)
{
PLATFORM_Init();
GPIO_OLED();
Init_OLED();
OLED_Clear();
OLED_ShowString(20,0,"MM32F5333 ",16);
OLED_ShowString(20,2,"OLED TEST",16);
OLED_ShowString(20,5,"jinglixixi",16);
while(1);
}
复制代码
图14显示效果
这样就开始地为开发板配置了显示功能,后面就可利用它来承担显示任务了。