在32位MCU平台间移植
STM32F10x系列移植到GD32E103系列1.0

2. 引脚兼容性
STM32F10x 与 GD32E103 在相同封装下是 Pin To Pin 兼容的。但由于外设功能上的细微差别,两 者引脚定义有少许不同,如表 1 所示。注意:STM32F10x 外设编号从 1 开始,GD32E103 外设编 号从 0 开始,且命名有差异。
Alternate:TIM8_CH3,SDIO_D0 Remap: TIM3_CH3 Default: PC
Alternate:TIM8_CH4,SDIO_D1 Remap: TIM3_CH4
Default: PA8 Alternate:USART1_CK,TIM1_CH1,
GD32E103 和 STM32F10x 系列相比,考虑软硬件兼容性,从 Flash 和 SRAM 容量,包括外设 模块的增强性能上来看,GD32E103 最接近 STM32F10x 互联性。
开始前您需要安装 GD32E103 关于 KEIL 或 IAR 的插件,在工程选项的器件条目中选择 GD32E103 对应型号,添加 GD32E103 的 Flash 下载算法。
CAN1_RX Default: PB13 Alternate:SPI1_SCK,I2S1_CK, USART2_CTS,TIMER0_CH0_ON, CAN1_TX,I2C1_TXFRAME Default: PB14 Alternate:SPI1_MISO,USART2_RTS, TIMER0_CH1_ON,TIMER11_CH0 Default: PB15 Alternate:SPI1_MOSI,I2S1_SD, TIMER0_CH2_ON,TIMER11_CH11 Default: PD15 Alternate:EXMC_D1 Remap: TIMER3_CH3,CTC_SYNC
STM8S 和 STM32 MCU 一致的 8-32 位产品线实现轻松移植

3.1 复位 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 时钟 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
● 寄存器大小:8 位与 16 或 32 位
图 1 给出了数字外设的简化表示。
图 1.
数字外设的内部结构
ഄഔ᭄ᘏ㒓 $0%$670
ᘏ㒓ষ ᆘᄬ఼
,3ݙḌ
,2
DL
外设可分成两个主要部分。首先,内核包含状态机、计数器以及任意种类的组合逻辑或顺序 逻辑,它们是执行不需要处理器的任务(如低级通信层、模拟后端管理或时序驱动的功能) 时所必需的。如有必要,可通过 MCU 端口将内核与外界连接。外部连接可能包含一些 I/O 或复杂总线。其次,应用程序通过与内部总线连接的寄存器来初始化和控制外设,该内部总 线与其它 MCU 资源共用。在 8 位微控制器中,处理器直接写入和读取寄存器,而在 32 位 产品中,寄存器读写操作通常通过总线桥来完成。然而,两个系列的主要区别在于外设必须 遵循的内部总线规范。这解释了 STM8S 和 STM32 器件能够共用外设的原因:它们基于相 同的内核,而且仅针对两种不同的总线接口定制。ARM 处理器和外设符合 AMBA 总线规 范,采用 32 位数据总线,而 STM8S 器件使用更为简单但有效的 8 位总线标准。从功能角 度看,它们仅在以下方面存在差异:
2
NXPS32K11632位ARMMCU通用汽车应用解决方案

nxp公司的S32K116是满足AEC-Q100规范的基于ARM® Cortex®-M4F和ARM® Cortex®-M0+核32位MCU,集成了128KB闪存,CAN/CAN-FD控制器,遵从SHE指标的安全模块,工作电压2.7 V 到 5.5 V, RUN模式工作温度-40℃到105℃,RUN模式工作温度-40℃到125℃,主要用在汽车电子如车身和底盘控制,信息娱乐系统连接模块,车内空调控制(HVAC),车窗/车门/天窗,动力总成配套芯片以及PMSM/BLDC电机控制,停车辅助系统,发动机防盗锁止系统,触摸感应,安防性应用,摩托车CDI/EFI,电池管理,安全气囊,尾气后处理以及网关以及高可靠性工业应用.本文介绍了S32K116主要特性,S32K14x和S32K11x系列高级架构框图,评估板S32K116EVB主要特性和电路图.S32K is a scalable family of AEC-Q100 qualified 32-bit Arm® Cortex®-M4F and Cortex-M0+ based MCUs targeted for general purposeautomotive and high-reliability industrial applications.The S32K1xx product series further extends the highly scalable portfolio of Arm®Cortex®-M0+/M4F MCUs in the automotive industry. It builds on the legacy of the KEA series, while introducing higher memory optionsalongside a richer peripheral set extending capability into a variety ofautomotive applications. With a 2.70–5.5 V supply and focus onautomotive environment robustness, the S32K product series devices are well suited to a wide range of applications in electrically harshenvironments, and are optimized for cost-sensitive applications offeringlow pin-count options.The S32K product series offers a broad range of memory, peripherals, and package options. It sharescommon peripherals and pin counts,allowing developers to migrate easily within anMCU family or among the MCU families to take advantage of more memory or feature integration. This scalability allows developers to use the S32K product series as the standard for their end product platforms, maximizing hardware andsoftware reuse and reducing time to market.sS32K116主要特性:• Operating characteristics– Voltage range: 2.7 V to 5.5 V– Ambient temperature range: -40℃ to 105℃ forHSRUN mode, -40℃ to 125℃ for RUN mode• Arm™ Cortex-M4F/M0+ core, 32-bit CPU– Supports up to 112 MHz frequency (HSRUN mode)with 1.25 Dhrystone MIPS per MHz– Arm Core based on the Armv7 Architecture andThumb?-2 ISA– Integrated Digital Signal Processor (DSP)– Configurable Nested Vectored Interrupt Controller(NVIC)– Single Precision Floating Point Unit (FPU)• Clock interfacesNXP S32K11632位ARM MCU通用汽车应用解决方案– 4 - 40 MHz fast external oscillator (SOSC) with upto 50 MHz DC external square input clock inexternal clock mode– 48 MHz Fast Internal RC oscillator (FIRC)– 8 MHz Slow Internal RC oscillator (SIRC)– 128 kHz Low Power Oscillator (LPO)– Up to 112 MHz (HSRUN) System Phased LockLoop (SPLL)– Up to 20 MHz TCLK and 25 MHz SWD_CLK– 32 kHz Real Time Counter external clock(RTC_CLKIN)• Power management– Low-power Arm Cortex-M4F/M0+ core withexcellent energy efficiency– Power Management Controller (PMC) with multiplepower modes: HSRUN, RUN, STOP, VLPR, andVLPS. Note: CSEc (Security) or EEPROM writes/erase will trigger error flags in HSRUN mode (112MHz) because this use case is not allowed toexecute simultaneously.The device will need toswitch to RUN mode (80 Mhz) to execute CSEc(Security) or EEPROM writes/erase.– Clock gating and low power operation supported onspecific peripherals.• Memory and memory interfaces– Up to 2 MB program flash memory with ECC– 64 KB FlexNVM for data flash memory with ECCand EEPROM emulation. – Up to 256 KB SRAM with ECC– Up to 4 KB of FlexRAM for use as SRAM orEEPROM emulation Note: CSEc (Security) orEEPROM writes/erase will trigger error flagsinHSRUN mode (112 MHz) because this use case isnot allowed to execute simultaneously. The devicewill need to switch to RUN mode (80 MHz)toexecute CSEc (Security) or EEPROM writes/erase.– Up to 4 KB Code cache to minimize performanceimpact of memory access latencies– QuadSPI with HyperBus™ support• Mixed-signal analog– Up to two 12-bit Analog-to-Digital Converter(ADC) with up to 32 channel analog inputs permodule– One Analog Comparator (CMP) with internal 8-bitDigital to AnalogConverter (DAC)• Debug functionality– Serial Wire JTAG Debug Port (SWJ-DP) combines– Debug Watchpoint and Trace (DWT)– Instrumentation Trace Macrocell (ITM)– Test Port Interface Unit (TPIU)– Flash Patch and Breakpoint (FPB) Unit• Human-machine interface (HMI)– Up to 156 GPIO pins with interrupt functionality– Non-Maskable Interrupt (NMI)• Communications interfaces– Up to three Low Power Universal Asynchronous Receiver/Transmitter(LPUART/LIN) modules with DMA supportand low power availability– Up to three Low Power Serial Peripheral Interface (LPSPI) modules with DMA support and low power availability– Up to two Low Power Inter-Integrated Circuit (LPI2C) modules with DMA support and low power availability– Up to three FlexCAN modules (with optional CAN-FD support)– FlexIO module for emulation of communication protocols and peripherals (UART, I2C, SPI, I2S, LIN, PWM, etc).– Up to one 10/100Mbps Ethernet with IEEE1588 support and twoSynchronous Audio Interface (SAI) modules.• Safety and Security– Cryptographic Services Engine (CSEc) implements a comprehensive set of cryptographic functions as described in theSHE (Secure HardwareExtension) Functional Specification. Note: CSEc (Security) or EEPROMwrites/erase willtrigger error flags in HSRUN mode (112 MHz) because this use case is not allowed to execute simultaneously.Thedevice will need to switch to RUN mode (80 MHz) to execute CSEc(Security) or EEPROM writes/erase.– 128-bit Unique Identification (ID) number– Error-Correcting Code (ECC) on flash and SRAM memories– System Memory Protection Unit (System MPU)– Cyclic Redundancy Check (CRC) module– Internal watchdog (WDOG)– External Watchdog monitor (EWM) module• Timing and control– Up to eight independent 16-bit FlexTimers (FTM) modules, offering up to 64 standard channels (IC/OC/PWM)– One 16-bit Low Power Timer (LPTMR) with flexible wake up control– Two Programmable Delay Blocks (PDB) with flexible trigger system– One 32-bit Low Power Interrupt Timer (LPIT) with 4 channels– 32-bit Real Time Counter (RTC)• Package– 32-pin QFN, 48-pin LQFP, 64-pin LQFP, 100-pin LQFP, 100-pin MAPBGA, 144-pin LQFP, 176-pin LQFP packageoptions• 16 channel DMA with up to 63 request sources usingDMAMUXapplications, which include but not limited to:• Exterior and interior lighting• HVAC• Door/Window/Wiper/Seat controller• BLDC/PMSM motor control• Park assistant• E-shifter• TPMS• Real time control in infotainment system• Battery management system• Human machine interface such as touch sense control • Secured vehicle data transfer• Safety controller• Over the air update图1:S32K14x系列高级架构框图图2:S32K11x系列高级架构框图。
RISC-V MCU的FreeRTOS移植与应用开发

4M i c r o c o n t r o l l e r s &E m b e d d e d S ys t e m s 2021年第1期w w w .m e s n e t .c o m .c nR I S C V M C U 的F r e e R T O S 移植与应用开发付元斌,张爱华,何小庆(北京麦克泰软件技术有限公司,北京100085)摘要:具有相同的R I S C V 指令集的处理器实现并不相同㊂本文将针对基于R I S C V 开源指令集的处理器芯片G D 32V F 103M C U ,介绍F r e e R T O S 在I A R E WR I S C V 编译和开发环境下的移植过程㊂采用R T O S 后,嵌入式系统很难监控系统的运行时行为㊁发现应用存在的问题,本文基于T r a c e a l y z e r 分析工具直观地跟踪系统行为,分析系统中可能的错误,提高代码的鲁棒性㊂关键词:B u m b l e b e e 内核;T r a c e a l yz e r ;F r e e R T O S 移植;R I S C V 处理器中图分类号:T P 316.2 文献标识码:AP o r t i n g a n d A p p l i c a t i o n D e v e l o pm e n t o f F r e e R T O S B a s e d o n R I S C V M C U F u Y u a n b i n ,Z h a n g A i h u a ,H e X i a o q i n g(B e i j i n g M i c r o t e c R e s e a r c h S o f t w a r e T e c h n o l o g y C o .L t d .,B e i j i n g 100085,C h i n a )A b s t r a c t :P r o c e s s o r i m p l e m e n t a t i o n s w i t h t h e s a m e R I S C V i n s t r u c t i o n s e t a r e n o t t h e s a m e .T h i s p a p e r w i l l i n t r o d u c e t h e m i gr a t i o n p r o c e s s o f F r e e R T O S u n d e r I A R E WR I S C V e n v i r o n m e n t f o r t h e p r o c e s s o r c h i p G D 32V F 103b a s e d o n R I S C V o p e n s o u r c e i n s t r u c -t i o n s e t .W i t h t h e R T O S ,i t i s d i f f i c u l t t o m o n i t o r t h e r u n t i m e b e h a v i o r o f t h e s y s t e m a n d f i n d p r o b l e m s i n t h e a p pl i c a t i o n .T h i s a r t i c l e w i l l u s e t h e T r a c e a l y z e r a n a l y s i s t o o l t o v i s u a l l y s y s t e m b e h a v i o r ,a n a l y z e p o s s i b l e e r r o r s i n t h e s y s t e m ,a n d i m pr o v e t h e r o b u s t n e s s o f t h e c o d e .K e yw o r d s :B u m b l e b e e K e r n e l ;T r a c e a l y z e r ;F r e e R T O S p o r t i n g ;R I S C V M C U 0 引 言R I S C V 是基于精简指令集(R I S C )原则的开源指令集架构(I S A ),具有良好的应用前景㊂目前R I S C V 架构的处理器陆续发布,其生态环境及应用也在不断丰富,但相对于A R M 架构,R I S C V 的应用还处于起步阶段,复杂的应用需要R T O S 支撑㊂目前许多R T O S ,如μC /O SI I I ㊁F r e e R T O S ㊁R T T h r e a d ㊁Z e p h y r O S ㊁e m b O S 等,都提供了对R I S C V 处理器的支持㊂采用了R T O S 后,传统的调试手段很难监控系统的实时行为,在R T O S 上进行开发时需要额外的工具和方法验证你的软件行为,提高代码的可靠性㊂本文使用兆易创新的G D 32V F 103V E V A L 开发板,基于I A R E W R I S C V 编译和开发环境,介绍如何将F r e e R T O S移植到G D 32V F 103上,并使用P e r c e p i o 的T r a c e a l y z e r 工具分析基于F r e e R T O S 的应用程序运行时行为㊂1 G D 32V F 103R I S C V M C UG D 32V F 103R I S C V M C U 基于N u c l e i B u m b l e b e e内核,芯片提供了108MH z 的主频,以及16~128K B 的片上闪存和6~32K B 的S R AM ,具有多个通用定时器和多通道D MA 控制器㊂G D 32V F 103M C U 的中断控制器(E C L I C )提供了多达68个外部中断并可嵌套16个可编图1 G D 32V F 103V E V A L 评估板程优先级,G D 32V F 103M C U 支持多种外设如U A R T ㊁S P I ㊁I 2C ㊁G P I O 等㊂GD 32V F 103VE V A L 评估板(见图1)使用G D 32VF 103V B T 6作为主控制器,板载J T A G接口以及丰富的外设资源㊂R T O S 在G D 32V F 103上的移植仅使用了内核相关的资源㊂N u c l e i B u m b l e b e e 内核支持R V 32I MA C 指令集架构;特权模式支持机器模式和用户模式,可以实现R T O S 与应用的隔离,提升软件安全;寄存器组包含32个通用寄存器㊁R I S CV 标准的状态寄存器以及内核自定义敬请登录网站在线投稿(t o u g a o.m e s n e t.c o m.c n)2021年第1期5的C S R寄存器㊂内核提供了计时器单元(T i m e r U n i t, T I M E R),产生的计时器中断和软件中断可以用于R T O S 时钟节拍处理和任务切换㊂B u m b l e b e e内核支持在R I SC V标准C L I C基础上优化而来的改进型内核中断控制器(E n h a n c e d C o r e L o c a l I n t e r r u p t C o n t r o l l e r,E C L I C),用于管理所有的中断源㊂E C L C的每个中断源可以配置为向量或非向量处理模式㊂向量模式中断被处理器内核响应后,处理器直接跳入该中断的向量入口存储的目标地址;非向量模式中断被处理器响应后,处理器直接跳入所有中断共享的入口地址㊂但中断响应时,处理器硬件不会保存上下文,需要软件实现㊂2F r e e R T O S和T r a c e a l y z e r介绍F r e e R T O S是英国人R i c h a r d B a r r y2003年发布的开源实时内核㊂F r e e R T O S支持超过35种C P U架构,是世界最受开发者欢迎的R T O S,在2017年每3分钟就有一次下载㊂F r e e R T O S有一个系列软件,包括F r e e R T O S(开源版本)㊁O p e n R T O S(授权版本)㊁S A F E R T O S(安全版本)和A m a z o n F r e e R T O S(开源物联网操作系统),开源的F r e e R T O S遵循M I T l i c e n s e模式㊂在多线程软件系统中,R T O S带来的复杂度让源代码和运行时行为的关联变得不那么明显,传统的调试器不足以理解系统的行为,特别是运行时行为㊂P e r c e p i o的T r a c e a l y z e r工具运行在W i n d o w s或L i n u x P C上,可用于目标系统运行L i n u x㊁F r e e R T O S㊁O p e n R T O S㊁S A F E R T O S㊁W i n d R i v e r V x W o r k s㊁μC/O SI I I和e m b O S的R T O S应用行为分析㊂2.1F r e e R T O S的功能F r e e R T O S支持抢占和时间片轮询两种任务调度方式,支持无限数量的应用任务;提供队列㊁信号量㊁互斥信号量㊁事件标志等内核机制,满足任务间同步及通信需求;此外,针对低功耗应用提供了t i c k l e s s模式㊂最新版本F r e e R T O S提供了针对I A R及G C C工具链的标准R I S C V处理器内核移植示例,支持32位及64位架构内核(R V32I和R V64I)㊂它包含了预配置的O p e n I S A V E G-A b o a r d㊁S i F i v eH i F i v e开发板㊁Q E MU模拟器以及用于M i c r o c h i p M2G L025开发板的A n t m i c r o R e n o d e模拟器示例,可以扩展支持任何RI S C V处理器,但因为每种R I S C V处理器在微架构实现上的不同,需要有移植的工作㊂2.2T r a c e a l y z e r分析工具T r a c e a l y z e r软件工具能够快速㊁轻松地收集多任务软件有用和有意义的行为,可以快速集成到现有的开发环境,通过快照模式或流模式采集系统运行时数据㊂T r a c e-a l y z e r提供超过30种视图可视化R T O S运行时行为,视图间以直观的方式相互关联,洞察运行时行为(包括任务运行时间信息㊁各任务之间的通信流㊁C P U的使用率等),帮助开发人员解决问题,提高软件的可靠性,改善软件的性能㊂3F r e e R T O S移植到G D32V F103M C UF r e e R T O S内核绝大部分都采用C语言编写,只有与处理器相关的上下文切换采用汇编语言实现,目的是保证上下文切换的效率㊂将F r e e R T O S移植到G D32V F103 M C U上的关键要点是实现以下4个步骤:开启和关闭中断的方式;进入和退出临界区的方式;产生周期性的中断作为系统的时钟节拍;任务的上下文切换㊂3.1中断管理和临界区实现代码的临界区也称为代码的临界段,这部分代码在执行时不允许被打断㊂F r e e R T O S的临界区通过关中断来实现,在进入临界段之前须关中断,而临界段代码执行完毕后要立即开中断㊂G D32V F103M C U的E C L I C中断控制器有一个中断目标阈值级别寄存器(m t h),可以实现部分中断屏蔽,优先级别低于该阈值的中断将不会被响应㊂在移植F r e e R T O S时,通过设置m t h来实现开关中断,对于优先级别比阈值高的中断则不受F r e e R T O S管理,中断不存在额外的延迟㊂3.2系统时钟节拍支持操作系统需要一个时钟节拍,以实现系统的延时㊁超时等与时间相关的处理㊂时钟节拍是特定的周期性中断,中断的周期就是节拍的时间㊂节拍的时间长短根据实际应用决定,时钟节拍的频率越高,系统的开销就越大㊂R I S C V架构定义了一个64位宽度的m t i m e计数器,当m t i m e计数值增加到与m t i m e c m p寄存器预设的值相等时,可以产生中断㊂选择m t i m e计数器来产生系统时钟节拍,根据m t i m e的时钟频率和系统节拍频率算出m t i m e c m p的值,当中断发生后,通过改写m t i m e c m p或者m t i m e的值来清除中断㊂3.3实现上下文切换上下文是某一时间点C P U的寄存器内容,F r e e R T O S 能够正确完成任务调度的关键是上下文切换㊂上下文切换的过程包括:把即将退出运行态的任务的运行现场保存到其任务堆栈;从下一个要运行的任务的堆栈中恢复它的运行现场㊂上下文切换的时间应尽可能短,一般由汇编代码编写,作为操作系统移植的一部分㊂上下文切换分为任务级别及中断级别的切换㊂上下文切换的代码通常放在异常处理程序中,该异常的优先级别应设置为最低㊂在R I S C V架构的处理器上,能够用来作为任务切6M i c r o c o n t r o l l e r s &E m b e d d e d S ys t e m s 2021年第1期w w w .m e s n e t .c o m .c n换的异常有两种:e c a l l 异常和软件中断㊂e c a l l 异常通过调用e c a l l 指令来触发;软件中断通过往m s i p 寄存器写 1 触发,写 0 清除㊂G D 32V F 103的软件中断连接到E C L I C 单元进行统一管理㊂我们实现的F r e e R T O S 移植选用软件中断作为上下文切换的实现机制㊂3.4 移植文件修改F r e e R T O S 与处理器相关的移植代码存储在p o r t -m a c r o .h ㊁po r t A S M.s 和p o r t .c 三个文件当中㊂p o r t m a c -r o .h 头文件定义了F r e e R T O S 使用的数据类型㊁进入和退出临界区的宏㊁实现开关中断的宏,以及触发和清除软件中断的宏㊂po r t A S M.s 中用汇编语言实现v P o r t S t a r t F i r s t T a s k ()函数,用于启动第一个任务,它的核心操作是从p x C u r r e n t -T C B 中取出当前就绪任务中优先级最高任务的堆栈指针S P ,通过S P 恢复寄存器现场㊂此外,实现软件中断的服务函数e c l i c _m s i p _h a n d l e r ()将当前的寄存器现场(通用寄存器x 1㊁x 5~x 31,机器模式状态寄存器m s t a t u s 以及机器模式异常P C 寄存器m e p c )保存到当前在运行任务的堆栈当中,然后从p x C u r r e n t T C B 取出下一个就绪中优先级最高任务的堆栈指针S P 恢复寄存器现场,完成任务的上下文切换㊂po r t .c 文件中重点实现堆栈初始化函数p x P o r t I n i t i a -l i s e S t a c k ()㊁启动F r e e R T O S 调度器特定的处理函数x P o r t S t a r t S c h e d u l e r ()㊁系统时钟节拍定时器初始化函数v P o r t S e t u p T i m e r I n t e r r u pt (),以及系统时钟节拍中断服务函数x P o r t S y s T i c k H a n d l e r ()㊂这几个函数分别需要根据R I S C V 架构和G D 32V F 103M C U 硬件特性来实现其功能㊂3.5 移植测试和验证验证移植采用调试和借助相应的辅助工具来进行,使用I A R E WR I S C V 建立项目,在代码中创建两个用户任务进行调试,代码调试时需要验证:①通过在系统时钟节拍I S R 和软件中断I S R 中添加断点,结合R I S C V 的m t i m e 和m c y c l e 寄存器验证系统时钟节拍正确产生,且软件中断能够正常触发㊂②启动第一个任务时,通过添加断点查看从任务堆栈中恢复的寄存器内容是否与堆栈初始化时写入的内容一致,从而测试p x P o r t I n i t i a l i s e S t a c k ()和v P o r t S t a r t F i r s t -T a s k()函数的工作正确性㊂③在执行任务上下文切换时,在软件中断服务程序中添加断点,单步执行,同时通过E WR I S C V 的m e m o r y 观察窗口查看压栈到当前任务堆栈中的内容是否与对应的寄存器内容相同;在恢复下文时,检查从下一个执行任务堆栈中恢复的寄存器内容是否与堆栈中的一致㊂验证e c l i c _m s i p_h a n d l e r ()软件中断服务函数的上下文切换正确性㊂④启动第一个任务和任务上下文切换的代码验证能正常工作,移植的F r e e R T O S 已可以实现基本的任务调度,接着再继续测试开关中断操作和临界区是否正常㊂测试开关中断需要增加另外一个外设中断,将其优先级别分别设置大于或小于m t h 阈值进行测试,代码中手动调用开关中断操作A P I ,检测中断触发是否与设计的模式一致,验证F r e e R T O S 对中断的控制㊂采用同样的方法测试进入和退出临界区㊂⑤通过F r e e R T O S 系统服务调用测试,测试系统的各项服务(如信号量㊁消息队列㊁事件标志等)是否正常,并测试在受F r e e R T O S 管理的I S R 中发信号㊁消息等操作是否正确㊂基础调试测试都通过之后,已经基本可以验证移植是否成功㊂在此基础上还可以借助额外的工具继续验证,例如通过E WR I S C V 自带的F r e e R T O S 调试插件显示的信息进行确认(如图2所示)㊂图2 E W R I S C V R T O S 调试插件T a s k 窗口4 T r a c e a l yz e r 分析工具的应用4.1 移植跟踪记录器库T r a c e a l yz e r 的跟踪记录器库是运行在嵌入式目标端的一个软件库,与F r e e R T O S 项目集成在一起,负责记录R T O S 在运行时产生的事件㊂记录的事件如果是存储在R AM 中,这种工作方式称为快照模式(S n a p s h o t );如果是通过通信端口实时发送到P C 端软件,则工作在流模式(S t r e a m i n g)㊂跟踪记录器库不依赖于处理器硬件,只需要使用一个高精度的定时器产生时间戳,为记录的事件添加时间信息㊂R I S C V 架构的处理器可以利用内核的m c y c l e 计数器来产生时间戳,m c y c l e 是一个64位的计数器,对C P U 的周期进行计数,所以频率与C P U 时钟相同,精度非常高㊂m c y c l e 由两个32位的寄存器组成,T r a c e a l y z e r 只需要使用低32位寄存器㊂在t r c H a r d w a r e P o r t .h 中定义G D 32V F 103的时间戳实现接口:#d e f i n e T R C _HW T C _T Y P E T R C _F R E E _R U N N I N G _32B I T _I N -C R#d e f i n e T R C _HWT C _C O U N T r e a d _c s r (m c yc l e )#def i n e T R C _HWT C _P E R I O D 0敬请登录网站在线投稿(t o u ga o .m e s n e t .c o m.c n )2021年第1期7#d e f i n e T R C _HWT C _D I V I S O R 4#d e f i n e T R C _HWT C _F R E Q _H Z T R A C E _C P U _C L O C K _H Z #d e f i n e T R C _I R Q _P R I O R I T Y _O R D E R 1T r a c e a l y z e r 也需要实现临界区,防止在记录事件时发生任务切换,导致产生错误㊂实现是通过关中断,可以直接使用F r e e R T O S 的关中断机制在t r c K e r n e l P o r t .h 中实现临界区的宏接口:#d e f i n e T R A C E _A L L O C _C R I T I C A L _S E C T I O N ()i n t __i r q _s t a t u s;#d e f i n e T R A C E _E N T E R _C R I T I C A L _S E C T I O N ()__i r q _st a -t u s =p o r t S E T _I N T E R R U P T _MA S K _F R OM _I S R ();#d e f i n e T R A C E _E X I T _C R I T I C A L _S E C T I O N ()po r t C L E A R _I N T E R R U P T _MA S K _F R OM _I S R (__i r q_s t a t u s );以上是将T r a c e a l yz e r 跟踪记录器库移植到一款处理器上需要做的工作㊂4.2 跟踪并分析F r e e R T O S 应用将T r a c e a l yz e r 跟踪记录器库添加到E WR I S C V 的F r e e R T O S 项目中,并进行必要的配置,工作在快照模式㊂在应用代码中创建4个任务,分别为L e d 1T a s k~L e d 3T a s k ㊁B u t t o n T a s k ,任务优先级依次递增,程序运行一段时间,将快照数据通过E WR I S C V 保存成H e x 文件并加载到P C 端的T r a c e a l yz e r 中进行分析㊂如图3所示,通过水平时间轴视图查看各个任务的执行情况:每个任务或中断占一行,从左向右为时间轴的方向,行中有色矩形为该任务或中断的一次执行实例㊂由时间轴窗口可以快速地预览整个运行过程中系统的执行情况,放大窗口的时间分辨率之后可以仔细了解任务执行时相关的内核事件和时间信息㊂图3 T r a c e a l yz e r 水平时间轴视图4.3 任务的时间量分析R T O S 的任务或者中断称为参与者(A c t o r),参与者的一次执行称为实例㊂分析任务的执行通常需要了解如下几种时间:起始和结束时间,参与者实例的开始和结束时间;执行时间,参与者实例使用的C P U 时间量,不包括抢占;响应时间,从参与者实例开始到结束的时间(更确切地说,任务的响应时间是从任务开始准备就绪时计算的,即内核将任务的调度状态设置为就绪的时间);等待时间,图4所示实例中参与者实际没有执行的时间,计算方式为[(结束时间开始时间)(执行时间)];启动时间,从任务就绪到开始执行之间的这段时间㊂图4 F r e e R T O S 分析基础实例的时间关系(场景2发生了抢占)以L e d 3T a s k 的第38个实例(如图5所示)为例,等待时间为从任务就绪到任务代码开始执行的这段时间,时长为7μs ,因为该实例未发生被抢占的情况,所以这7μs 的时间是完成任务上下文切换所需的时间㊂图5 L e d 3T a s k 任务实例38的时间量通过跟踪到的事件和记录的时间戳信息,T r a c e a l yz e r 能够生成多种视图来观测系统运行时存在的问题,例如设计缺陷导致的线程饥饿㊁死锁等,以及发现系统中不必要的延迟,帮助开发者解决系统的问题,提高嵌入式系统的实时性㊂这些问题使用传统调试手段难以发现,而且效率不高㊂5 结 语本文介绍了基于R I S C V 指令集的微控制器G D 32V F 103在I A R E W R I S C V 工具链上移植F r e e R T O S的过程,以及对移植的系统进行验证的方法㊂在此基础上移植T r a c e a l y z e r 跟踪记录器库,并通过跟踪F r e e R T O S 系统运行进一步观测系统的运行,并对任务的执行进行了分析㊂嵌入式与物联网是R I S CV 最活跃的应用市场,R I S C V 给嵌入式系统开发带来许多优势,越来越多的开发者开始尝试R I S C V ㊂以上工作对于基于R T O S 技术的R I S C V 嵌入式开发与应用会有所帮助㊂参考文献[1]芯来科技.B u m b l e b e e 内核指令架构手册[E B /O L ].[202009].h t t p s ://w w w.r i s c v m c u .c o m /qu i c k s t a r t q u i c k s t a r t i n d e x u p d f i d 8.h t m l .2626M i c r o c o n t r o l l e r s &E m b e d d e d S ys t e m s 2021年第1期w w w .m e s n e t .c o m .c n在D C A S E 2019测试集和U r b a n S o u n d 8K 测试集上,模型的识别精度如表1和表2所列,并且与一些最新的方法进行了对比㊂表1 精度比较(D C A S E 2019)模 型测试精度(D C A S E )A u d i o R e s n e t80.2%R e s N e t l i k e m o d e l [14]76.6%B a s e l i n e s ys t e m [15]62.5%表2 与其他方法的精度比较模 型测试精度(U r b a n S o u n d 8K )A u d i o R e s n e t76.4%U n s u p e r v i s e d f e a t u r e l e a r n i n g[16]73.6%B a s e l i n e s ys t e m [17]68%从表中可以看到,与其他先进的分类方法相比,本文提出的A u d i o R e s ne t 模型在分类精度上有较大提高㊂4 结 语本文针对声源目标分类中小样本训练时分类模型性能不佳的问题,使用深度学习方法对不同声源发出的声音数据进行分类,使用l o g me l 声谱图特征作为特征预提取方法,采用基于R e s n e t 网络结构的分类模型对预提取特征数据进行分类处理,建立了识别效果良好的深度学习声信号分类模型A u d i o R e s n e t ㊂该模型性能在D C A S E 2019和U r b a n S o u n d 8K 数据集上得到了验证,实现了良好的效果,在声源探测领域具有一定的工程应用价值㊂参考文献[1]I S N A R D V ,C HA S T R E S V ,V I A U DD E L MO N I ,e t a l .T h e t i m e c o u r s e o f a u d i t o r y r e c o g n i t i o n m e a s u r e d w i t h r a pi d s e q u e n c e s o f s h o r t n a t u r a l s o u n d s [J ].S c i e n t i f i c R e po r t s ,2019,9(1):8005.[2]樊新海,石文雷,张传清.基于V M D 多尺度熵和A B C S V M 的装甲车辆识别[J ].装甲兵工程学院学报,2018,32(6):6873.[3]孙国强,樊新海,石文雷.基于M F C C 和支持向量机的装甲车辆识别研究[J ].国外电子测量技术,2017,36(10):3135.[4]R U B E N G O N Z A L E ZH E R N A N D E Z F ,P A S T O RS A N C H E Z F E R N A N D E Z L ,S U A R E Z G U E R R A S ,e ta l .M a r i n e m a mm a l s o u n d c l a s s i f i c a t i o nb a s e d o n a p a r a l l e lr e c o g n i t i o n m o d e l a n d o c t a v e a n a l y s i s [J ].A p pl i e d A c o u s t i c s ,2017(119):1728.[5]S A N C H E Z F E R N A N D E Z L P ,S A N C H E Z P E R E Z L A ,C A R B A J A L H E R N A NDE Z J J ,e t a l .A i r c r a f t C l a s s i f i c a t i o na n d A c o u s t i c I m pa c t E s t i m a t i o n B a s e d o n R e a l T i m e T a k e o f f N o i s e M e a s u r e m e n t s [J ].N e u r a l P r o c e s s i n g Le t t e r s ,2013,38(2):239259.[6]陈心昭.噪声源识别技术的进展[J ].合肥工业大学学报(自然科学版),2009,32(5):609614.[7]竺乐庆,张真.基于M F C C 和GMM 的昆虫声音自动识别[J ].昆虫学报,2012,55(4):466471.[8]石文雷,樊新海,张传清.基于频谱动态特征和C S S VM 的装甲车辆识别[J ].计算机应用,2018,38(S 1):4447,72.[9]董语诗,时浏艺,丁一坤.基于HMM 的声场景分类[J ].信息化研究,2018,44(3):3947,52.[10]中兴通讯采用英特尔F P G A 在深度学习上取得性能突破[J ].单片机与嵌入式系统应用,2017,17(3):88.[11]庞悦,赵威,张雅楠,等.基于深度学习的L S T M 的交通流量预测[J ].单片机与嵌入式系统应用,2019,19(3):7275.[12]王枫,陈小平.C N N 深度学习的验证码识别及A n d r o i d 平台移植[J ].单片机与嵌入式系统应用,2019,19(7):2022,73.[13]P I R O T T A E ,M E R C HA N T N D ,T HOM P S O N P M ,e t a l .Q u a n t i f y i n g th e e f f e c t o f b o a t d i s t u r b a n c e o n b o t t l e n o s e d o l -p h i n f o r a g i n g a c t i v i t y[J ].B i o l C o n s e r v ,2015(181):8289.[14]N g u y e n T ,P e r n k o pf F .A c o u s t i c S c e n e C l a s s i f i c a t i o n w i t h M i s m a t c h e d R e c o r d i ng D e v i c e s U s i n g M i x t u r e o f E x pe r t s L a ye r [C ]//2019I E E E I n t e r n a t i o n a l C o nf e r e n c e o n M u l t i -m e d i a a n d E x po (I C M E ),2019.[15]M e s a r o s A ,H e i t t o l a T ,V i r t a n e n T.A m u l t i d e v i c e d a t a s e tf o r u r b a n a c o u s t i c s c e n e c l a s s i f i c a t i o n [J ].2018,a r X i v :1807.09840.[16]S a l a m o n J ,J a c o b y C ,B e l l o J P .A D a t a s e t a n d T a x o n o m yf o r U r b a n S o u n d R e s e a r c h [C ]//a c m I n t e r n a t i o n a l C o n f e r e n c eo n M u l t i m e d i a ,2014.[17]S A L AMO N J ,J A C O B Y C ,B E L L O J P .A D a t a s e t a n d T a x -o n o m y f o r U r b a n S o u n d R e se a r c h [C ]//p r o c e e d i n gs o f t h e a c m I n t e r n a t i o n a l C o n f e r e n c e o n M u l t i m e d i a ,2014.王鹏程(硕士研究生),主要研究方向为信息探测与处理㊂(责任编辑:薛士然 收稿日期:2020-07-20) [2]胡振波.R I S C V 架构与嵌入式开发快速入门[M ].北京:人民邮电出版社,2019.[3]何小庆.3种物联网操作系统分析与比较[J ].微纳电子与智能制造,2020(3).[4]D A V I D P A T T E R S O N ,A N D R E W W A T E R M A N.R I S CV手册:一本开源指令集的指南,2018.[5]U s i n g Fr e e R T O S o n R I S C V M i c r o c o n t r o l l e r s [E B /O L ].[202009].h t t p s ://w w w.f r e e r t o s .o r g /U s i n g Fr e e R T O S o n R I S C V.h t m l .[6]J i m C o o l i n g .R e a l t i m e O p e r a t i n g S ys t e m s B o o k 2T h e P r a c t i c e [M ].M a r k f i e l d :L i n d e n t r e e A s s o c i a t e s ,2017.(责任编辑:芦潇静 收稿日期:2020-09-10)。
航顺高性能32位MCU系列产品特点及其产品应用介绍

1前言传统的低功耗MCU设计都是以8位MCU为主,因为8位内核阈门相对较少,运行或泄露电流低,售价也相对低廉。
但是,随着物联网、5G、云计算、大数据以及智慧城市、智慧家庭、智慧园区的应用,8位内处理效率已经不能满足市场需求。
近年来,鉴于以下缘由,32位低功耗MCU得以兴起。
①手持式消费性电子产品与无线功能的需求越来越高、设计越来越复杂,要提高性能的同时又要兼顾低功耗,需要有一高性能低功耗的主控MCU来作为平台。
②工业上的智能化也在展开,如远程监控、数字化、网络化等。
简单说来,就是人物之连结(云端应用)、物物之连结(物联网)需求越来越多,导致产品功能越来越复杂,运算量越来越高,③制程微缩技术的进步,嵌入式闪存制程普及化及降价,主要成本来自内存大小及模拟外围和I/O管脚数量,CPU内核的成本差异已大幅缩短,更促进了高性价比32位低功耗MCU的快速发展。
应该看到,随着集成电路制造技术的不断进步,单个芯片上集成的晶体管越来越多。
这使得大规模集成电路(VLSI)的功耗成为芯片设计的关键问题,尤其是,当工艺发展到深亚微米时,功耗对电路的影响使它成为集成电路设计中必须考虑的因素。
低功耗设计对提高电路可靠性和降低成本有着非常积极的作用。
就数字CMOS电路功耗主要由动态开关功耗、漏电功耗和短路功耗三部分组成,其中动态开关功耗占据了总功耗的绝大部分,因此降低功耗主要通过降低动态开关功耗实现,而降低动态开关功耗又可以通过减小翻转率、减小负载电容和降低芯片供电电压等手段实现。
今天,不管是通用MCU,还是低功耗MCU对于国产MCU产业面临的现实困境,想要在通用MCU 领域和国外企业直面竞争,是非常不现实的。
我们更倾向于在细分领域形成差异化优势,根据客户实际的需求对产品的功能、外围电路、模拟特性等进行定制化设计,以此打开市场。
与此同时,航顺芯片也在加快32位MCU产品系列的扩充,其量产的通用8位MCU(HK32S003XX 家族),32位MCU-M3家族(HK32F103)和M0家族(HK32F030/031)已有近百个单品型号,功耗更低,稳定性可以通过车规级测试标准。
STM32 系列MCU 不同型号的移植步骤解析

STM32系列MCU不同型号的移植!
第一步
更换启动件:
第二步
修改宏定义:
图1
或者修改stm32f10x.h
具体修改如下:
图2
第三步
修改系统主频率:
文件:system_stm32f10x.c
具体修改如下:
图3
第四步
修改外部晶振源:
文件:stm32f10x.h
其中,Project.bin和Project.axf要和Output选项卡中的Nameof
Executable的名字相同
三、如何使用IAP
1、设置超级终端波特率选择为115200
2、需要下载时将Tamper键按住再按下复位键超级终端打印出帮助信息
3、选择下发文件,协议选择Y_modem,选择下发。
延时修改
使用J-Link调试设置
图7
J-Link不能正常连接目标板
可以尝试一下方法(恢复出厂设置)
具体修改如下:
图4
第五步
定时器需要根据以上修改的系统主频率进行对应的修改。
其他:
修改Flash地址
文件:misc.h
具体修改如下:
图5
与以下配置一致:
IAP设置步骤
一、IAP工程设置
1、修改main中的按键触发键
2、修改下载串口
二、下载工程设置
1、修改程序入口地址
查找NVIC_VectTab_FLASH将其修改为:0x08002000
2、修改options
1)打开Target选项卡在IROM1中将Start和Size分别修改为
0x08002000和0x3E00
2)打开User选项卡在RunUserProgramsBeforeBuild/Rebuild中,勾选
基于STM32单片机的uCOS-II操作系统移植
第6期2020年12月机电元件ELECTROMECHANICALCOMPONENTSVol 40No 6Dec 2020收稿日期:2020-10-20基于STM32单片机的uC/OS-II操作系统移植张中前(贵州航天电器股份有限公司,贵州贵阳,550009) 摘要:网络技术和信息技术的发展,嵌入式系统应用越来越普及,嵌入式设备的应用也越来越多。
uC/OS-II广泛应用于路由器、飞行器及工业控制等。
uC/OS-II操作系统执行效率高,占用存储空间少,具有实时性及可扩展性等优点,在小型嵌入式设备中具有广泛应用。
本文介绍了基于ARMCORTEXM3系列单片机上的uC/OS-II移植,对电子控制组件的设计具有参考作用。
关键词:实时操作系统;uC/OS-II;内存管理;任务管理;STM32;移植Doi:10.3969/j.issn.1000-6133.2020.06.015中图分类号:TN784 文献标识码:A 文章编号:1000-6133(2020)06-0057-051 引言操作系统是裸机的第一层软件,操作系统直接运行在硬件上,上层软件通过提供应用程序接口(API函数),实现对底层硬件的访问,同时,通过操作系统实现对多个上层应用软件(任务)管理,实现对硬件CPU管理、存储管理、I/O接口管理及文件管理,如图1所示。
图1 操作系统功能组成示意图 STM32系列单片机以其优良的价格,大容量的FLASH及RAM存储空间,极易用于较为复杂的控制系统;在STM32单片机上进行uC/OS-II实时操作系统的移植,提高了产品的设计灵活性,实现较为复杂的系统功能;通过将开源的uC/OS-II移植在STM32单片机上,以其较为低廉的硬件成本获得较高的使用性能,具有良好的应用前景。
2 uC/OS-II操作系统2.1 uC/OS-II操作系统的基本特征uC/OS-II是一个完整的、可移植、可固化、可剪裁的基于优先级调度的抢占式实时多任务操作系统;它能够在外界事件或数据产生时,能够接收图2 uC/OS-II文件结构示意图并以足够快的速度响应,其处理的结果又能够在规定的时间内输出,并控制所有实时任务协调、一致运行。
嵌入式3级选择题7解读
1.下列产品中不属于嵌入式系统的是:A) 洗衣机B) 空调机C) 个人电脑D) 电子血压计【解析】广义上讲,凡是带有微处理器的专用软硬件系统都可称为嵌入式系统。
狭义上讲,嵌入式系统强调那些使用嵌入式微处理器构成的具有自己的操作系统和特定功能、用于特定场合的独立系统。
嵌入式系统以应用为中心、以计算机技术为基础、软硬件可裁剪、功能、可靠性、成本、体积、功耗严格要求的专用计算机系统。
包括洗衣机、空调机等"白色家电",也包括心电计、血压计等医疗电子设备;而个人电脑(PC机)不属于嵌入式系统。
所以本题选C。
2.下面关于嵌入式系统的叙述中,错误的是A) 嵌入式系统所涉及的应用领域非常广泛B) 嵌入式系统在数量上远远超过了各种类型的通用计算机系统C) 嵌入式系统与通用计算机都是由硬件和软件两部分组成的D) 嵌入式系统正在逐步取代通用计算机系统【解析】嵌入式系统与通用计算机一样,也是由硬件和软件两部分组成,所涉及到的领域非常广泛,在应用数量上远远超过了各种类型的通用计算机系统。
尽管如此,嵌入式系统与日常使用的通用计算机系统仍有许多不同之处,它们的组成及功能都各有特点,所以各自的市场不同,谈不上取代。
所以本题选D。
3. 数码相机是一种典型的嵌入式系统,下面有关其软硬件组成的叙述中错误的是:A) 它由硬件和软件两部分组成B) 硬件部分既包括CPU,也包括存储器和输入/输出C) 使用闪存卡(如CF卡、SD卡等)作为内存,用于存储所运行的软件D) 软件部分既包括操作系统,也包括应用软件【解析】数码相机是嵌入式系统的典型应用之一。
它由前端和后端两部分组成,前端负责数字图像获取,后端负责数字图像的处理,后端通常是以嵌入式DSP作为核心的SoC芯片,DSP用于完成数字图像处理;此外,数码相机中还有一个超低功耗的8位MCU,负责进行操作控制;高端数码相机配置有实时操作系统和图像处理软件。
使用的闪存卡主要是用来存储照片而不是系统软件。
EFM32系列32位MCU的GPIO配置,读取-写入,外设功能
EFM32 系列32 位MCU 的GPIO 配置,读取/写入,
外设功能
本文主要针对Silicon Labs(亦称芯科科技)EFM32 系列32 位MCU 的GPIO 配置,读取/写入,外设功能,外部中断功能以及GPIO 引脚作为外设
反射系统(PRS)等功能进行概要描述。
与此相关的功能演示可以在Silicon Labs 推出的EFM32 入门套件主板上实现。
与通用型MCU 应用类似,EFM32 系列每个端口最多容纳16 个引脚,命名规则为Pxn,其中x 表示端口(A,B,C ...),n 表示引脚编号(0,1,...,15),其中每个端口都有独立的寄存器控制单元,用于功能的配置和数据读写等。
GPIO 配置输出端,通过写入DOUT 寄存器中的相应位来驱动引脚,其输出可以配置为线或,开漏或者具有特定驱动属性的推挽式输出。
输入配置,
其输入的引脚状态反映在其对应的DIN 寄存器中,可为每个输入引脚启用可
编程的上拉或下拉功能,另外还有滤波器功能可选,可以抑制长达50 ns 的毛刺。
在实际的应用设计中,为避免意外影响GPIO 的配置,可以按引脚锁
定其GPIO 配置。
另外,针对部分外设线路有上、下拉电阻的配置需求,这
就需要与MCU GPIO 上、下拉功能的协调使用。
EFM32 系列的三个典型寄存器配置:GPIO_Px_MODEL(端口引脚0-7)或GPIO_Px_MODEH(端口引脚8-15),GPIO_Px_DOUT 和。
NXP LPC55S16 32位ARM MCU嵌入应用开发方案
NXP公司的LPC55S1x/LPC551x是基于32位ARM Cortex-M33内核的微处理器(MCU),包括CASPER加密引擎,多达256KB片上闪存,多达96KB片上SRAM,用于实时闪存加密/解密的PRINCE模块,代码看门狗,高速/全速USB主和设备接口,CANFD,五个通用计时器,一个SCTimer/PWM,一个RTC/告警计时器,一个24位多速率计时器(MRT),看门狗计时器(WWDT),九个灵活串行通信外设(可配置成USART, SPI,高速SPI, I2C或I2S接口),可编逻辑单元(PLU),一个16位2.0 MSPS ADC.ARM Cortex-M33核(r0p4)运行频率高达150MHz,集成了数字信号处理(DSP)指令,以及TrustZone®,浮点单元(FPU)和存储器保护单源(MPU),ARM Cortex M33内置了嵌套向量中断控制器(NVIC).为了支持所需的安全,LPC55S1x/LPC551x还支持安全引导, HASH, AES, RSA, UUID,动态加密和解密,调试认证和TBSA兼容.工作电压1.8V-3.6V,工作温度- 40 C 到 +105 C.主要用在工业,消费类电子和汽车市场等低功耗强功能的嵌入解决方案.本文介绍了LPC55S1x/LPC551x主要优势和特性,框图,以及开发板LPC55S16-EVK主要特性,电路图和材料清单.The LPC55S1x/LPC551xis an ARM Cortex-M33 based microcontroller for embedded applications. These devices include CASPER Crypto engine, up to 256 KB on-chip flash,up to 96 KB of on-chip SRAM, PRINCE module for on-the-fly flash encryption/decryption,Code Watchdog, high-speed/full-speed USB host and device interface with crystal-less operation for full-speed, CAN FD, five general-purpose timers, one SCTimer/PWM,one (WWDT), nine flexible serial communication peripherals (which can be configured as a USART, SPI, high speed SPI, I2C, or I2S interface)Programmable Logic Unit (PLU), one 16-bit 2.0 Msamples/sec ADCcapable of simultaneous conversions, comparator, and temperaturesensor .The ARM Cortex-M33 provides a security foundation, offering isolation to protect valuable IP and data with TrustZone® technology. It simplifies the design and software development of digital signal control systems with the integrated digital signal processing (DSP) instructions. To supportsecurity requirements, the LPC55S1x/LPC551x also offers support forsecure boot, HASH, AES, RSA, UUID, dynamic encrypt and decrypt, debug authentication, and TBSA compliance.LPC55S1x/LPC551x主要优势和特性:n ARM Cortex-M33 core (r0p4):u Running at a frequency of up to 150 MHz.u Integrated digital signal processing (DSP) instructions.u TrustZone®, Floating Point Unit (FPU) and Memory Protection Unit(MPU).u Non-maskable Interrupt (NMI) input with a selection of sources.u Serial Wire Debug with eight breakpoints and four watch points. Includes SerialWire Output for enhanced debug capabilities.u System tick timer.n CASPER Crypto co-processor is provided to enable hardware acceleration for various functions required for certain asymmetric cryptographicNXP LPC55S16 32位ARM MCU嵌入应用开发方案algorithms, such as, EllipticCurve Cryptography (ECC).n On-chip memory:u Up to 256 KB on-chip flash program memory with flash accelerator and 512 bytepage erase and write.u Up to 96 KB total SRAM consisting of 16 KB SRAM on Code Bus, 64 KBSRAM on System Bus (64 KB is contiguous), and additional 16 KB USBSRAM on SystemBus which can be used by the USB interface or for general purpose use.n PRINCE module for real-time encryption of data being written to on-chip flash and decryption of encrypted flash data during read to allow assetprotection, such assecuring application code, and enabling secure flashupdate.n On-chip ROM bootloader supports:u Booting of images from on-chip flashu Supports CRC32 image integrity checking.u Supports flash programming through In System Programming (ISP)commandsover following interfaces: USB0/1 interfaces using HID Classdevice, UARTinterface (Flexcomm 0) with auto baud, SPI slave interfaces(Flexcomm 3 or 8)using mode 3 (CPOL = 1 and CPHA = 1), and I2C slave interface (Flexcomm 1)u ROM API functions: Flash programming API, Power control API, andSecurefirmware update API using NXP Secure Boot file format, version 2.0 (SB2 files).u Supports booting of images from PRINCE encrypted flash regions.u Support NXP Debug Authentication Protocol version 1.0 (RSA-2048) and 1.1(RSA-4096).u Supports setting a sealed part to Fault Analysis mode throughDebugauthentication.n Secure Boot support:u Uses RSASSA-PKCS1-v1_5 signature of SHA256 digest ascryptographicsignature verification.u Supports RSA-2048 bit public keys (2048 bit modulus, 32-bit exponent). u Supports RSA-4096 bit public keys (4096 bit modulus, 32-bit exponent). u Uses x509 certificate format to validate image public keys.u Supports up to four revocable Root of Trust (RoT) or Certificate Authority keys,Root of Trust establishment by storing the SHA-256 hash digest of the hashes offour RoT public keys in protected flash region (PFR).u Supports anti-rollback feature using image key revocation and supports up to 16Image key certificates revocations using Serial Number field inx509 certificate.n Serial interfaces:u Flexcomm Interface contains up to nine serial peripherals (FlexcommInterface 0-7 andFlexcomm Interface 8). Each Flexcomm Interface (except flexcomm 8, whichis dedicated for high-speed SPI) can be selected bysoftware to be a USART, SPI,I2C, and I2S interface.Each Flexcomm Interface includes a FIFO that supportsUSART, SPI, and I2S.A variety of clocking options are available to each FlexcommInterface,including a shared fractional baud-rate generator, and time-outfeature.Flexcomm interfaces 0 to 5 each provide one channel pair of I2S andFlexcomm interfaces 6 to 7 each provide four channel pairs of I2S.u I2C-bus interfaces support Fast-mode and Fast-mode Plus with data rates of up to 1Mbit/s and with multiple address recognition and monitor mode. Two sets of trueI2C pads also support high-speed Mode (3.4 Mbit/s) as a slave.u USB 2.0 full speed host/device controller with on-chip PHY and dedicated DMA controller supporting crystal-less operation in device mode usingsoftware library example in technical note (TN00065).u USB 2.0 high-speed host/device controller with on-chip high-speed PHY. n Digital peripherals:u DMA0 controller with 23 channels and up to 22 programmable triggers, able toaccess all memories and DMA-capable peripherals.u DMA1 controller with 10 channels and up to 15 programmable triggers, able toaccess all memories and DMA-capable peripherals.u CAN FD module with dedicated DMA controlleru CRC engine block can calculate a CRC on supplied data using one ofthreestandard polynomials with DMA support.u Up to 64 General-Purpose Input/Output (GPIO) pins.u GPIO registers are located on the AHB for fast access. The DMA supports GPIOports.u Up to eight GPIOs can be selected as pin interrupts (PINT), triggered by rising,falling or both input edges.u Two GPIO grouped interrupts (GINT) enable an interrupt based on alogical(AND/OR) combination of input states.u I/O pin configuration with support for up to 16 function options.u Programmable Logic Unit (PLU) to create small combinatorial and/orsequentiallogic networks including state machines.n Security Features:u ARM TrustZone® enabled.u AES-256 encryption/decryption engine with keys fed directly from PUF or asoftware supplied keyu Secure Hash Algorithm (SHA2) module supports secure boot withdedicated DMA controller.u Physical Unclonable Function (PUF) using dedicated SRAM for siliconfingerprint. PUF can generate, store, and reconstruct key sizes from 64 to 4096 bits. Includeshardware for key extraction.u True Random Number Generator (TRNG).u 128 bit unique device serial number for identification (UUID).u Secure GPIO.u Code Watchdog for detecting code flow integrity.n Timers:u Five 32-bit standard general purpose asynchronous timers/counters,which support up to four capture inputs and four compare outputs, PWM mode, and externalcount input. Specific timer events can be selected to generate DMA requests.u One SCTimer/PWM with 8 input and 10 output functions (including 16 capture andmatch registers). Inputs and outputs can be routed to or from external pins andinternally to or from selected peripherals. Internally, the SCTimer/PWM supports 16captures/matches, 16 events, and 32 states.u 32-bit Real-time clock (RTC) with 1 s resolution running in the always-on powerdomain.Another timer in the RTC can be used for wake-up from all low powermodes including deep power-down, with 1 ms resolution. The RTC is clocked bythe 32 kHz FRO or 32.768 kHz external crystal.u Multiple-channel multi-rate 24-bit timer (MRT) for repetitive interrupt generation atup to four programmable, fixed rates.u Windowed Watchdog Timer (WWDT) with FRO 1 MHz as clock source. u Code Watchdog for detecting code flow integrity.u The Micro-Tick Timer running from the watchdog oscillator can be used to wake-up the device from sleep and deep-sleep modes. Includes 4capture registers with pininputs.u 42-bit free running OS Timer as continuous time-base for the system,available in any reduced power modes.It runs on 32 kHz clock source, allowing a count periodof more than 4 years. n Analog peripherals:u 16-bit ADC with five differential channel pair (or 10 single-endedchannels), andwith multiple internal and external trigger inputs and sample rates of up to 2.0MSamples/sec. The ADC support simultaneousconversions, on 2 ADC inputchannels belonging to a differential pair.u Integrated temperature sensor connected to the ADC.u Comparator with five input pins and external or internal referencevoltage.n Clock generation:u Internal Free Running Oscillator (FRO). This oscillator provides aselectable 96MHz output, and a 12 MHz output (divided down from theselected higherfrequency) that can be used as a system clock. The FRO is trimmed to +/- 2%accuracy over the entire voltage and temperature range. u 32 kHz Internal Free Running Oscillator FRO. The FRO is trimmed to +/- 2%accuracy over the entire voltage and temperature range.u Internal low power oscillator (FRO 1 MHz) trimmed to +/- 15% accuracy over theentire voltage and temperature range.u Crystal oscillator with an operating frequency of 12 MHz to 32 MHz.Option forexternal clock input (bypass mode) for clock frequencies of up to 25 MHz.u Crystal oscillator with 32.768 kHz operating frequency.u PLL0 and PLL1 allows CPU operation up to the maximum CPU rate without theneed for a high-frequency external clock. PLL0 and PLL1 can run from the internalFRO 12 MHz output, the external oscillator, internal FRO 1 MHz output, or the32.768 kHz RTC oscillator.u Clock output function with divider to monitor internal clocks.u Frequency measurement unit for measuring the frequency of any on-chip oroff-chip clock signal.u Each crystal oscillator has one embedded capacitor bank, where each canbe usedas an integrated load capacitor for the crystal oscillators. Using APIs, the capacitorbanks on each crystal pin can tune the frequency for crystals with a CapacitiveLoad (CL) leading to conserving board space and reducing costs.n Power-saving modes and wake-up:u Integrated PMU (Power Management Unit) to minimize power consumption.u Reduced power modes: Sleep, deep-sleep with RAM retention, power-down with RAM retention and CPU retention, and deep power-down with RAM retention.u Configurable wake-up options from peripherals interrupts.u The Micro-Tick Timer running from the watchdog oscillator, and the Real-TimeClock (RTC) running from the 32.768 kHz clock, can be used to wake-up thedevice from sleep and deep-sleep modes.u Power-On Reset (POR) (around 0.8 V).u Brown-Out Detectors (BOD) for VBAT_DCDC with separate thresholds for forcedreset.n Operating from internal DC-DC converter.n Single power supply 1.8 V to 3.6 V.n JTAG boundary scan supported.n Operating temperature range - 40 C to +105 C.n Available in HLQFP100, VFBGA98, and HTQFP64 packages。