我喜欢 RP2040
I like the RP2040

原始链接: https://dgroshev.com/blog/rp2040/

RP2040 是 Raspberry Pi 的一款新型微控制器,由于其价格实惠且可由 Mouser 等供应商提供,因此专门用于消费电子产品。 其尺寸小源于在大规模生产中制造相同组件之间差异最小的经济效益。 虽然 Raspberry Pi 选择了单一的 RP2040 型号而不是各种替代品,但其约 70 美分的成本使其对许多项目具有吸引力,尽管并未大批量生产。 RP2040 的功能包括两个功能强大的处理内核、30 个通用输入/输出 (GPIO) 引脚、充足的内部存储器、标准连接选项以及一项创新功能 - 可编程输入/输出 (PIO) 外设,可实现更快、更精确的 IO 操作,而无需消耗资源 大量的CPU资源。 此外,RP2040 凭借只读引导加载程序而拥有坚不可摧的性能,允许通过 USB 直接更新固件。 总体而言,其经过深思熟虑的设计针对特定应用的独特需求,同时保持经济实惠和易于访问。

据演讲者介绍,Raspberry Pi RP2040 微控制器会随着经验的积累而不断改进。 尽管最初在电池寿命、数字逻辑验证和功耗等方面面临挑战,但它表现出了有希望的特性。 用户已经讨论了替代方案,例如使用中断、多核、分布式设备、状态机、RTOS 或 PIO。 这些方法与 RP2040 的编码风格显着不同,导致了反对。 用户发现 RP2040 因其经济实惠、易于使用和各种功能而适合业余爱好者应用。 然而,对于专业项目来说,它在内存扩展选项、定时器/计数器集成、触摸灵敏度和高速时钟输入等方面存在不足。 RP2040 较差的 ESD 性能也是一个问题。 美国的 ESP32 型集成系统提供广泛的外围设备,经常与 RP2040 进行比较,强调后者作为芯片的单一焦点,缺乏模块化配件。 用户分享了当前项目从 RP2040 过渡到 ESP32-S3 的原因,重点关注平台不一致、功耗要求以及 RP2040 缺乏电容式触摸功能等因素。 总体而言,RP2040 对于爱好者来说是一款有趣且多功能的微控制器,在经济性、简单性和功能之间实现了平衡。 对于专业应用程序,它缺乏某些基本功能,需要谨慎对待。
相关文章

原文
RaspberryPi's picture of a RP2040

The RP2040 is a microcontroller made by Raspberry Pi. Unlike their more widely known products, the RP2040 is meant to be embedded in consumer electronics. It's cheap and available in tens of thousands for immediate dispatch from your local Mouser.

I really like the RP2040 and I want you to know why.

Just the right size

Here is the Mouser stock for a microcontroller manufacturer Espressif:

A screenshot of the Mouser stock for Espressif microcontrollers

Dozens of slightly different controllers. Why?

Unlike software, physical products cost money to manufacture. Every cent saved on a gizmo's components is a cent in earnings, which adds up when the gizmos are manufactured by the million. This creates an incentive to pick a microcontroller that is only just powerful enough (to "right size" it), and usually microcontroller manufacturers are happy to help, offering dozens of variations of the same microcontroller.

Here is the Mouser stock for Raspberry Pi:

A screenshot of Mouser stock for Raspberry microcontrollers

(This is the same microcontroller, just two different packaging options.)

What?

…as long as it's black

Raspberry Pi pulled a Henry Ford and boldly went with just one microcontroller.

There is no choice, no right sizing, but that might be OK! An RP2040 costs ~70 cents, and not all gizmos are produced by the million.

In return, Raspberry Pi ensured that everyone on the planet works with the same part. Compared to more traditional wide lineups, there is a disproportionate number of StackExchange questions, blog posts (including this one), experience, Github issues, libraries, and tools for the RP2040.

This is a good tradeoff for projects like Late Mate, which are likely to save more on development costs than on parts.

Down the stack

This single model pragmatism is evident in the choices Raspberry Pi made for the microcontroller itself. It is designed to be a jack-of-all-trades, trading "excellent" for "sufficient and flexible":

  • Two decent cores. The second core is there if you need it.
  • 30 GPIO pins, a very average number.
  • No on-board flash, spending the budget on more internal RAM that is much harder to wire externally.
  • An OK ADC, good USB support, and the usual peripherals (UART/SPI/I2C/PWM).

Less conventionally, the RP2040 comes with a peripheral called "PIO" for Programmable Input/Output. It's like two tiny coprocessors that can execute your IO fast, with precise timing, and without spending CPU time. Some cool things people do with PIO:

The RP2040 is impossible to brick. It comes with a read-only bootloader that can either mount as a USB mass storage device (firmware updates can just be copypasted to the "storage device"), or use its own simple USB protocol.

In the same pragmatic vein, the RP2040 doesn't engage in security theatre. Protecting the firmware from a dedicated attacker is nearly impossible, but there are complexity and DX costs to trying, so I'm glad Raspberry Pi made the call.

I just love the deliberate design of this little square of silicon. When I work with it, I can see how smart people thought hard about the niche the RP2040 is in and drove the tradeoffs accordingly. As an engineer aspiring to be good someday, I appreciate it.

Discuss on Hackernews

More of ^this^ on Mastodon, Twitter, RSS, or a very occasional newsletter.

Or just let me know what you think at [email protected]!


联系我们 contact @ memedata.com