目录
普冉PY32系列(一) PY32F0系列32位Cortex M0+ MCU简介普冉PY32系列(二) Ubuntu GCC Toolchain和VSCode开发环境普冉PY32系列(三) PY32F002A资源实测 - 这个型号不简单普冉PY32系列(四) PY32F002A/003/030的时钟设置普冉PY32系列(五) 使用JLink RTT代替串口输出日志普冉PY32系列(六) 通过I2C接口驱动PCF8574扩展的1602LCD普冉PY32系列(七) SOP8,SOP10,SOP16封装的PY32F002A/PY32F003管脚复用普冉PY32系列(八) GPIO模拟和硬件SPI方式驱动无线收发芯片XN297LBW普冉PY32系列(九) GPIO模拟和硬件SPI方式驱动无线收发芯片XL2400普冉PY32系列(十) 基于PY32F002A的6+1通道遥控小车I - 综述篇普冉PY32系列(十一) 基于PY32F002A的6+1通道遥控小车II - 控制篇普冉PY32系列(十二) 基于PY32F002A的6+1通道遥控小车III - 驱动篇普冉PY32系列(十三) SPI驱动WS2812全彩LED普冉PY32系列(十四) 从XL2400迁移到XL2400P普冉PY32系列(十五) PY32F0系列的低功耗模式
PY32F0系列上市其实相当长一段时间了, 样品已经吃灰很久, 因为工作原因11月12月都很忙一直没时间, 最近终于有一点时间把功课做了.
PY32F0 简介
PY32F0 是普冉生产的 32位 ARM M0/M0+ 内核MCU, 价格在市场上非常有竞争性. 根据外设的丰富程度分为三个系列:
PY32F002B 系列, 24KF/3KR, 主频24MHz和48MHz, 通用定时器只有两个, 资源较少, 特点是低功耗, stop模式1.7uA, 型号 PY32F002BPY32F0XX 系列, 型号有 PY32F002A, PY32F003X, PY32F030X, 资源较丰富, 容量最高到64KF+8KRPY32F07X 系列, 型号有 PY32F040X, PY32F071X, PY32F072X, 增加了CAN和USB外设, 容量最高到128KF+16KR
开发上, 因为是通用的 32位 M0内核, 可以在Keil5, IAR, VScode 等IDE上开发, 使用 STLink, DAPLink 或 JLink 烧录和调试.
官网产品页: https://www.puyasemi.com/mcu_weichuliqi.html资料仓库: https://gitee.com/puya-semiconductor/tools-and-software
从资料仓库可以下载最新的资料包, 资料包里包含全部型号的数据手册, 使用手册, 以及代码库, 代码示例.
芯岭科技 XL32F003, XL32F001
芯岭的 XL32F003 系列与 PY32F003 属于同内核产品. XL32F003 提供 4x4 脚间距0.4mm 的QFN32封装, 这个封装在 PY32F0 系列中没有, 如果需要超小封装的可以考虑. 芯岭还提供PY32与2.4G收发芯片的合封方案.
PY32F0 各系列具体配置对比
从对寄存器的读写测试看, PY32F002A, PY32F003, PY32F030属于同一个内核的产品, 寄存器设置是通用的, 而 PY32F072 属于另一种内核, 因为在002A/003/032上读写072的寄存器地址无效. PY32F002B也属于另一个内核的产品.
每个系列的封装变化很多, 就算一个TSSOP20, 都有三四种引脚布局, 这里不按型号介绍了, 大致看一下各系列的容量和外设区别.
PY32F002B 系列
24K Flash, 3K RAMInternal 24 MHz RC Oscillator (HSI)Internal 32.768 KHz RC Oscillator (LSI)32.768 KHz low speed crystal oscillator(LSE)External clock input 注意没有外置高速晶振Operating voltage:1.7 V ~ 5.5 V1 x 12 bits ADC
Support up to 8 external input channels and 2 internal channels Timer
A 16 bits advanced control timer (TIM1)A general purpose 16-bit timer (TIM14)A low-power timer (LPTIM),supports wake-up form stop modeAn Independent Watching Timer (IWDT)A SysTick timer RTCA Serial Peripheral Interface (SPI)A Universal Synchronous/Asynchronous Transceiver (USART) with automaticA I2C interfaceHardware CRC-32 moduleTwo comparatorsUnique UIDSerial wire debug (SWD)
PY32F002A 系列
32-bit ARM® Cortex® - M0+ CPUUp to 32 MHz operating frequency
Internal 8 / 24 MHz RC Oscillator (HSI)Internal 32.768 KHz RC oscillator (LSI)4 to 24 MHz crystal oscillator (HSE) Maximum 20 Kbytes of flash memoryUp to 3 Kbytes SRAM1 x 12-bit ADC
Supports up to 9 external input channels 1 x 16bit advanced control timer (TIM1)1 x general purpose 16-bit timers (TIM16)1 x low-power timer (LPTIM), supports wake-up from stop mode1 x Independent Watchdog Timer (IWDT)1 x SysTick timer1 x Serial Peripheral Interface (SPI)1 x Universal Synchronous / Asynchronous Transceivers (USARTs) with automatic baudrate detection1 x I2C interface , supports standard mode (100kHz) , Fast mode (400 kHz) , supports 7-bit addressing modeHardware CRC-32 moduleComparator * 2Unique UIDSerial wire debug (SWD)Operating voltage: 1.7V to 5.5VWorking temperature: -40℃ to 85℃Package: SOP8, SOP16, ESSOP10, TSSOP20, QFN16
大致的资源描述: 宽电压1.7V到5.5V, 最高支持32MHz时钟, 内建24MHz, 最高20KB的flash, 3KB的SRAM, 带ADC, TIM, 低功耗TIM, WDT, SPI, UART, I2C, 还带两个比较器.
宽电压这点很强, 3.3V和5V都覆盖了存储也还不错, 相比 HK32F030MF4P6 和 CH32V003 的 16KB flash + 2KB RAM 容量更高该有的外设都有, 如果能带个I2S就更好(😄)比较器在有些场景下很有用, 省了外接了.
和 PY32F002 的区别:
增加了比较器少了TIM6? 从启动文件比较看不出区别, 这个不确定
PY32F003 系列
32-bit ARM® Cortex® - M0+ CPUUp to 32 MHz operating frequency
Internal 4 /8/16/ 22.12 / 24 MHz RC Oscillator (HSI)Internal 32.768 KHz RC oscillator (LSI)4 to 32 MHz crystal oscillator (HSE) Maximum 64 Kbytes of flash memoryUp to 8 Kbytes SRAM3-channel DMA controller1 x 12-bit ADC
Supports up to 10 external input channels 1 x 16bit advanced control timer (TIM1)4 x general purpose 16-bit timers (TIM3/TIM14/TIM16/TIM17)1 x low-power timer (LPTIM), supports wake-up from stop mode1 x Independent Watchdog Timer (IWDT)1 x Window Watchdog Timer (WWDT)1 x SysTick timerRTC1 x Serial Peripheral Interface (SPI)2 x Universal Synchronous / Asynchronous Transceivers (USARTs) with automatic baudrate detection1 x I2C interface , supports standard mode (100kHz) , Fast mode (400 kHz) , supports 7-bit addressing modeHardware CRC-32 module2 x comparatorsUnique UIDSerial wire debug (SWD)Operating voltage: 1.7V to 5.5VWorking temperature: -40℃ to 85℃Package: SOP8, SOP16, TSSOP20, QFN20
和 PY32F002A 的区别
频率增加到最高 32MHzFlash容量增加到最高 64 KBytesRAM容量增加到最高 8 KBytes增加了 DMA增加了 WWDG增加了 RTC增加了 TIM3, TIM14, TIM17增加了 USART2
XL32F003 系列
这是芯岭科技出的一个型号系列, 放在这里是因为这个系列本质上和PY003系列是一样的, 但是只有64KF, 8KR的规格, 当前有三种封装:
TSSOP20: XL32F003TS20, 引脚布局和 PY32F003F2xP 系列一致QFN20: XL32F003Q20, 引脚布局和 PY32F003F1xU, PY32F030F2xU 系列一致QFN32: XL32F003Q32, 引脚布局和 PY32F030K2xM 系列一致, 封装更小, 是4x4的QFN, 脚间距0.4mm
PY32F030 系列
32-bit ARM® Cortex® - M0+Up to 48 MHz operating frequency
Internal 4/8/16/ 22.12/24 MHz RC oscillator (HSI)Internal 32.768 KHz RC oscillator (LSI)4 to 32 MHz crystal oscillator (HSE)32.768KHz low speed crystal oscillator (LSE)PLL (supports 2 frequency multiplication of HSI or HSE) Up to 64 Kbytes flash memoryUp to 8 Kbytes SRAM3-channel DMA controller1 x 12-bit ADC
Supports up to 10 external input channels 1 x 16bit advanced control timer (TIM1)4 x general purpose 16-bit timers (TIM3/TIM14/TIM16/TIM17)1 x low-power timer (LPTIM), supports wake-up from stop mode1 x Independent Watchdog Timer (IWDT)1 x Window Watchdog Timer (WWDT)1 x SysTick timerRTC2 x Serial Peripheral Interface (SPI)2 x Universal Synchronous / Asynchronous Transceivers (USARTs) with automatic baudrate detection1 x I2C interface , supports standard mode (100kHz) , Fast mode (400 kHz) , supports 7-bit addressing modeSupport 4-bit 7-segment common cathode LED digital tubeHardware CRC-32 module2 x comparatorsUnique UIDSerial wire debug (SWD)Operating voltage: 1.7 to 5.5 VWorking temperature: -40℃ to 85℃Package: LQFP32, QFN32, TSSOP24, TSSOP20, QFN20
和 PY32F003 系列的区别
频率增加到最高 48MHz支持 两倍PLL增加了 SPI2增加了 4位7段 LED数码管驱动
PY32F072 系列
从数据手册看, 与030系列相比Flash和RAM容量提升, 增加了LCD, CTC, TIM2, TIM6, TIM7, TIM15, I2C2, CAN, USB等外设. 根据手册上的寄存器测过002A/003/032, 应该是单独的核心, 与前面的三个型号不一样.
文末的彩蛋
PY32F002A 标称是20KB Flash + 3KB SRAM, 但是实际上现在买到的都是 32KB Flash + 4KB SRAM开发上, 直接使用PY32F030F16的设置就可以了, PY32F030的外设在 PY32F002A 上都有, 已经在 TSSOP20 封装的 PY32F002AF15P 上验证
相关链接
使用GCC ARM 工具链的项目模板 https://github.com/IOsetting/py32f0-templatePY32F003简评 https://zhuanlan.zhihu.com/p/580281296PY32F003Keil5的环境和ISP工具使用说明 https://blog.csdn.net/firseve/article/details/126661827Patrick Van Oosterwijck PY32F003 的电压电流曲线 https://silicognition.com/Electronics/PuyaCharge/py32f003-undervoltage-run-mode/Jay Carlson 对 PY32 系列的介绍https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/ 和文章的评论 https://brianlovin.com/hn/34660204Jean-Luc Aufranc (CNXSoft) 对PY32的介绍 https://www.cnx-software.com/2023/02/09/8-cents-for-an-arm-cortex-m0-microcontroller-meet-puya-py32-series-mcus/