2 Star 4 Fork 4

芯昇科技 / CMIOT.CM32M4xxR_Library

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

CMIOT.CM32M4xxR_Library

芯昇科技MCU CM32M4xxR软件开发包,包括相关驱动代码、基于CM32M4xxR_LQFP128_STB开发板和CM32M433R开发板的样例代码,芯片及软硬件技术文档。

CM32M4xxR

CM32M4xxR是芯昇科技首颗采用32位RISC-V内核(Nuclei N308)的混合信号MCU(支持FPU和DSP指令),主频高达144MHz,Flash最大512KB。

目录结构说明

  • Drivers:芯片驱动,包括NMSIS、外设驱动。

  • Project: 适配CM32M4xxR_LQFP128_STB开发板和CM32M433R-START开发板的BSP、参考例程和工程模板。

  • Doc: 包括芯片芯片手册、软硬件手册、开发板原理图等技术文档。

参考例程包括如下内容:

样例工程 功能描述
├─ADC
│ ├─4ADCs_DMA 4通道通过DMA、连续转换、软件触发示例
│ ├─ADC1_DMA 1通道通过DMA、连续转换、扫描模式、软件触发示例
│ ├─ADC1_TEMP ADC1采样内部温度传感器的电压并算出温度值
│ ├─ADC_SingleRead 4通道通过软件触发转换示例
│ ├─AnalogWatchdog 模拟看门狗功能示例
│ ├─ExtLinesTrigger ADC1通过DMA、扫描模式、外部触发示例
│ ├─RegSimul_DualMode ADC1、2同步规则通道模式、连续扫描模式、软件触发示例
│ ├─TIMTrigger_AutoInjection ADC1规则转换通道开启、TIM1CC2触发自动注入转换示例
│ └─HighSpeed_5M ADC高速采样,12bit 5M
├─ALGO
│ ├─AES AESECB/CBC/CTR模式加解密运算示例
│ ├─DES DES/3DESECB/CBC模式运算示例
│ ├─HASH MD5/SHA1/SHA224/SHA256运算示例
│ └─SM4 SM4 ECB/CBC模式运算示例
├─BKP
│ ├─BkpData 对备份寄存器进行写入操作
│ └─TamperTest 入侵检测自毁
├─bxCAN
│ ├─Dual_CAN1_2 CAN两个通道互相收发报文
│ └─LoopBack_CAN1 单通道环回模式下收发报文
├─COMP
│ ├─CompBreak 比较器输出改变后触发tim刹车
│ ├─CompOut 输入触发比较器输出改变
│ ├─CompINT 外部触发COMP中断
│ ├─ComptoOCREFCLR COMP触发TIM捕获
│ └─ComptoTimer COMP控制PWM输出
├─CRC
│ └─CalCRC 硬件CRC的基本功能和算法
├─DAC
│ ├─DoubleModeDMASineWave 同时触发模式下DMA双通道输出正弦波示例
│ ├─OneChannelOutputNoiseWave 单通道输出噪音信号示例
│ └─TwoChannelsTriangleWave 双通道输出三角波示例
├─DMA
│ ├─FLASH_RAM 使用DMA在FLASH与RAM之间传输数据
│ ├─I2C_RAM 使用DMA在I2C外设与RAM之间传输数据
│ └─SPI_RAM 使用DMA在SPI外设与RAM之间传输数据
├─EXTI
│ └─KeyInterrupt 按键触发外部中断
├─Flash
│ ├─Flash_DMA_Program 使用DMA将SRAM数据写入FLASH
│ ├─Flash_Program 对FLASH进行读写操作
│ ├─Flash_Write_Protection FLASH写保护
│ ├─Flash_Read_Protection FLASH读保护
│ └─Flash_EEPROM FLASH模拟EEPROM
├─GPIO
│ ├─IORemap 将JTAG口重定向为普通IO
│ └─LedBlink 通过GPIOK控制LED
├─I2C
│ ├─EEPROM I2CEEPROM读写(AT24C02)
│ ├─I2C_10bit I2C10bit地址通信
│ ├─I2C_Master I2C主机通信(查询方式)
│ ├─I2C_Master_Int I2C主机通信(中断方式)
│ ├─I2C_Master_Slave_Int I2C主从通信(中断方式)
│ ├─I2C_Slave I2C从机通信(查询方式)
│ └─I2C_Slave_Int I2C从机通信(中断方式)
├─I2S
│ ├─I2S_DMA I2S通过DMA收发数据
│ ├─I2S_Interrupt I2S通过中断收发数据
│ ├─SPI_I2S_Switch I2S和SPI收发数据切换示例
│ └─I2S_Voice I2S通过外部decode进行音频播放
├─iCache
│ └─CoreMark MCU跑分测试
├─IWDG
│ └─IWDG_Reset IWDG复位功能
├─OPA
│ ├─OpaAdByTim TIM触发ADC同步注入采样OPA电压数据,并且TIM输出受COMP刹车控制,刹车发生后TIM停止pwm输出,ADC的注入采样停止。
│ ├─PGA PGA模式,放大输入电压2倍
│ ├─OPASwitchByTIM TIM触发OPA输入通道切换
│ └─PGAtoADC ADC内部采集OPA输出
├─PWR
│ ├─AlarmWakeUp 通过RTC闹钟来唤醒STOP2
│ ├─PVD PVD配置电压产生对应的中断
│ ├─SLEEP SLEEP模式的进入和退出。
│ ├─STANDBY STANDBY模式的进入和退出。
│ └─STOP STOP2模式的进入和退出。
├─QSPI
│ ├─QSPI_DMA 通过QSPI接口操作板上的串行Flash(GD25Q40C)芯片,分别使用双线和四线模式在DMA方式下对Flash进行读写。
│ ├─QSPI_QUAD 通过QSPI接口操作板上的串行Flash(GD25Q40C)芯片,分别使用双线和四线模式对Flash进行读写。
│ └─QSPI_XIP 通过QSPI接口操作板上的串行Flash(GD25Q40C)芯片,在四线XIP模式对Flash进行读取,在XIP操作前通过普通四线模式写入数据。
├─RCC
│ └─RCC_ClockConfig 设置不同的系统时钟
├─RISC-V
│ ├─DSP FPU/DSP应用样例
│ │ ├─riscv_bayes_example 示例演示如何使用贝叶斯分类器
│ │ ├─riscv_class_marks_example 示例演示如何统计及矩阵计算
│ │ ├─riscv_convolution_example 示例演示如何实现数据的卷积
│ │ ├─riscv_dotproduct_example 示例演示如何使用乘法和加法函数实现向量的点积。
│ │ ├─riscv_fft_bin_example 示例演示如何计算输入信号的快速傅里叶变换
│ │ ├─riscv_fir_example 示例演示了如何配置FIR低通滤波器
│ │ ├─riscv_graphic_equalizer_example 示例演示如何使用Biquad滤波器构建5波段图形均衡器
│ │ ├─riscv_linear_interp_example 示例演示利用线性插值模块实现提升数据精度。
│ │ ├─riscv_matrix_example 示例演示如何使用矩阵计算接口
│ │ ├─riscv_signal_converge_example 本示例将展示自适应滤波器的收敛
│ │ ├─riscv_sin_cos_example 示例演示如何使用正弦与余弦计算
│ │ ├─riscv_svm_example 示例演示如何使用机器学习中的支持向量机计算
│ │ └─riscv_variance_example 本示例将采用基础的数学算子展示方差运算的基本操作
│ ├─Exception 示例展示如何使用RISC-V的异常处理
│ ├─IAP 示例展示如何使用XMODEM协议实现在线应用编程
│ │ ├─IAP_Boot IAP的bootloader实现,实现XMODEM接收数据及应用跳转
│ │ └─IAP_User IAP跳转示例的应用代码
│ ├─Interrupt_Nesting 示例展示ECLIC中断嵌套处理函数的编写
│ ├─Interrupt_TailChaining 示例展示ECLIC中断咬尾特性
│ ├─Interrupt_Vector_NonVector 示例展示ECLIC中向量中断与非向量中断的配置及响应处理
│ ├─ISA 示例展示获取当前内核ISA架构
│ ├─PMP 示例展示PMP内存保护单元配置
│ ├─PMP_Privacy_Protection 示例展示如何使用PMP保护敏感代码
│ ├─PMP_RTOS_StackOverflow 示例展示如何使用PMP实现RTOS的堆栈溢出保护
│ ├─Systick 示例展示如何使用系统定时器
│ └─UserMode 示例展示如何进入用户模式
├─RNGC
│ └─GetRand 获取真随机数
├─RTC
│ ├─Alarm 通过设定闹钟时间Time和Date来触发闹钟中断,通过闹钟标志位来配置IO输出
│ ├─Calendar 通过EXTI线来触发日历打印输出
│ ├─RtcAutoWakeUp 通过设定唤醒时间触发中断,通过唤醒标志位来配置IO输出
│ ├─TimeStamp 通过EXTI线来触发时间戳。
│ └─AlarmSubsecond 通过设定闹钟时间Subsecond来触发闹钟中断,通过闹钟标志位来配置IO输出
├─SPI
│ ├─CRC SPI发送接收数据进行CRC校验
│ ├─CRC_Remap SPI重映射后发送接收数据进行CRC校验
│ ├─FullDuplex_SoftNSS SPI全双工软件NSS模式发送接收数据
│ ├─Simplex_Interrupt SPI单线中断发送和接收数据
│ ├─SPI_DMA SPIDMA单线接收数据
│ ├─SPI_DMA_TxRx SPIDMA单线发送和单线接收数据
│ ├─SPI_FLASH SPI读、写、擦除W25Q128
│ └─SPI_SD_CARD SPI读写SD卡
├─TIM
│ ├─6Steps 6步PWM输出
│ ├─7PWM_Output 7路PWM输出(6路两两互补)
│ ├─Cascade_Synchro 多TIMER串行周期门控
│ ├─ComplementarySignals 六路PWM互补输出
│ ├─DMA 两路互补输出通过DMA改变占空比
│ ├─DMABurst PWM输出并通过DMA同时改变周期和占空比
│ ├─ExtTrigger_Synchro 外部触发多个串行TIMER同步计数
│ ├─InputCapture 通过输入捕获功能计算外部信号的频率值
│ ├─OCActive 比较输出-计数达到比较值后输出有效电平
│ ├─OCInactive 比较输出-计数达到比较值后输出无效电平
│ ├─OCToggle 比较输出-计数达到比较值后翻转输出电平
│ ├─OnePulse 外部触发TIMER输出一个单脉冲
│ ├─Parallel_Synchro 多TIMER并行周期门控
│ ├─PWM_Input 输入捕获PWM波形并计算频率和占空比
│ ├─PWM_Output 多路输出PWM,频率相同占空比不同
│ ├─TIM1_Synchro TIMER1的周期门控其他TIMER并进行PWM输出
│ ├─TimeBase 利用比较中断控制IO输出
│ ├─TimeBase1 利用更新中断控制IO输出(TIMER1)
│ ├─TimeBase2 利用更新中断控制IO输出(TIMER2)
│ └─TimeBase6 利用更新中断控制IO输出(TIMER6)
├─TSC
│ ├─TSC_HW Mode wake up TSC按键触发从多种低功耗模式下唤醒(硬件扫描)
│ └─TSC_SW Mode TSC按键检测(软件扫描+TIMER检测)
├─USART
│ ├─DMA_Interrupt 示例展示两个USART间通过DMA和中断实现基础通信
│ ├─DMA_Polling 示例展示两个USART间通过DMA和查询检测标识实现基础通信
│ ├─DMA_HalfDuplex 示例展示两个USART间通过DMA查询检测标识,实现半双工模式的基础通信
│ ├─HalfDuplex 示例展示两个USART间通过查询检测标识,实现半双工模式的基础通信
│ ├─HardwareFlowCtrl 示例展示两个USART间使用硬件流控制实现的基础通信
│ │ ├─Receive_RTS 流控制示例的接收端
│ │ └─Transmit_CTS 流控制示例的发送端
│ ├─Interrupt 示例展示两个USART间通过中断实现的基础通信
│ ├─IrDA_TxRx 示例展示两个USART间实现串行IrDA红外解码功能的基础通信
│ ├─IrDA_TxRx_LowPower 示例展示两个USART间实现串行IrDA低功耗模式红外解码功能的基础通信
│ ├─MultiProcessor 示例展示如何使用USART多处理器模式
│ ├─Polling 示例展示两个USART间通过查询检测标识实现的基础通信
│ ├─Printf 示例展示USART与PC间通过查询检测标识实现的基础通信及printf重定向
│ ├─Synchronous 示例展示USART同步模式下与SPI间通过查询检测标识实现的基础通信
│ ├─DMA_Interrupt_Polling 示例展示两个USART间通过DMA的中断和查询检测标识实现基础通信
│ ├─SmartCard 示例展示USART与智能卡间的基础通信
│ └─USART_ALL 示例展示所有UART通道的收发通信 USART1和USART2 DMA半双工通信;USART3 Log输出;USART4和USART5 DMA收发通信;UART6和UART7 中断收发和轮询收发
└─WWDG
└─WWDG_Reset WWDG复位功能

如何使用

SDK采用Nuclei Studio NPK方式进行组织,请下载最新的Nuclei Studio版本[https://www.nucleisys.com/download.php] 配合使用。

  • 导入SDK:打开Nuclei Studio IDE,选择菜单栏 RV-Tools->Nuclei Package Management,打开包管理窗口,导入SDK压缩包“CMIOT.CM32M4xxR_Library.zip”,注意必须是zip压缩格式,然后等待导入完成。导入完成后,包管理窗口会显示sdk-cm32m4xxr的包信息,如下图:
  • 创建工程:关闭包管理窗口,然后选择菜单栏File->New->New Nuclei RISC-V C/C++ Project,打开工程创建窗口。窗口左边列出了开发板的型号,用户可以根据自己的需求进行点击选择,右边是相关技术文档链接,包括芯片手册、软件说明、开发板使用指南、原理图等内容。然后点击next,继续进行工程创建。

  自定义填写工程名称,由于开发板提供的样例工程比较多,可以选择过滤方式keywords,然后选择GPIO关键词进行筛选,之后可以在Project Example行选择GPIO相关工程。其他选项保持默认即可。点击Finish完成工程创建。

  • 编译调试:选择菜单栏Project->Build All进行工程编译,编译完成后,显示如下:

  菜单栏选择Run->Debug Configurations打开调试配置界面。样例工程中已经完成了调试配置,用户可以不用修改,仅需选择适合自己的调试配置进行使用。通过NPK方式导入的工程一共有三种调试配置,分别对应Jlink、蜂鸟和CM-Link调试支持。检查开发板供电和调试器连接,然后点击Debug Configurations,选择对应的调试配置,然后点击下面的Debug按钮,即可启动工程调试。

  调试视图1号位置为调试控制栏;2号位置为Registers窗口,可以查看RSIC-V内核的寄存器数值;3号位置为Peripherals窗口,可以选择查看MCU各个片上外设的寄存器,勾选其中一个外设以后,就会在Memory窗口中显示该外设的寄存器内容。以上窗口可以通过菜单栏Windows->Show View中找到并打开。其他如变量查看、断点增删等内容不在此赘述。

  点击调试控制栏里的运行按钮,然后启动程序运行,可以观察到开发板上三个LED进行闪烁。

 每个样例工程的目录下都配套一个readme.txt文件,该文件介绍了样例工程的功能说明、使用方法、注意事项等内容,建议详细阅读。

  • 下载:Nuclei Studio IDE没有单独的下载按钮功能,在启动调试的过程中,IDE会根据链接文件的配置将程序下载到特定的位置,如将程序烧写到flash,请在编译配置选项界面选择gcc_cm32m4xxr_flashxip.ld文件,并修改DOWNLOAD_MODE的宏值为0。

芯昇科技有限公司

芯昇科技有限公司注册成立于2020年12月29日,是中移物联网有限公司出资成立的子公司。按照中国移动通信集团“科改示范行动”整体改革布局,芯昇科技围绕物联网芯片国产化,以促进国家集成电路产业振兴为目标,以“创芯驱动万物互联,加速社会数智化转型”为使命,致力于成为“最具创新力的物联网芯片及应用领航者”。

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

XinSheng Tech CM32M4xxR MCU Software Development Kit 展开 收起
C 等 4 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/CMIOT-XinShengTech/CMIOT.CM32M4xxR_Library.git
git@gitee.com:CMIOT-XinShengTech/CMIOT.CM32M4xxR_Library.git
CMIOT-XinShengTech
CMIOT.CM32M4xxR_Library
CMIOT.CM32M4xxR_Library
main

搜索帮助