编辑: 飞翔的荷兰人 2019-10-15
基于 Cortex-M4 内核的 Kinetis 微控制器的应用研究 中文摘要 I 基于 Cortex-M4 内核的 Kinetis 微控制器的应用研究 中文摘要 Kinetis 系列微控制器是飞思卡尔公司于

2010 年下半年推出的基于 ARM Cortex-M4 内核的微控制器, 是业内首款 Cortex-M4 内核芯片.

Cortex-M4 内核是 ARM 公司

2009 年下半年发布的最新的嵌入式内核.Cortex-M4 面向数字信号控制市场, 具有高效并且易于使用的控制和信号处理能力. Kinetis 系列微控制器内部集成 UART、SLCD、TSI、USB、以太网和 CAN 等模 块, 具有高精度的

16 位ADC 和12 位DAC. Kinetis 微控制器的市场应用主要面向工 业控制,应用领域包括电机控制、通讯、安防和加密等.由于飞思卡尔公司在

2010 年11 月才提供 Kinetis 微控制器的样片,所以现在 Kinetis 的学习资料和实例程序都 很少.受飞思卡尔公司委托,苏州大学飞思卡尔嵌入式研发中心承担该芯片的先期研 究应用任务. 本课题选择 Kinetis 系列的 K60N512 芯片为实例,设计制作了一套 Kinetis 开发 套件,包括 K60N512 核心板,Kinetis 系列扩展板和 Kinetis 芯片调试器 OSJTAG.在 嵌入式构件思想指导下,本文实现了 K60N512 的常用模块的驱动,并对模块驱动进 行了充分的验证.本文移植了实时操作系统 FreeRTOS,详细分析了 FreeRTOS 的移 植过程并对移植进行了测试,为实时操作系统在 Kinetis 芯片中的应用提供范例和参 考.为了加快 K60N512 以太网编程,本文移植了开源的嵌入式 TCP/IP 协议栈 LwIP, 详细阐述 LwIP 移植和测试过程. 为了研究 Kineits 的网络应用,同时也为了验证本课题实现的软硬件平台,本文 设计实现了基于嵌入式 Web 的短信猫.短信猫实现短信发送和接收,使用 FreeRTOS 调度任务,使用 LwIP 实现网络通讯,同时移植 Web 服务器用于人机界面.本文实现 的K60N512 核心板、Kinetis 系列扩展板、Kinetis 调试器 OSJTAG 和模块驱动程序已 经计划在

2011 年8月苏州大学飞思卡尔大学计划培训中推广. 关键词:Kinetis,驱动程序,FreeRTOS,短信猫 作者:王超艺 指导老师:王宜怀 Abstract Research on the Freescale Kinetis Microcontroller based on Cortex-M4 processer II Research on the Freescale Kinetis Microcontroller based on Cortex-M4 processer Abstract Kinetis series of microcontroller, based on ARM Cortex-M4 processor, is released by Freescale in the second half of 2010, which is the first microcontroller using ARM Cortex-M4 processor. The Cortex-M4 processor is the latest embedded processor released by ARM in the second half of

2009 specifically developed to address digital signal control markets that demand an efficient, easy-to-use blend of control and signal processing capabilities. UART, SLCD, TSI, USB, Ethernet, CAN and other common modules are integrated in the Kinetis series microcontrollers, as long as high precision 16-bit ADC and 12-bit DAC. Kinetis Microcontroller is mainly for the market of industrial control, including motor control, communication, security and encryption. Becaues the Kinetis sample is not available until November 2010, so learning materials and example programs of Kinetis are very rare. Commissioned by Freescale Company, Freescale Embeded R&

D Center of Soochow University takes an early research on the applicathin of this microcontroller. This paper take the K60N512 as an example, designs and implements a Kinetis development kit, including K60N512 core board, Kinetis expansion board and Kinetis debugger OSJTAG. Guided by the idea of embedded components, this paper implements K60N512 module driver, every driver has been sufficiently validated. This paper ports the realtime operating system FreeRTOS and analysis the port process in detail, providing an example and reference of realtime operating system in Kinetis. To speed up the K60N512 Ethernet programming, the open source embedded TCP/IP protocol stack LwIP is ported and the port process in given in detail. To study Ethernet communication with Kinetis and to verify Kineits software and hardware, this paper designs and implements a message modem based on embeded web server. The message modem uses FreeRTOS to schedule tasks and LwIP to implement internet communication and an embeded Web server is implemented as the human Research on the Freescale Kinetis Microcontroller based on Cortex-M4 processer Abstarct III interface. The K60N512 core board, Kinetis expansion board, Kinetis debugger OSJTAG and drivers achieved by this paper have been planned to promote in the Freescale university tranning of Soochow in August 2011. Key Words:Kinetis,Drivers,FreeRTOS,Message Modem Written by WangChaoyi Supervised by WangYihuai 目录

第一章 绪论.1 1.1 课题背景

1 1.2 Cortex-M 内核

3 1.2.1 Cortex-M 内核特点

3 1.2.2 Cortex-M3 内核

4 1.2.3 Cortex-M4 内核

5 1.3 设计思路

6 1.4 课题意义

7 1.5 本文工作和论文结构

9 1.5.1 本文工作

9 1.5.2 论文结构

10

第二章 硬件设计

11 2.1 K60N512 芯片简介.11 2.2 K60N512 核心板设计

12 2.2.1 电源电路

12 2.2.2 晶振电路

12 2.2.3 复位电路

13 2.2.4 JTAG 电路.14 2.2.5 状态指示电路

14 2.2.6 扩展接口电路

15 2.3 Kinetis 扩展板设计

15 2.3.1 电源转换电路

15 2.3.2 UART 模块.16 2.3.3 SD 卡模块

16 2.3.4 USB OTG

17 2.3.5 液晶和数码管模块.17 2.3.6 以太网模块

17 2.3.7 CAN 模块.18 2.2.8 其他电路

19 2.4 Kinetis JTAG 调试器

19 2.5 硬件测试

20 2.5.1 K60N512 核心板测试.21 2.5.2 Kinetis 扩展板测试

21 2.5.3 测试体会

21 2.6 本章小结

22

第三章 模块驱动程序设计.23 3.1 驱动程序设计原则

23 3.2 K60N512 启动代码实现

24 3.2.1 关闭看门狗

24 3.2.2 复制中断向量表到 RAM 中25 3.2.3 初始化芯片时钟

26 3.2.4 跳转至 main 函数执行

26 3.3 UART 软件构件设计

26 3.3.1 UART 构件实现.27 3.3.2 UART 构件测试.28 3.4 AD 软件构件设计.29 3.4.1 AD 构件实现

29 3.4.1 AD 构件测试

31 3.5 CRC 软件构件设计

32 3.5.1 CRC 构件实现

33 3.5.2 CRC 构件测试

34 3.6 Flash 软件构件设计.35 3.6.1 Flash 构件实现

35 3.6.2 Flash 构件测试

36 3.7 本章小结

37

第四章 FreeRTOS 和LwIP 的移植

38 4.1 FreeRTOS 在K60N512 上的移植

38 4.1.1 FreeRTOS 简介

38 4.1.2 FreeRTOS 和其他 RTOS 的比较

39 4.1.3 FreeRTOS 移植

39 4.1.4 FreeRTOS 移植测试

43 4.2 LwIP 在K60N512 上的移植

44 4.2.1 LwIP 简介

44 4.2.2 LwIP 结构

46 4.2.3 LwIP 移植

47 4.2.4 LwIP 测试

54 4.3 本章小节

55

第五章 基于嵌入式 Web 短信猫的设计.56 5.1 短信猫设计

56 5.1.1 系统需求

56 5.1.2 EM310.56 5.1.3 系统任务结构

57 5.1.4 系统执行流程

58 5.2 短信猫实现

59 5.2.1 EM310 驱动程序

59 5.2.2 嵌入式 Web 服务器移植.59 5.2.3 系统界面

60 5.3 本章小结

61

第六章 总结与展望

62 6.1 总结.62 6.2 展望.63 参考文献.64 公开发表的学术论文及参与的主要科研项目

68 附录 A K60N512 核心板实物图

69 附录 B Kinetis 调试器 OSJTAG 实物图

69 附录 C Kinetis 系列扩展板实物图.70 致谢.71 基于 Cortex-M4 内核的 Kinetis 微控制器的应用研究

第一章 绪论

1

第一章 绪论 Cortex-M 系列内核是 ARM 公司针对低功耗和高性能的嵌入式控制市场而开 发的内核.Cortex-M0 和Cortex-M3 系列芯片广泛的应用于智能仪表、智能卡、智 能家电、智能玩具、短距离联网应用(Zigbee 和NFC)、汽车电子和高效电机控制等 领域. ST、 TI、 NXP、 Atmel 和东芝等芯片设计公司都已经推出 Cortex-M3 的MCU[1] . Cortex-M4 是ARM 公司于

2009 年下半年推出的内核,其性能比 Cortex-M3 提高 20%[2] . 飞思卡尔的 Kinetis 系列微控制器是业内首款基于 ARM Cortex-M4 内核32 位微控制器,资源丰富、功能强大,具有巨大的市场前景和应用价值.由于

2010 年11 月下飞思卡尔才开始提供 Kinetis 芯片样片,而且 Kineits 是首款 ARM Cortex-M4 芯片,所以现在 Kinetis 和Cortex-M4 的研究资料和参考设计都很少. 受飞思卡尔公司委托,本文对 Kinetis 开发方法进行深入的研究和实践,目标 是推广该系列芯片在国内的应用.飞思卡尔公司已将本课题研究内容纳入大学计 划.本课题设计并制作了一款 K60N512 核心板和 Kinetis 系列扩展板.在嵌入式软 件工程和构件思想的指导下, 本文实现了 K60N512 GPIO、 UART、 AD、 CRC、 Flash 和网络等常用模块的软件构件,并进行了充分的测试,保障了这些软件构件稳定 性和可靠性.在这些工作的基础上, 本文移植了应用广泛的实时操作系统 FreeRTOS, 给出了详细的移植过程. 本文同时移植了开源的嵌入式 TCP/IP 协议栈, 给出了详细的移植过程,并对移植进行了测试.作为全文的引导,本章先介绍 Kinetis 微控制器的研究背景,接着给出本课题的设计思路,然后阐述 Kinetis 微控 制器应用研究的现实意义,最后给出本文所做的主要工作和组织结构. 1.1 课题背景 飞思卡尔半导体是全球领先的半导体公司,其前身为摩托罗拉公司半导体部 门,产品面向规模庞大、增长迅速的汽车、消费、工业、网络和无线市场等嵌入 式半导体产品市场.飞思卡尔公司具有超过

30 年的嵌入式处理器设计经验,技术 力量雄厚,产品线丰富,涵盖低端

8 位单片机到

64 位多........

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题