<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:georss="http://www.georss.org/georss"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
><channel><title>Jay Carlson</title> <atom:link href="http://jaycarlson.net/feed/" rel="self" type="application/rss+xml" /><link>https://jaycarlson.net</link> <description>The blog of Jay Carlson — electrical and electronics engineer in Lincoln, Nebraska. Covers embedded programming, PCB design, and a bit of everything else, too.</description> <lastBuildDate>Sun, 05 Feb 2023 00:23:05 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=5.4.19</generator> <site
xmlns="com-wordpress:feed-additions:1">134108409</site> <item><title>The cheapest flash microcontroller you can buy is actually an Arm Cortex-M0+</title><link>https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/</link> <comments>https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Sun, 05 Feb 2023 00:21:07 +0000</pubDate> <category><![CDATA[Embedded]]></category> <guid
isPermaLink="false">https://jaycarlson.net/?p=2191</guid><description><![CDATA[<p>Browse the Microcontroller pages of LCSC and you&#8217;ll see tons of low-cost MCUs from companies like Padauk, Nyquest, Holychip, SimOne,...</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/">The cheapest flash microcontroller you can buy is actually an Arm Cortex-M0+</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Browse the Microcontroller pages of LCSC and you&#8217;ll see tons of low-cost MCUs from companies like Padauk, Nyquest, Holychip, SimOne, and Fremont Micro Devices — with <a
href="https://www.lcsc.com/product-detail/Microcontroller-Units-MCUs-MPUs-SOCs_Nyquest-Tech-NY8A051H_C5143390.html">prices as low as 4 cents</a>. The problem is these parts all use EPROM: Electronically Programmable Read Only Memory. The missing &#8220;E&#8221; means these aren&#8217;t electronically erasable — they&#8217;re OTP (One-Time Programmable) parts. Once you&#8217;ve burned your hex file, you&#8217;re locked in. OTP parts are widely used for simple devices in cost-sensitive applications, but they&#8217;re annoying to use in designs since to develop firmware, you need <a
href="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/">special emulator hardware</a> (or a huge supply of ICs and a conveniently-located trash can).</p><p>I was interested in finding the cheapest <em>flash</em> microcontroller LCSC sells, and it turns out it&#8217;s not a crusty old 8051 or a PIC16 clone — and it&#8217;s not the <a
href="https://twitter.com/search?q=CH32V003%20&amp;src=typed_query">WCH CH32V003 that the Internet is freaking out about</a> — it&#8217;s actually an Arm Cortex-M0+ made by Puya, it&#8217;s less than 10 cents in moderate quantities, and it&#8217;s awesome.</p><p>Puya? They&#8217;re a flash memory company out of Shanghai that&#8217;s been around since 2012 — mostly making really low-cost SPI flash memory for IoT gadgets. While it may seem odd that the cheapest MCU is made by a Flash memory company, if you know a thing or two about chip design (which I don&#8217;t) you&#8217;ll know that it&#8217;s often the flash memory inside the part that&#8217;s the most expensive IP in the design. This is why so many fabless semiconductor shops don&#8217;t bother with it and just use external SPI flash or OTP memory (just look at any USB webcam controller, Bluetooth audio chip, or even the popular Espressif products).</p><h3>Puya PY32 Selection Guide</h3><p>Puya makes a range of ultra-low-cost Arm Cortex-M0+ parts in the <a
href="https://www.puyasemi.com/cpzx3/info_271_aid_247_kid_246.html">PY32 series</a>. There are three families in the series: the PY32F002A, the PY32F003, and the PY32F030. The families differ in memory, maximum speed, and peripheral inclusion, but they seem entirely progressive (e.g., firmware written for the PY32F002A should run on the PY32F003 and PY32F030). Regardless, all the parts are modern designs that use internal regulators and have an operating voltage range of 1.7 to 5.5V.</p><p>Unlike many other low-cost MCUs that only come in one or two (usually low-density) package options, the PY32 has nine different choices, ranging from a tiny 2&#215;3 mm DFN to a full-sized 32-pin LQFP — along with QFN, TSSOP, and drunk-soldering-friendly SOIC packages.</p><p>I bought a ton of different PY32 parts from LCSC (just <a
href="https://www.lcsc.com/products/Microcontroller-Units-MCUs-MPUs-SOCs_11329.html?keyword=py32">search for PY32</a>). At the time of publication, prices have shot up quite a bit compared to when I first ordered these parts, but currently, the prices range from less than 8 cents up to $0.74 depending on the exact part, configuration, and quantity you&#8217;re buying.</p><p>If you want to avoid redoing some of the work I&#8217;ve done to get these parts going, I have a <a
href="https://github.com/jaydcarlson/py32-template">py32-template GitHub repo</a> with a sample project you can clone and adapt to your needs.</p> <figure
id="attachment_2192" aria-describedby="caption-attachment-2192" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2192" data-permalink="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/screenshot_20230204_095215/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215.png" data-orig-size="1264,890" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screenshot_20230204_095215" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-300x211.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-1024x721.png" class="wp-image-2192 size-large" src="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-1024x721.png?cbc196&amp;cbc196" alt="" width="1024" height="721" srcset="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-1024x721.png 1024w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-300x211.png 300w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215-768x541.png 768w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_095215.png 1264w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2192" class="wp-caption-text">The PY32F002A is a bit bare-bones, but it has everything you need for simple projects.</figcaption></figure><p>The F002A is the base model; it clocks in at 24 MHz, has 20K of flash, 3K of SRAM, and comes in SOIC8/16, TSSOP20, and QFN16 packages — along with an odd 1mm-pitched ESSOP10 package. It has one advanced-control timer with 4 outputs (plus two complementary pairs for driving H-bridges), 1 low-power timer, 1 general-purpose timer, a 1 MSPS 12-bit ADC with 6 external channels, two comparators, a basic watchdog timer, and one SPI, I2C, and USART peripheral. And since this is a Cortex-M0+, you get an SWD debugging interface, a SysTick timer, and a nested vector interrupt controller (NVIC) bundled in.</p> <figure
id="attachment_2195" aria-describedby="caption-attachment-2195" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2195" data-permalink="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/screenshot_20230204_102159/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159.png" data-orig-size="1502,1086" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screenshot_20230204_102159" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-300x217.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-1024x740.png" class="wp-image-2195 size-large" src="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-1024x740.png?cbc196&amp;cbc196" alt="" width="1024" height="740" srcset="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-1024x740.png 1024w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-300x217.png 300w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159-768x555.png 768w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_102159.png 1502w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2195" class="wp-caption-text">The PY32F003 adds DMA and bumps the max CPU frequency up to 32 MHz — but doesn&#8217;t provide an internal oscillator to achieve that.</figcaption></figure><p>The big thing the PY32F003 has over the F002A is DMA support, which is an unusual feature in this price range. The PY32F003 comes in 16K and 32K flash versions (with 2K and 4K of RAM respectively). In addition to the DMA, it adds three more general-purpose timers, a second USART, plus an &#8220;IR timer&#8221; (which is really just a NAND gate fed from TIM16 and TIM17 which can be configured to generate the carrier and data signals respectively). It also adds some reliability with a windowed watchdog (WWDG) and programmable voltage detect (PVD) brownout supervisor.</p><p>While the F003 advertises a 32 MHz operating frequency, its internal oscillator only runs at 24 Mhz. To get to 32 MHz, you&#8217;ll need an external crystal, which can cost more than half as much as the actual microcontroller does, and depending on the MCU package, can double the board area required to lay out the part.</p> <figure
id="attachment_2194" aria-describedby="caption-attachment-2194" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2194" data-permalink="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/screenshot_20230204_101935/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935.png" data-orig-size="1483,1068" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screenshot_20230204_101935" data-image-description="&lt;p&gt;The PY32F030 adds even more peripherals, as well as a PLL capable of driving the CPU to 48 MHz.&lt;/p&gt;
" data-medium-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-300x216.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-1024x737.png" class="wp-image-2194 size-large" src="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-1024x737.png?cbc196&amp;cbc196" alt="" width="1024" height="737" srcset="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-1024x737.png 1024w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-300x216.png 300w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935-768x553.png 768w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_101935.png 1483w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2194" class="wp-caption-text">The PY32F030 can run the CPU at 48 MHz off an internal oscillator thanks to a 2x PLL. It also has larger-package options and up to 64K of flash.</figcaption></figure><p>The PY32F030 is the highest-end part in the lineup. It adds a 2x PLL that can run the core at 48 MHz off of the 24 MHz internal oscillator. The F030 also adds 32-pin QFP/QFN package support to get you up to 30 GPIO pins. In addition to the other capacities already mentioned, the F030 is also available in a higher-capacity 64K flash / 8K RAM version. The peripheral set between the F003 and F030 is identical, save for the F030&#8217;s built-in scanning LED matrix controller, which supports 4 8-segment digits.</p><p>What&#8217;s particularly strange is that the F030 has two different sets of pinouts. The F2 QFN and TSSOP 20-pin packages has three extra analog inputs, which the F1 package trades for 32kHz oscillator support. On the 32-pin package, the K2 version adds an extra GPIO pin in exchange for one fewer GND pin. I&#8217;m not sure of the rationale for trading GPIO pins for redundant power pins; maybe for better analog performance?</p><h3>Are these STM32 clones?</h3><p>While the PY32F030 family looks very much like an STM32F030, they are not compatible parts in any capacity. None of the parts appear to have complete pin compatibility, so they are not compatible at a hardware level. And the register offsets and interrupt vectors are different, meaning there is no binary compatibility for even very basic programs. While the peripherals are very similar to STM32 ones, there are subtle differences in the registers that will trip you up if you&#8217;re familiar with STM32 programming. These changes mostly appear to correct questionable decisions ST made in the first place; for example, the EXTI peripheral now contains configuration registers that allows you to route the correct GPIO bank to the EXTI signal you want (this was strangely located in SYSCFG on the STM32F030).</p><h3>Development Experience</h3><p>Overall, these parts are much easier to use than other parts in this price range, which often have poor English documentation, no code samples or peripheral libraries, or require vendor-provided IDEs and weird tooling.</p><h4>Sourcing</h4><p>You don&#8217;t need to buy these parts from weird Taobao links or AliExpress sellers — they&#8217;re available <a
href="https://www.lcsc.com/products/Microcontroller-Units-MCUs-MPUs-SOCs_11329.html?keyword=PY32">straight from LCSC</a>. I initially designed my own breakout boards for these parts, but my friend Charles noticed Puya has <a
href="https://www.lcsc.com/products/Development-Boards-Kits_11135.html">$5 dev boards</a> available too (which are really just breakout boards — they don&#8217;t even have a built-in debugger). Stock has been fluctuating a lot, as have prices, but they&#8217;re cheap enough to hoard for small-term low-volume projects.</p><h4>Documentation and SDK</h4><p>PY32 documentation is quite good. Visit <a
href="https://www.puyasemi.com/cpzx3/info_271_aid_247_kid_246.html">Puya&#8217;s PY32 web page</a> and you can download everything you need — just scroll horizontally all the way to the right and click on the &#8220;Datasheet&#8221; download (<a
href="https://www.puyasemi.com/uploadfiles/2022/11/PY-MCU%E8%B5%84%E6%96%99-20221117.rar">here&#8217;s a direct link</a> that I&#8217;ll surely forget to update in the future). Notice this isn&#8217;t a datasheet, but a ZIP that contains all the PY32 resources (and yes, each product links to this same file on their web site). Inside, you&#8217;ll find English and Chinese datasheets and reference manuals, code samples, a Keil DFP that contains the flash algorithms you&#8217;ll need to be able to burn your code onto these parts with an SWD probe. The documentation is pretty good, but at the time of writing, only the PY32F030 contains an English reference manual. This isn&#8217;t much of a problem as you can use this same guide for all parts.</p><h4>Compiling</h4><p>Next to all the goofy low-cost 8-bit parts I&#8217;ve played with, boy, it sure does feel nice to be working on an Arm Cortex part. I fired up VSCode, pulled in the SDK, created a Makefile and <code>launch.json</code> config, and I was off to the races.</p><p>Well&#8230; not quite. Like most Arm parts from the East, Puya&#8217;s SDK has set them up for Keil MDK development. You can definitely go grab a free version of Keil MDK and get going immediately, but I wanted a <a
href="https://code.visualstudio.com/">VSCode</a> / <a
href="https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug">Cortex-Debug</a> / <a
href="https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads">GCC</a>-based solution, which took a bit more fiddling. Using other GCC Arm Cortex project code I had laying around as a reference, I created GCC linker config and startup files for each part with a memory map and vector table based on the Keil linker config and startup files. With a bit more source-file mashing, I was able to pull in their STM32 HAL-like peripheral library and build a project.</p><h4>Flashing</h4><p>I really only use two debug servers these days: Segger&#8217;s J-Link GDB Server (obviously for use with their Segger J-Link) and pyOCD (which I use with low-cost CMSIS-DAP probes). To get pyOCD working, I tried searching for the Puya pack, but it&#8217;s not indexed in the repositories that pyOCD searches, so I had to manually install it. I extracted the PY32 DFP (which is just a ZIP file), then I copied the pdsc to pyOCD&#8217;s cmsis-pack-manager&#8217;s pack folder inside the Python distribution I&#8217;m using (mine was in <code>LocalCache\Local\cmsis-pack-manager\cmsis-pack-manager</code>). It&#8217;s important to rename the file to include the version number in it — <code>Puya.PY32F0xx_DFP.1.1.0.pdsc</code>. I then copied the original whole DFP file to the same directory, following the same convention as all the other packs use — copying it to <code>Puya\PY32F0xx_DFP\1.1.0.pack</code>.  After that, to rebuild the index file to include the new pack, I ran:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic">PS C:\&gt; pack-manager add-packs Puya.PY32F0xx_DFP.1.1.0.pdsc</pre><p>I checked that pyOCD could now find the pack:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic">PS C:\&gt; pyocd pack find PY32
  Part          Vendor   Pack                Version   Installed
------------------------------------------------------------------
  PY32F002Ax5   Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x4    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x6    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x8    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x3    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x4    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x6    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x7    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x8    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F072xB    Puya     Puya.PY32F0xx_DFP   1.1.0     True</pre><p>and then installed it:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic">PS C:\&gt; pyocd pack install PY32F003x8</pre><p>Getting J-Link support was actually less involved. Segger doesn&#8217;t have Puya PY32 support, but you can add custom device support by <a
href="https://wiki.segger.com/J-Link_Device_Support_Kit">following directions here</a>. I created a <code>JLinkDevices\Puya\PY32</code> folder structure, then added a Devices.xml file:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic">&lt;Database&gt;
  &lt;Device&gt;
    &lt;ChipInfo Vendor="Puya" Name="PY32F002Ax5" WorkRAMAddr="0x20000000" WorkRAMSize="3072" Core="JLINK_CORE_CORTEX_M0" /&gt;
    &lt;FlashBankInfo Name="Internal code flash" BaseAddr="0x08000000" AlwaysPresent="1" &gt;
      &lt;LoaderInfo Name="Default" MaxSize="0x5000" Loader="PY32F0xx_20.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" /&gt;
    &lt;/FlashBankInfo&gt;
  &lt;/Device&gt;
&lt;/Database&gt;</pre><p>I then copied the FLM flash programming algorithm files out of Puya&#8217;s DFP into this folder. After doing that, I was able to see the device in J-Link&#8217;s target selection box, and everything worked flawlessly. I will note that you have to be on a relatively-recent version of J-Link for this to work, so make sure you&#8217;ve upgraded and actually have the correct version on your PATH.</p> <figure
id="attachment_2196" aria-describedby="caption-attachment-2196" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2196" data-permalink="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/screenshot_20230204_113335/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335.png" data-orig-size="1424,822" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screenshot_20230204_113335" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-300x173.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-1024x591.png" class="wp-image-2196 size-large" src="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-1024x591.png?cbc196&amp;cbc196" alt="" width="1024" height="591" srcset="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-1024x591.png 1024w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-300x173.png 300w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335-768x443.png 768w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_113335.png 1424w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2196" class="wp-caption-text">Debugging in VSCode with the Cortex-Debug plugin worked without any issues.</figcaption></figure><h4>Debugging</h4><p>I tested both Segger Ozone and VSCode (via Cortex-Debug) and was a little disappointed with how little effort it took to get going. It&#8217;s a Cortex-M0+, so debugging worked without a hiccup. Breakpoints, reading memory, yada-yada. I will say that while I was working through some low-power code, I noticed the SVD files provided by Puya were missing the PWR peripheral, so I had to manually add it. The SVD files are very bare-bones, with no descriptions or enumerations for things, but they seem to be accurate. Again, when compared to other parts in this price range, there&#8217;s no contest.</p><h4>In Use</h4><p>On parts with unique peripherals, I try to play with everything a bit before casting judgment — just to look for gaping holes or big-time &#8220;gotchas&#8221; — but since these are STM32-like peripherals, you kind of know what you&#8217;re getting.</p><p>One big difference between this and the STM32F030 is low-power support. The PY32F030 parts advertise a typical low-power stop mode current consumption of 4.5 µA when using a 1.0V setting with the internal regulator, and I was able to get the part to drop down to 5 µA in my testing. Meanwhile, the STM32F030 uses less than half of that in stop mode, and in run mode always outpaces the PY32F030 substantially: it doesn&#8217;t have the low-power internal 32 kHz oscillator the PY32 does, but it doesn&#8217;t seem to need it — when powered with its internal 8 MHz oscillator it uses less than half the current as the PY32 running off its internal 32 kHz one (while running 250 times faster). All told, the PY32F030 does not live in the sub-microamp ultra-low-power territory that you can hit with more expensive parts, but we&#8217;re still talking about a microcontroller that can be powered for several years with a minuscule CR2032 battery.</p><p>Puya chose to nearly copy the STM32 peripheral register API, as well as the STM32 HAL library. When I started with STM32 years ago, I wasn&#8217;t particularly offended by STM32&#8217;s HAL library, but as I&#8217;ve used more parts over the years, I find it more and more annoying to configure and use. On a part with only 20K of flash, these HAL libraries can eat into quite a bit of space, so if you&#8217;re using this part for real projects, you may find yourself using lighter-weight peripheral libraries to save space.</p><h3>What about the CH32V003 or STM32F030?</h3><p>The elephant in the room is the <a
href="http://www.wch-ic.com/products/CH32V003.html">WCH CH32V003</a>, an entry-level RISC-V chip <a
href="https://www.cnx-software.com/2022/10/22/10-cents-ch32v003-risc-v-mcu-offers-2kb-sram-16kb-flash-in-sop8-to-qfn20-packages/">widely covered</a> in the electronics press that may or may not be available for around 10 cents. While people mention buying these parts from WCH&#8217;s official AliExpress store, at the time of writing, it appears that they yanked the part, and I can&#8217;t find them anywhere on AliExpress for less than <a
href="https://www.aliexpress.us/item/3256804778040328.html?spm=a2g0o.productlist.main.1.1fbb1981RBztKh&amp;algo_pvid=1d9be512-b6ad-482f-9934-82a620a317d0&amp;algo_exp_id=1d9be512-b6ad-482f-9934-82a620a317d0-0&amp;pdp_ext_f=%7B%22sku_id%22%3A%2212000031176801908%22%7D&amp;pdp_npi=2%40dis%21USD%2111.9%2111.9%21%21%21%21%21%4021021aa216755522467013891d0701%2112000031176801908%21sea&amp;curPageLogUid=WdKd7BJeTabV">$2 per chip</a>, though it&#8217;s on Taobao for <a
href="https://item.taobao.com/item.htm?spm=a230r.1.14.24.1556799fHGTRPW&amp;id=690298445813&amp;ns=1&amp;abbucket=15#detail">about 25 cents each</a>.</p><p>It&#8217;s hard to find a direct cross between the CH32V003 and the PY32. In terms of flash/RAM/peripherals, the CH32V003 is very similar to the entry-level PY32F002A, which can be had for <a
href="https://www.lcsc.com/product-detail/Microcontroller-Units-MCUs-MPUs-SOCs_PUYA-PY32F002AL15S6TU_C5292060.html">less than 10 cents</a> in fairly modest volumes (though for most projects, you&#8217;d need more pins and would opt for the <a
href="https://www.lcsc.com/product-detail/Microcontroller-Units-MCUs-MPUs-SOCs_PUYA-PY32F002AW15U6TR_C5291740.html">14-cent QFN16 version</a>). The Puya part has more flash and RAM, while the CH32V003 has an internal 2x PLL that runs the core twice as fast. The CH32V003 also has DMA, which is especially important when working with high-bit-rate communications interfaces on these low-speed devices. If you move up to the PY32F030 to match the clock speed and DMA of the CH32V003, you&#8217;ve jumped up considerably to <a
href="https://www.lcsc.com/product-detail/Microcontroller-Units-MCUs-MPUs-SOCs_PUYA-PY32F030F18P6TU_C3018715.html">30 cents or more</a>, but you&#8217;re also getting a part with four times more flash and RAM, plus 3 more timers and another USART.</p> <figure
id="attachment_2198" aria-describedby="caption-attachment-2198" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2198" data-permalink="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/screenshot_20230204_123809/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809.png" data-orig-size="1148,981" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screenshot_20230204_123809" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-300x256.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-1024x875.png" class="wp-image-2198 size-large" src="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-1024x875.png?cbc196&amp;cbc196" alt="" width="1024" height="875" srcset="https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-1024x875.png 1024w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-300x256.png 300w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809-768x656.png 768w, https://jaycarlson.net/wp-content/uploads/2023/02/Screenshot_20230204_123809.png 1148w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2198" class="wp-caption-text">Unlike other parts in this price range (including the CH32V003), Segger Ozone has no issues working with the Puya PY32 — here, I&#8217;m plotting ADC data streamed live from my breadboard.</figcaption></figure><p>My biggest gripe with the CH32V003 is the tooling: it uses a goofy one-wire debug interface requiring a proprietary debugger and a hacked-together custom version of OpenOCD (a software I detest). I think most WCH users just use MounRiver, an Eclipse-based IDE that comes preconfigured for WCH CH32 parts. This software feels painfully slow compared to VSCode and Ozone-based workflows. Some of these issues are WCH-specific, and some are more broadly a problem with RISC-V — no pyOCD support, no Cortex-Debug support, and spotty J-Link support, too. I haven&#8217;t looked into higher-end RISC-V cores, so I have no idea what kind of support there is for instruction trace and other advanced debugging tools, but it just seems like the RISC-V development ecosystem has a long way to go before it achieves parity with Arm.</p><p>What about Arm competitors? It&#8217;s no surprise these PY32 parts are cheaper than the STM32F030, though the direct cross — the PY32F030 — really isn&#8217;t <em>that much</em> cheaper. You can get <a
href="https://www.lcsc.com/product-detail/Microcontroller-Units-MCUs-MPUs-SOCs_STMicroelectronics-STM32F030F4P6_C32908.html">STM32F030F4P6s from LCSC</a> for about 50 cents each in moderate quantity. These don&#8217;t have the flash or RAM or 5V compatibility the PY32F030 does, but you get better low-power support and a bit less pain in initial project set-up (especially considering the STM32CubeMX compatibility). The Puya parts, however, offer way more varied package options. I&#8217;m not a big fan of TSSOP and LQFP packages, so it&#8217;s nice to get similarly-spec&#8217;d parts in tiny DFN and QFN packages. And if you can sacrifice some performance, you can get into the PY32 for much less than an STM32F030.</p><h2>Final Thoughts</h2><p>A while back I wrote a large blog post on the Padauk PMS150; the post ended up so long simply because the ecosystem was quite different than modern development environments. There were several-hundred-dollar emulators and programmers you had to buy, a weird IDE that used a subset C dialect that often looked more like assembly, and OTP memory that meant that one mistake could send you to the soldering rework station to pop off and discard the MCU you just accidentally ruined. Unless you&#8217;re making products in super high volumes, it really doesn&#8217;t make much sense to invest in the tools, time, and effort to learn that ecosystem.</p><p>The Puya PY32 couldn&#8217;t be more different. The entire time I worked through this project, I kept forgetting that I was using a part that is 20 times cheaper than what I&#8217;m used to using. It has the same sorts of peripherals you&#8217;d expect to find on any NXP, ST, or Microchip Arm part you&#8217;d buy off DigiKey. It has good English documentation, full compatibility with the debug probes you already own, and you can use whatever software ecosystem you prefer — Eclipse, Vim, VSCode, Embedded Studio, Keil, IAR, or nearly anything else.</p><p>Bottom line: the Puya PY32 ecosystem is just plain boring — and that&#8217;s a good thing.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/">The cheapest flash microcontroller you can buy is actually an Arm Cortex-M0+</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2023/02/04/the-cheapest-flash-microcontroller-you-can-buy-is-actually-an-arm-cortex-m0/feed/</wfw:commentRss> <slash:comments>17</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">2191</post-id> </item> <item><title>Here&#8217;s how I juggle embedded projects (home office/workspace tour)</title><link>https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/</link> <comments>https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Sun, 19 Sep 2021 04:16:35 +0000</pubDate> <category><![CDATA[Uncategorized]]></category> <guid
isPermaLink="false">https://jaycarlson.net/?p=1914</guid><description><![CDATA[<p>My workspace has gone through a ton of changes over the years, but this year, I started making a concerted...</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/">Here&#8217;s how I juggle embedded projects (home office/workspace tour)</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p>My workspace has gone through a ton of changes over the years, but this year, I started making a concerted effort to rethink how to juggle multiple projects effectively. I started working seriously on my <a
href="https://jaycarlson.net/embedded-linux/"><em>So you want to build an embedded Linux system?</em></a> blog post, which entailed building <em>lots</em> of different hardware, and evaluating it ad-hoc as I went along. I would notice something strange about a platform, and then think back, &#8220;wait, was it the same way on that other chip, too?&#8221; I&#8217;d have to dig up old boards, plug everything together, fire it up, run a command, and check the output.</p><p>At the same time, there&#8217;s been a lot of buzz online in the past year or so about electronics workspaces. With so many people working from home during the pandemic, everyone&#8217;s been sharing the gear they&#8217;ve been using, what their office setups look like, and how they like to manage things. Since several people have asked me to talk about workflow, I thought I&#8217;d throw my hat in the ring. This post will discuss my office design, my workflow, and all the gear — big and small — I use to juggle different projects.</p><p></p> <figure
id="attachment_2122" aria-describedby="caption-attachment-2122" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2122" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/montage-3/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/montage-2.jpg" data-orig-size="1024,684" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="montage" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/montage-2-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/montage-2.jpg" class="wp-image-2122 size-full" src="https://jaycarlson.net/wp-content/uploads/2021/09/montage-2.jpg?cbc196&amp;cbc196" alt="" width="1024" height="684" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/montage-2.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/montage-2-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/montage-2-768x513.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2122" class="wp-caption-text">The rug may stay the same, but my workspace has evolved dramatically since I set my first one up in 2010.</figcaption></figure><h2>Evolved Spaces</h2><p>Our workspaces reflect who we are and what we care about, so they evolve over time. You&#8217;re going to acquire new gear, get rid of tools you don&#8217;t use, upsize, downsize, and twist and turn. I was digging through old photos to try to come up with some examples of my previous set-ups, and it really brought back some memories. I also realized it took me a <em>long </em>time to realize what was working for me and what wasn&#8217;t.</p><p>My real foray into electronics started toward the end of my undergrad career in 2010 when I was living in a bit of a party house. My DMX lights, amplifiers, and other gear seemed in constant need of repair; this was the first time that I really connected the abstract material we were learning in EE classes to real-world applications. This was also when I started building little circuits on protoboard (one of the first projects I remember was an XLR balanced line receiver for an amplifier to remove hum). These circuits required nothing more than a soldering iron and a computer to look up datasheets. Eventually, I snagged an oscilloscope, function generator, and linear power supply. I was set.</p><p>Back then, programming terrified me. My only embedded systems experience was an assembly-based class I took a few years prior taught mostly on a blackboard, along with a giant 68HC12 development board that was chained to a Windows 95 PC in a lab. Like many of my EE classes, I nearly failed it; I clearly remember leaving that class thinking I could never do any programming. I&#8217;d stick to analog circuits, thank you very much.</p> <figure
id="attachment_2114" aria-describedby="caption-attachment-2114" style="width: 235px" class="wp-caption alignright"><img
data-attachment-id="2114" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/_igp0264/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264.jpg" data-orig-size="1606,2048" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;3.2&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;PENTAX K10D&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1279388721&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;25.63&quot;,&quot;iso&quot;:&quot;400&quot;,&quot;shutter_speed&quot;:&quot;0.033333333333333&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="_IGP0264" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-235x300.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-803x1024.jpg" class="size-medium wp-image-2114" src="https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-235x300.jpg?cbc196&amp;cbc196" alt="" width="235" height="300" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-235x300.jpg 235w, https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-803x1024.jpg 803w, https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-768x979.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264-1205x1536.jpg 1205w, https://jaycarlson.net/wp-content/uploads/2021/09/IGP0264.jpg 1606w" sizes="(max-width: 235px) 100vw, 235px" /><figcaption
id="caption-attachment-2114" class="wp-caption-text">Early experiments on a PIC16 microcontroller from July, 2010.</figcaption></figure><p>The problem was that I kept hitting a glass wall with little projects I wanted to do at home. I remember wanting to build sound-activated lights, a little RF remote control thing, and tons of other little projects, but it seemed like everything required a microcontroller. I started tip-toeing into embedded systems. Based on suggestions from forums online, I started dorking around with PIC16 and PIC18 parts, using a PicKit clone and a pirated copy of the CCS toolchain. You may laugh, but keep in mind that I had never heard of Arduino (nor had most people at the time), I had never done any C programming, and I had no social network of mentors to learn from.</p><p>This is when I started experimenting with different workspace setups. I threw together a computer out of old parts and set that up on my bench as my electronics workstation. It was old and slow, but totally passable for basic MCU development.</p><p>I started a master&#8217;s program after graduating that winter. I was working in a fantastic lab on campus with a great setup (and deep pocketbooks to buy any new gear I wanted). I was totally enthralled by the experience and rarely went home before 10 or 11 pm. My workbench at home started gathering dust. In the spring of that year, I bought a house. Looking for a cozy, clean look, I didn&#8217;t even think to move my then-dilapidated workbench into my new home office — I moved it into the garage, out of sight, knowing I&#8217;d rarely use it.</p><p>When I started taking on consulting projects a year and a half later, I dusted the bench off and moved it upstairs into my home office. Instead of a dedicated bench computer, I ran long DVI and USB cables from my main desktop. Over time, I acquired better gear and started narrowing more into my current specialty of intersecting embedded hardware and software. My analog kit started moving further away, out of sight, replaced with more monitors, more USB hubs, and more computer-related peripherals. This is essentially how I operated for the next six years until I bought my current home, which proved to be a good time to take a step back and re-evaluate the best way to set things up.</p><h2>Workspaces are not one-size-fits-all</h2><p>Scrolling through responses to <a
href="https://twitter.com/Chris_Gammell/status/1426619542378319876">Chris Gammell&#8217;s tweet soliciting workspace inspiration</a>, the first thing I noticed is how utterly <em>different</em> everyone&#8217;s set-ups are. <a
href="https://mobile.twitter.com/arturo182/status/1355574010457812996">Same thing with Arturo182&#8217;s request</a>. There are classic analog electronics workbenches, like this one from <a
href="https://twitter.com/Mind_of_Bob/status/1426631620962947079/photo/1">@Mind_of_Bob</a>:</p><p><img
class="aligncenter" src="https://pbs.twimg.com/media/E8xp5ffXsAU38RX?format=jpg&amp;name=large" alt="Image" width="621" height="349" /></p><p>There are people with elaborate setups to assemble large batches of PCBs, like <a
href="https://twitter.com/talldarknweirdo/status/1426884150494175233/photo/1">@talldarknweirdo&#8217;s setup</a>:</p><p><img
class="aligncenter" src="https://pbs.twimg.com/media/E81PdRnWUAUyVGw?format=jpg&amp;name=large" alt="Image" width="620" height="465" /></p><p>Plus many with lots of built-in storage and mechanical capabilities, <a
href="https://twitter.com/lacavediy/status/1428245531462078465/photo/1">like @lacavedly has</a>:</p><p><img
class="aligncenter" src="https://pbs.twimg.com/media/E9Ilva9X0AUV3xX?format=jpg&amp;name=large" alt="Image" width="621" height="466" /></p><p>What an &#8220;electronics workspace&#8221; means to you really depends on what &#8220;electronics&#8221; means to you.  This may seem obvious, but I get lots of questions from people asking about how many desks they need, or which scope they should buy, or which function generator they need, or which power supply to get, or whether they should get an Analog Discovery 2, 3D printer, bigger monitor, or any number of other gear. </p><h2>Establishing Modalities</h2><p>If you&#8217;re thinking about redoing your space, the first thing to think about is <strong>how much time you spend in each modality in your office</strong>. Is your computer a thing you just use to look up datasheets on, or do you sit in front of it 24/7? Are your soldering station and oscilloscope the two most important things you use? This will help you inform how things should be arranged with respect to each other. While you&#8217;re thinking about this, you might want to consider:</p><ul><li><strong>The type of projects you work on.</strong> If you&#8217;re designing a lot of analog audio projects, you might need a signal generator, scope, high-quality bipolar supplies, variac, isolation transformer, distortion meter, and other specialized analog test equipment close to you all the time. If you&#8217;re doing ultra-low-power embedded, you&#8217;ll replace most of that with a logic analyzer, BLE/LoRA packet sniffer, and some sort of source measurement unit (SMU). Totally different gear.</li><li><strong>The level of mechanical integration.</strong> If you&#8217;re doing turn-key proof-of-concept prototyping, you might spend a lot of time in front of a 3D printer, laser cutter, or needing ready access to lots of hand tools to build and assemble prototypes.</li><li><strong>Whether you&#8217;re assembling PCBs or not.</strong> There are tons of electronics hobbyists that really focus on breadboarding circuits and repairing gear — they really don&#8217;t do much PCB assembly. And building up quantity-of-five runs is quite different from building up larger batches, where it makes sense to invest in stencil printers, pick-and-place machines, and large reflow ovens. Where will those be set up in relation to other stuff in your office?</li><li><strong>The amount of firmware engineering you do.</strong> Whether you actively use your computer while working on projects is going to drive your computer choices and office layout. </li></ul><h2>Building My Priorities</h2><p>For me, I&#8217;ve narrowed it down to a few things:</p><h4>Computer-centric workflow</h4><p> I&#8217;m an embedded electronics engineer, not a technician. I spend most of a prototype&#8217;s design lifecycle in front of a computer, reading PDFs, searching for supplies, designing PCBs, coordinating and designing mechanical CAD stuff, writing firmware, and communicating with others on my team about these designs. My computer needs to be the main attraction — it needs to be extremely powerful, and I need a massive amount of monitor space to stretch out and multitask.</p><h4>Processor-heavy PCB bring-up</h4><p>I work on processor-centric designs at the intersection of hardware and software, so 95% of the time, I&#8217;ve got PCBs that I&#8217;m futzing with while they&#8217;re attached to my computer. That means I need a soldering iron, multimeter, and logic analyzer right next to my computer at all times.</p><p>This was the biggest problem I had with my old office: my computer was completely disconnected from my bench. Eventually, I hacked around this issue a bit with a couple of extra monitors, but window management was a pain in the butt and I just wasn&#8217;t as productive as I could have been.</p><p>An interesting corollary: since I work on processor-heavy designs, it also means I really <em>don&#8217;t</em> need a lot of specialized analog test gear — at least right next to me at all times. If my oscilloscope broke, it&#8217;d probably be a couple of months before I even noticed. This is something very particular with the projects I work on; if I were more of a pure embedded software engineer, I could handle having my soldering setup on the other side of the room. If I mostly built guitar pedals, I&#8217;d probably want way more test gear and way less computer to bring my boards up.</p><h4>Juggling multiple projects</h4><p>I always have way too many projects on my desk that are completely unrelated. I need to be able to tear down and set up projects quickly. I also need ample work surfaces so I can keep multiple projects set up concurrently when possible.</p><h4>Small-batch assembly</h4><p>I build very small volumes of prototypes when it&#8217;s convenient — usually no more than 3-5 boards. For assembly, I need some minimal computing access, along with a massive amount of desk space to lay parts out, paste up boards, place components, and reflow things.</p><h4>Good artwork plus unobstructed views outside</h4><p>I have a lot of glass in my office, and I don&#8217;t want anything obstructing my backyard view. I also want to have enough visible wall space to be able to display more artwork than I had at my old house. I never want to feel like I&#8217;m working in a warehouse or a lab in some hidden bunker.</p><p><a
href="https://jaycarlson.net/wp-content/uploads/2021/09/Layout.svg?cbc196&amp;cbc196"><img
data-attachment-id="2078" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/layout/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/Layout.svg" data-orig-size="" data-comments-opened="1" data-image-meta="[]" data-image-title="Layout" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/Layout.svg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/Layout.svg" class="aligncenter  wp-image-2078" src="https://jaycarlson.net/wp-content/uploads/2021/09/Layout.svg?cbc196&amp;cbc196" alt="" width="619" height="640" /></a></p><h2>Desk Layout</h2><p>I&#8217;ve settled on an L layout. This layout is great for unimodal workspaces (where you spend most of your time doing one thing) since you can maximize the work area you have without having to move your chair. To design an L area for unimodal work, start in the corner by placing your most-used components and work areas (for me, that&#8217;s my computer, soldering/development area). Then, slowly branch outward in either direction as you place equipment you use less and less frequently.</p><p>There are a few implementation-specific details I&#8217;d like to discuss, but first, here&#8217;s a picture of the setup:</p> <figure
id="attachment_2095" aria-describedby="caption-attachment-2095" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2095" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210910-0530/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530.jpg" data-orig-size="2048,1285" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;5.6&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;PENTAX K-1&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631293428&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;15&quot;,&quot;iso&quot;:&quot;800&quot;,&quot;shutter_speed&quot;:&quot;0.00625&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210910-0530" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-300x188.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-1024x643.jpg" class="size-large wp-image-2095" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-1024x643.jpg?cbc196&amp;cbc196" alt="" width="1024" height="643" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-1024x643.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-300x188.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-768x482.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530-1536x964.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210910-0530.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2095" class="wp-caption-text">The core of my L desk setup is the computer workspace</figcaption></figure><p>I built the computer desk out of walnut-veneered plywood with a steel telescoping square-tubing base that I cut and welded together. While it&#8217;s a motorized sit/stand desk, I almost never use it in the standing position. The desk is absolutely massive: it&#8217;s 34&#8243; deep and 80&#8243; wide. The extra depth accommodates tripods and light stands behind my monitor and gives me some hidden storage behind my filing cabinet under the desk for speaker amplifiers, EQ, and other pieces of equipment. It also gives me plenty of desk space — even in front of my clunky laser printer. My biggest issue with this left area of the desk is the inefficient use of space — the vertical monitor and filing cabinet form a wall that prevents me from easily interacting with anything to the left of my computer, so it&#8217;s typically where I just stash stuff temporarily.</p><p>The electronics bench is melamine-veneered particle board from Home Depot that I mounted into painted steel component shelving from Menards. To build this, you&#8217;ll need <a
href="https://www.menards.com/main/storage-organization/shelves-shelving-units/steel-component-shelving/xtreme-garage-reg-heavy-duty-steel-end-frame/1365053/p-1525069762979.htm">36&#8243; x 30&#8243; end frames</a> plus <a
href="https://www.menards.com/main/storage-organization/shelves-shelving-units/steel-component-shelving/xtreme-garage-reg-heavy-duty-racking-beam/899700/p-1451391644313.htm">beams that come in 48, 72, or 97&#8243; lengths</a>. This shelving is fantastic — I use it in my garage, in the basement, and in my office. The desk is 30&#8243; deep, which is about perfect. I wouldn&#8217;t want any less than that, but if it were any deeper, I&#8217;d be reaching too far over stuff for it to be comfortable.</p><p>The corner of the L is typically dead space; in my case, it&#8217;s perfect for test gear which tends to be really deep. I keep the gear at a near-45-degree angle and stagger the equipment into two groups.</p><p>Next is my &#8220;product area&#8221; — basically, it&#8217;s the area where my current project lives. I have access to mains power (with a variac, too), ethernet, USB, and HDMI. It&#8217;s where my soldering station and hot air gun usually live. I have an inspection microscope and wide-field overhead camera for sharing my work over video conferencing.</p><p>By the way, this sounds like a silly thing to mention, but you really <em>do</em> need a &#8220;product work area&#8221; — I&#8217;ve seen plenty of desk setups where people seem to forget that they need to actually, like, you know, work on things that occupy space. I have approximately 20&#8243; depth for projects (this is important!), and when the desk is clean, almost 7 ft of linear space.</p><p>To the right of the product work area is the PCB assembly area. I have a separate monitor that clones my right-most desktop, along with a mouse and occasionally a keyboard. This area is where my vacuum pen and hot plate live — along with my rarely-used reflow oven. Having enough space allows me to assemble new boards even while I have a project set up.</p><p>An underrated aspect of my office that few people notice: I have two chairs — a <a
href="https://www.hermanmiller.com/products/seating/office-chairs/aeron-chairs/">Herman Miller Aeron</a> as well as a <a
href="https://www.nationalofficefurniture.com/products/seating/aurora">National Aurora</a>. These are very different chairs. The Aeron is more ergonomic and breathable, but the Aurora is more plush and luxurious. If I&#8217;m working for long stretches of time, I alternate between them to reduce pressure points. Having a second chair is also handy when I&#8217;m collaborating with friends or colleagues. Good-quality office chairs can last 20-30 years (or more) with very little maintenance, and sometimes you can get them heavily discounted from your local commercial office furnishing company if they have excess inventory of an older model they&#8217;re trying to get rid of. You really shouldn&#8217;t buy cheap plastic chairs at big-box stores; they&#8217;re just going to fall apart and end up in the landfill in a few years&#8217; time.</p><h1>Fast Context-Switching</h1><p>I have to juggle tons of projects simultaneously, which means I have to constantly context-switch. The faster you can context-switch between projects, the more efficient you are.</p><p>My big realization last year was that keeping my office clean was (on the face of it, at least) diametrically opposed to fast context-switching. If you want your office to be clean, all your projects need to be neatly filed away, and all your tools need to be in drawers somewhere, out of sight. To switch between projects, you&#8217;d tear down your old project, put everything back in a box, file the box away, then set up the new project and start working on it. </p><p>But it just takes way too damn long to set projects up. You&#8217;ve got to grab all the PCBs, displays, and extraneous components, plug them all together, find your debugger, re-build that custom wire harness to connect to it, open up the PCB design files to remember which test points were what, route those out to your logic analyzer, and reconnect all the USB cables for that junk. That can easily take 15 minutes or more of time, every time you&#8217;re switching projects.</p><p>One solution is to stop trying to keep your office clean and just leave everything set up all the time. Been there, done that. While that makes it fast to context-switch, once you <em>are</em> switched into the right project, your productivity drops substantially since you can&#8217;t ever find what you&#8217;re looking for (since everything is sprawled out, everywhere). It&#8217;s also rather embarrassing to appear to be calling from a pig stye whenever you hop on a Zoom call with colleagues.</p><p>Instead, I set out to invest in equipment and accessories to remove as much friction as possible when context-switching while still letting me keep my office clean.</p> <figure
id="attachment_2086" aria-describedby="caption-attachment-2086" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2086" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1939/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;2.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631225632&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;100&quot;,&quot;shutter_speed&quot;:&quot;0.1&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1939" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-1024x683.jpg" class="size-large wp-image-2086" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1939.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2086" class="wp-caption-text">Current projects get allocated a tray — I can quickly set up and tear down a project in a matter of seconds.</figcaption></figure><h3>Project Tray System</h3><p>The first thing I invested in was a project tray system. This lets me keep projects set up, ready to go. Projects still have a box assigned to them to store bare PCBs, parts, and other odds and ends — as well as completed projects (since I don&#8217;t quite get as much density with the trays).</p><p>I bought <a
href="https://www.amazon.com/dp/B00B1J0FV8">this food service 10-tier sheet pan rack</a> plus a <a
href="https://www.amazon.com/dp/product/B00FRIDR1Y">couple dozen lunch trays</a> and they work great. I&#8217;m setting up a similar system at work right now with a few <a
href="https://www.amazon.com/dp/B009NVCPB4">full-size trays</a> for larger projects. You can opt for ESD-safe trays if you&#8217;re one of those people.</p> <figure
id="attachment_2083" aria-describedby="caption-attachment-2083" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2083" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1926/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;2.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631223262&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;100&quot;,&quot;shutter_speed&quot;:&quot;0.025&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1926" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-1024x683.jpg" class="size-large wp-image-2083" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1926.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2083" class="wp-caption-text">Wait, did the last rev of that board have the same bug? With project trays, it takes 5 seconds to plug it in and find out.</figcaption></figure><h3>Making project trays useful</h3><p>Project trays are only useful if you use them properly. Don&#8217;t move old versions of boards into boxes once you&#8217;ve built up new revisions — they should both be on separate trays so you can sanity-check things if necessary. You&#8217;ll really want to invest in all the cables and adapters necessary to keep everything hooked up at all times. Almost all of my trays have a 4-port USB 3.0 hub glued to them which allows me to connect power, debug probes, USB-to-serial converters, and any other gadget I need. All of that stuff lives on the tray for the lifespan of the project, so you&#8217;ll need to have a lot of duplication.</p><p><a
href="https://www.amazon.com/dp/B00JX1ZS5O">These Sabrent 4-port USB 3.0 hubs</a> have individual power switches for each port, which is a total necessity for embedded development — you can quickly power-cycle your boards, debug adapters, and USB-to-serial converters. I really should have checked about volume discount pricing, since I own dozens of these between my home office and work. Unlike a lot of USB hubs, I&#8217;ve never seen one of these fail.</p><p></p><p>USB-to-serial converters are the standard mechanism for interacting with embedded Linux projects as well as some bare-metal systems, so grab a few four-packs of <a
href="https://www.amazon.com/dp/B07XF2SLQ1">these FT232RL modules</a> so you can keep everything wired up as you&#8217;re moving between projects. They have selectable 5V / 3.3V logic levels and break out all the special flow/control signals you&#8217;ll never use.</p><p>Additionally, since I do a lot of embedded Linux work, I have an ethernet switch on my desk — almost like a USB hub — ready to plug into. This lets me connect multiple projects simultaneously without fiddling with cabling under my desk. Since the switch connects to my home network, my projects can automatically pull DHCP leases and gain Internet access with no special configuration. This is much easier than trying to connect projects directly to your computer.</p><p>You could grab a <a
href="https://www.amazon.com/dp/B07S98YLHM">small 5-port unmanaged gigabit switch</a> for most casual work where your project&#8217;s networking stack already works without issue — but if you&#8217;re bringing up boards with buggy network stacks or you&#8217;re trying to benchmark specific performance criteria, spend the extra money on a managed switch like the <a
href="https://www.amazon.com/dp/B07PJ7XZ7X">5-port Netgear GS305E</a> or <a
href="https://www.amazon.com/dp/B07PLFCQVK">8-port Netgear GS308E</a>.</p><p>These switches have a web-based user interface that lets you configure several networking features — the most relevant to me is <em>port mirroring</em>. This feature duplicates the network traffic sent and received on one or more ports and sends it to a separate monitoring port that you can attach to your computer and view through something like <a
href="https://www.wireshark.org/">WireShark</a>. This gives you a ton of insight into the raw Ethernet frames sent and received by your embedded project.</p><p>And finally, it&#8217;s nice to have a <a
href="https://www.amazon.com/dp/B07RY7Y9PR">three-channel HDMI selector</a> sitting in front of an HDMI capture card so you can route any video sources from embedded projects to your computer for recording, streaming, or just for display. Even if you&#8217;re sitting right next to it, it&#8217;s still nice to have a window in the corner of your monitor with your embedded project&#8217;s output video instead of having to hunch over and look at a separate LCD screen all the time.</p> <figure
id="attachment_2085" aria-describedby="caption-attachment-2085" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2085" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1937/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;1.4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631225484&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;100&quot;,&quot;shutter_speed&quot;:&quot;0.00625&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1937" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-1024x683.jpg" class="size-large wp-image-2085" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1937.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2085" class="wp-caption-text">Simply having color-coded USB cables and extra sets of Saleae probes makes a huge difference</figcaption></figure><p>If you take some time to invest in the little stuff, it really goes a long way. For example, <a
href="https://usd.saleae.com/collections/accessories">Saleae sells extra sets of test leads</a>, so you can keep everything wired up with the correct channel order, and all you have to do is plug in the bus connector and load a project-specific preset in the software. You can buy <a
href="https://www.amazon.com/dp/B007NLW3C2">packs of multi-colored USB cables</a> so you can easily figure out which port goes to which device. I went really nuts and bought <a
href="https://www.amazon.com/dp/B07958HX65">slim Ethernet cables</a> and <a
href="https://www.amazon.com/dp/B00T58JH98">slim HDMI cables</a>, and I love having them around.</p> <figure
id="attachment_2087" aria-describedby="caption-attachment-2087" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2087" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1948/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631225955&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;640&quot;,&quot;shutter_speed&quot;:&quot;0.02&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1948" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-1024x683.jpg" class="size-large wp-image-2087" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1948.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2087" class="wp-caption-text">A detail view of my wall of organizers illustrates the complete lack of order of parts filed away in the bins.</figcaption></figure><h2>Other Organization Tools</h2><h3>Wall Storage Bins</h3><p>I have a wall full of storage bins that goes back to my college days. They used to contain every single IC, transistor, and passive I owned, but these days, I only file away stuff that I find myself using all the time. It&#8217;s where I keep all my breadboarding parts, along with popular connectors, voltage regulators, transistors, and other ICs.</p><p>The bins aren&#8217;t sorted by category; instead, each bin has an incrementing number associated with it, and I have a database on my computer that will tell me the location of anything. The advantage is that I always know exactly what I have and where it is, but the disadvantage is I can&#8217;t really just walk up to the wall of parts and know where something is, since everything is sorted numerically. Everything has to be looked up or memorized. I&#8217;m not sure I would do it the same way if I had to do it again.</p><p>The reason why I stopped filing everything away in the wall of bins is that my BOMs started getting heavily specialized when I started working professionally — if I didn&#8217;t switch to storing parts in project boxes, the wall bins would grow uncontrollably. I&#8217;m putting a hard stop on buying more bins — I don&#8217;t want my office to turn into a warehouse. </p> <figure
id="attachment_2080" aria-describedby="caption-attachment-2080" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2080" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-0519/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;5.6&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;PENTAX K-1&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631214678&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;15&quot;,&quot;iso&quot;:&quot;800&quot;,&quot;shutter_speed&quot;:&quot;0.04&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-0519" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-1024x684.jpg" class="size-large wp-image-2080" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-1024x684.jpg?cbc196&amp;cbc196" alt="" width="1024" height="684" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-1024x684.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519-1536x1025.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-0519.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2080" class="wp-caption-text">Lesser-used tools are stored in a chest next to a closet that houses old projects and SMD components. Photograph above chest by <a
href="https://www.alyssaschukar.com/index">Alyssa Schukar</a>. Watercolor by Gunther Temech.</figcaption></figure><h3>Closet and tool chest</h3><p>I have a modestly-sized tool chest that contains various hand tools, electronic component design kits, and other odds and ends. My closet is the central repository for project storage, SMD components, and all those dev boards, programmers, debuggers, and other odds and ends I&#8217;ve accumulated over time. I just use <a
href="https://www.target.com/p/sterilite-6-qt-clear-view-box-clear-with-latches-purple/-/A-13794493#lnk=sametab">cheap plastic boxes from Target</a> for most of the project storage.</p> <figure
id="attachment_2096" aria-describedby="caption-attachment-2096" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2096" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210130-0273/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;PENTAX K-1&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1612022259&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;15&quot;,&quot;iso&quot;:&quot;100&quot;,&quot;shutter_speed&quot;:&quot;0.1&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210130-0273" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-1024x684.jpg" class="size-large wp-image-2096" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-1024x684.jpg?cbc196&amp;cbc196" alt="" width="1024" height="684" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-1024x684.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273-1536x1025.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210130-0273.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2096" class="wp-caption-text">The second &#8220;mechanical office&#8221; in the basement</figcaption></figure><h3>Mechanical Office</h3><p>I&#8217;m really focused on my main office in this post, but another trick I have up my sleeve is that I actually have a whole second office in my basement that&#8217;s geared toward mechanical work. This is where my 3D printer, CNC mill, and more mechanically-focused tools live. This space is more optimized for larger, long-term projects that don&#8217;t fit in my standard tray system. I have an old crappy soldering station and simple power supply down there, so I can do the bulk of my electronics work upstairs and then just transport the tray downstairs for integration when needed. It&#8217;s not perfect, but it could be worse.</p><h1>The main gear I use</h1><h4>A desktop computer</h4><p>I am absolutely perplexed by the number of laptops I see on people&#8217;s workbenches. For electronics development, desktop PCs are a total no-brainer. I encourage anyone serious about embedded engineering to build or buy a desktop for their office area. A basic $800 desktop computer built around something like a last-generation 65-watt <a
href="https://www.amazon.com/dp/B07SXMZLPK">Ryzen 3700X</a> is about 30% faster than the top-of-the-line mobile CPUs found in the newest, most expensive laptops money can buy((Here, we&#8217;re considering code compilation benchmarks and cinebench scores)), and if you splurge on a high-end desktop or workstation-class processor, your computer will literally be an order of magnitude faster than most laptops available on the market.</p><p>It&#8217;s really just a matter of physics: a thin-and-light 13&#8243; laptop has a ~15W processor, while a heavy-duty 15&#8243; laptop has a ~45W processor. Meanwhile, desktop computers usually <em>start</em> with 65W CPUs, and can go up to 220W for the highest-end parts. Desktops have better long-term reliability, and because they&#8217;re so easy to upgrade and expand, can be useful for 10 years or longer.</p><p>My computer is the most important tool in my office, so I didn&#8217;t skimp — I built a desktop around a <a
href="https://www.amazon.com/dp/B0815JJQQ8">Threadripper 3970X</a> and 64 GB of RAM((I&#8217;ve read that my system can&#8217;t run RAM at maximum speeds if I move up to 128 GB, and I rarely exhaust my capacity)). With this setup, I can recompile a (light-weight) Linux kernel in 30-60 seconds and create an entire Buildroot-based rootfs in 15 minutes, so it&#8217;s been a measurable boost in productivity for my embedded Linux-based projects.</p><h4>Lots of monitor space</h4><p>Designing a PCB usually involves simultaneous access to a device datasheet, reference schematics/web posts, PCB/schematic capture software, and potentially an IDE or sample code. I think four 1080p workspaces is about the minimum I need to be productive; otherwise, I find myself bouncing between windows and tabs way too often.</p><p>My current setup pairs an <a
href="https://www.amazon.com/dp/B08DZSJ4MM">LG 43UN700-TB 43&#8243; 4K monitor</a> with a vertical BenQ 27&#8243; QHD display, along with an old 22&#8243; 1080p display I have on the side. I have an additional 1080p display on my electronics area that is cloned with this display to use as a reference when I&#8217;m assembling boards.</p><p>If you&#8217;re looking for something a bit less intense, two of my favorite setups to start with are either a single large-format 40&#8243; 4K monitor, or two 27&#8243; QHD displays and a smaller 1080p vertical one. Avoid monitors that require high-DPI scaling (basically any 4K monitor smaller than 40&#8243;) or ultrawide displays (which cost way more than just buying two HD or QHD displays).</p><h4>Cartridge-style soldering station</h4><p>I absolutely adore cartridge-style soldering stations, and will never go back to the dark ages. There&#8217;s a lot of gear I can recommend that you <em>don&#8217;t</em> buy, but this is one spot you should treat yourself to some luxury. I have an older JBC compact station, more or less equivalent to the <a
href="https://www.amazon.com/dp/B0923181QS">CD-1SQF Compact Precision</a> model. When I pick up the handle, it immediately comes out of hibernation and heats up to 350C in less than 4 seconds; put it back in the holder and it reduces to 135C. After prolonged inactivity, it will automatically turn off altogether, returning to hibernation. Try to score one off eBay like I did — it was right around $100.</p><h4>Streaming-based logic analyzer</h4><p>I love using my <a
href="https://www.amazon.com/dp/B074TVSLN1">Saleae Logic Pro 16</a> for board bring-up since it works more like a digital/analog DAQ than a traditional logic analyzer. If you&#8217;re working through power sequencing issues on complex boards, you&#8217;re going to run out of channels quickly when using a scope; here&#8217;s where the Saleae shines: you can capture analog voltages from -10 to +10 V on each of its 16 inputs, along with all the usual digital logic analyzer stuff. It&#8217;s fun to wire the probes up to all the voltages, oscillators, and UARTs on your board and watch everything ramp up when you apply power.</p><p></p><p>Saleae also makes an <a
href="https://www.amazon.com/dp/B074TNNGS8">8-channel version</a> which is a few hundred dollars cheaper. I think you&#8217;ll have to look at the projects you&#8217;re working on and your hourly rate to decide which one makes more sense. I&#8217;ll say that my projects tend to leak over into 9-16 channel territory only about 5% of the time, and usually, it&#8217;s more out of convenience than necessity. Also of note: if you&#8217;re a student they offer half-off pricing on all their products.</p><p>The analog capabilities really help offload many of the duties typically relegated to oscilloscopes. I know this is bound to trigger some folks (no pun intended), but if you have a Saleae Logic, I really don&#8217;t think you need a scope for a lot of day-to-day development. I took all these pics of my office before realizing I actually don&#8217;t even have a scope on my bench right now (instead, I&#8217;m in frequency-domain land via a <a
href="https://www.amazon.com/dp/B08C3BTNJM">Siglent SSA 3021X Spectrum Analyzer</a>). You should buy a scope when you start doing a lot of power electronics/motor control, or if you&#8217;re doing very sensitive analog work or PDN diagnostics for EMC issues, but otherwise, you might be surprised how little you use it.</p><p>Speaking of analog capabilities, Saleae gets compared to Analog Discovery a lot, but they&#8217;re totally different tools. The Analog Discovery 2 is a built-down-to-a-price scope/spectrum analyzer/network analyzer/logic analyzer educational tool designed as a low-cost way to get students started thinking about this stuff. Since AD2 is not a streaming analyzer, you have to kind of know what you&#8217;re expecting to see so that you can set up triggers properly, and there&#8217;s an extremely limited buffer.((OK, I think there is some sort of live streaming mode, but it&#8217;s limited to something like 1 MSPS, and it&#8217;s digital-only)) Other than the logic analyzer capabilities, it&#8217;s a pretty crummy scope (30 MHz bandwidth, very limited voltage input range), and the 10 MHz spectrum/network analyzer is for stuff like audio-frequency applications, not RF. That&#8217;s all fine — it&#8217;s an educational tool after all. There are some other bells and whistles with respect to programmable digital I/O and SDK interfacing that might make it useful for a professional to own, but it&#8217;s definitely not a stand-in for other tools.</p><h4>USB Hubs</h4><p>This may seem silly to mention, but it&#8217;s probably my most-used tool. I have two main USB hubs — an Anker 7-port hub for my &#8220;office&#8221; side, and a <a
href="https://www.amazon.com/gp/product/B0797NWDCB">7+3 port hub from Sabrent</a> for my electronics side. Anker hubs are extremely popular, but I&#8217;ve found that the 7+3 port model consistently dies after about a year (I&#8217;ve gone through several of them at home, in the lab, and at work), so I&#8217;d avoid that model.</p><h1>Workflow</h1><p>Next, I&#8217;d like to show how all of this stuff fits into a typical embedded hardware project where you&#8217;re assembling a PCB and bringing it up. I&#8217;ll also share some additional tools and accessories I use in my office.</p><p></p> <figure
id="attachment_2088" aria-describedby="caption-attachment-2088" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2088" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1952/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631227055&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;125&quot;,&quot;shutter_speed&quot;:&quot;0.01&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1952" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-1024x683.jpg" class="size-large wp-image-2088" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1952.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2088" class="wp-caption-text">Inspecting a paste job with my fly-out microscope camera and Billionaire cocktail</figcaption></figure><h3>Paste Stenciling</h3><p>To build up a board, I plant myself squarely in the middle of my electronics bench for most of the process. I love that JLCPCB ships used sacrificial material as a backing board for their full-size stencils; I reuse this material to build jigs to align the solder stencil. I use my inspection camera to look at how ridiculous my solder paste job is before moving to the next step.((I usually convince myself it&#8217;s &#8220;good enough&#8221; and then end up regretting it after cleaning up shorts for the rest of the night.))</p><p>I used to have my inspection microscope directly attached to my workbench&#8217;s 1080p monitor, but changing inputs on it was a hassle, and now that I&#8217;m on video calls all the time I use a capture card to be able to share my work with others. Now, everything goes through OBS so I can get a live feed on my monitor, as well as stream it over Zoom, Slack, or Hangouts using VirtualCam.</p><h4>Tools</h4><ul><li><a
href="https://www.amazon.com/dp/B07ZNR9JCT">Magnetic goose-kneck sewing machine lamps</a>, which stick to the front of my bench and provide controlled lighting.</li><li>An <a
href="https://de.aliexpress.com/item/32965652482.html?spm=a2g0o.productlist.0.0.db015d83lIv2mR&amp;algo_pvid=cd5fd5d8-ce5c-4967-a8ad-13afe8275d2c&amp;algo_exp_id=cd5fd5d8-ce5c-4967-a8ad-13afe8275d2c-13&amp;pdp_ext_f=%7B%22sku_id%22%3A%2267554546596%22%7D">autofocus HDMI-output microscope kit</a> with a 0.5X optic (helps increase working distance).</li><li><a
href="https://www.amazon.com/dp/B089QHR84C">USB HDMI capture dongle</a> allowing me to display, stream, and capture the microscope&#8217;s output on my computer.</li><li>Alcohol. <a
href="https://www.amazon.com/dp/B07NFSFBXQ">Isopropyl</a> for cleaning and <a
href="https://www.plantationrum.com/plantation-stiggins-fancy-pineapple">ethyl</a> for drinking (though you could really go either way on this).</li></ul><figure
id="attachment_2089" aria-describedby="caption-attachment-2089" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2089" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1954/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631227709&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;125&quot;,&quot;shutter_speed&quot;:&quot;0.008&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1954" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-1024x683.jpg" class="size-large wp-image-2089" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1954.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2089" class="wp-caption-text">PCB assembly</figcaption></figure><h3>Placement</h3><p>Next, I place parts on the board. I fly out my inspection camera to check alignment on critical parts, but otherwise, my monitor has my design up so I can reference things as I place parts. I have roughly 50 standard-value passives and discretes on reels that I use all the time; this saves a ton of time since I never have to worry about stock.</p><h4>Tools</h4><ul><li><a
href="http://hottemp.com.my/index.php?route=product/product&amp;product_id=2024">SMD-VAC-HP</a> foot-operated vaccum pen, but just buy a cheap aquarium pump one from Amazon or eBay and hack in a foot pedal.</li><li><a
href="https://www.amazon.com/dp/B00LPC3O3M">Cheap USB mouse</a> to control computer</li><li><a
href="https://www.amazon.com/dp/B073RFKHD6">Silicone mat</a> to work on</li><li><a
href="https://de.aliexpress.com/item/32431076177.html">SMD reel holders</a></li></ul> <figure
id="attachment_2090" aria-describedby="caption-attachment-2090" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2090" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1967/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631228469&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;125&quot;,&quot;shutter_speed&quot;:&quot;0.025&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1967" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-1024x683.jpg" class="size-large wp-image-2090" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-1024x683.jpg?cbc196&amp;cbc196" alt="" width="1024" height="683" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-1024x683.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967-1536x1024.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1967.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2090" class="wp-caption-text">Hot-plate reflow and final inspection with the microscope</figcaption></figure><h3>Reflow</h3><p>Next is the reflow process. I use a hot plate (plus hot-air for double-sided boards) for almost all my hand-assembled boards. If it&#8217;s too complicated to hot-plate, I probably don&#8217;t want to hand-assemble it in the first place. At this point, the component trays go away and the microscope is still flown out. I pull out my hot plate and fume extractor, put the boards on the cold surface, and turn it on until the board reflows. I then set the board on the silicone mat — the insulative abilities reduce the thermal shock on the board. Then there&#8217;s a final visual inspection and clean-up with the soldering iron.</p><h4>Tools</h4><ul><li><a
href="https://www.amazon.com/dp/B01IA3H8QM">Solid-surface cast-iron hot plate</a>. I recommend getting some sacrificial aluminum to set the boards on.</li><li><a
href="https://www.amazon.com/dp/B07Y337XPT">Cheap hot-air station</a>. I like that the heating element and fan are in the handpiece, making the cabling less bulky.</li><li><a
href="https://www.amazon.com/dp/B086QRLKC5">Soldering flux fume extractor</a>. Not totally necessary, but makes visually inspecting your reflowing boards more comfortable.</li></ul> <figure
id="attachment_2101" aria-describedby="caption-attachment-2101" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2101" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1973-2/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2.jpg" data-orig-size="2048,1344" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631228970&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;125&quot;,&quot;shutter_speed&quot;:&quot;0.05&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1973-2" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-300x197.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-1024x672.jpg" class="size-large wp-image-2101" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-1024x672.jpg?cbc196&amp;cbc196" alt="" width="1024" height="672" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-1024x672.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-300x197.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-768x504.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2-1536x1008.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1973-2.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2101" class="wp-caption-text">Board ready for bring-up</figcaption></figure><h3>Bring-Up</h3><p>Once I do a quick visual inspection, I&#8217;ll test the board for shorts and if that looks good, I&#8217;ll use my power supply to slowly bring up the board. If all the rails look good, it&#8217;s time to get the board on a tray and start the firmware work. Most of this is pretty typical: I use debuggers, logic analyzers, and TTL serial adapters — coupled with vendor or third-party IDEs, text editors, and toolchains — to scaffold out firmware and develop the project.</p><p>I want to point out one atypical tool I use quite a bit: my overhead camera. I collaborate a lot with folks, so an overhead camera is really useful to share project progress and record demos. I like having it mounted to a boom arm, allowing me to easily fly it in and out and position things perfectly. The camera I use has 10x zoom and autofocus which helps me keep the camera out of my way while still getting nice, tight shots of projects. Everything is routed through OBS, which allows me to stream, capture, or just view the feed. I also love being able to take quick screen grabs and share with friends or on social media platforms to show people what I&#8217;m working on. I get way better-looking shots than with my smartphone, and it&#8217;s actually faster.</p><h4>Tools</h4><ul><li><a
href="https://www.amazon.com/dp/B01410O424">Siglent SPD3303X-E</a> triple-channel linear power supply. Nice to have, especially for analog work, but I could easily get by with a much-cheaper single-channel DC/DC model.</li><li><a
href="https://www.amazon.com/dp/B00KBZK1QW">Rigol DM3058E multimeter</a>. Cheap for a bench meter and doesn&#8217;t get lost or run out of batteries — plus it has basic data-logging capability and good precision. If I hadn&#8217;t been in such a hurry, I would have snagged something used off eBay, though.</li><li>Overhead HD-SDI camera (basically a no-longer-manufacturered generic version of <a
href="https://www.bhphotovideo.com/c/product/1570586-REG/">this</a>)</li><li>Modified <a
href="https://www.amazon.com/dp/B00DY1F2CS">microphone suspension boom arm</a> to support camera</li><li><a
href="https://www.amazon.com/dp/B01EKGTZ8C">BlackMagic HD-SDI capture card</a> for said camera</li><li><a
href="https://www.gazettenet.com/Art-Maker--Luke-Cavagnac-7572235">Luke Cavagnac</a> acrylic on hardboard painting</li></ul><div
class="mceTemp"> </div><p>&nbsp;</p> <figure
id="attachment_2081" aria-describedby="caption-attachment-2081" style="width: 1024px" class="wp-caption aligncenter"><img
data-attachment-id="2081" data-permalink="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/20210909-1922/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922.jpg" data-orig-size="2048,1389" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;4.5&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;ILCE-7C&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1631221069&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;24&quot;,&quot;iso&quot;:&quot;100&quot;,&quot;shutter_speed&quot;:&quot;0.008&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20210909-1922" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-300x203.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-1024x695.jpg" class="size-large wp-image-2081" src="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-1024x695.jpg?cbc196&amp;cbc196" alt="" width="1024" height="695" srcset="https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-1024x695.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-300x203.jpg 300w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-768x521.jpg 768w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922-1536x1042.jpg 1536w, https://jaycarlson.net/wp-content/uploads/2021/09/20210909-1922.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption
id="caption-attachment-2081" class="wp-caption-text">Even just plugging in a keyboard and turning 90 degrees in my chair enables a minor escape from the usual hum-drum for a moment.</figcaption></figure><h1>Conclusions</h1><p>This setup works great for me, and I hope if you have similar workflows, you can apply some of what I&#8217;ve learned in your own work. Take a step back, look around, and think about the environment around you and how it influences the work you do. Your workspace probably reflects your own natural evolution as an engineer, but there&#8217;s no need to wait and leave it up to random happenstance (like I did for the better part of my career).</p><p>Instead, spend some time and consciously think about your workspace as a problem unto itself to solve; invest in furniture, equipment, and accessories to better align your space with the work you&#8217;re doing and I think you&#8217;ll end up with a place you&#8217;ll love to live and work in.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/">Here&#8217;s how I juggle embedded projects (home office/workspace tour)</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2021/09/18/juggle-embedded-projects-home-office-workspace-tour/feed/</wfw:commentRss> <slash:comments>13</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">1914</post-id> </item> <item><title>What&#8217;s up with these 3-cent microcontrollers?</title><link>https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/</link> <comments>https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Fri, 06 Sep 2019 06:58:20 +0000</pubDate> <category><![CDATA[Embedded]]></category> <guid
isPermaLink="false">https://jaycarlson.net/?p=1546</guid><description><![CDATA[<p>An in-depth look at the Padauk microcontroller ecosystem, including the PMS150C.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/">What&#8217;s up with these 3-cent microcontrollers?</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p><style>.hed,.subhed{color:black;text-align:center}@media (min-width: 768px){.hed{font-size:4vw;line-height:4vw}.subhed{font-size:2vw;line-height:2vw}}@media (max-width: 767px){.page-title-block{padding-top:120px;padding-bottom:400px}.hed{font-size:26px;line-height:30px}.subhed{font-size:20px;line-height:20px}}</style></p><p><em>Full disclosure: Padauk sent over a programmer plus two ICEs for me to use in this review, so long as I covered shipping. In hindsight (after seeing my UPS bill that month!), it would have been a lot cheaper to just buy the dev tools myself, so I can&#8217;t recommend ordering straight from them if you live in the United States, as they exclusively use UPS. I purchased several different Padauk MCUs from LCSC.com, which is not an official Padauk distributor</em>.</p><p>The Padauk microcontrollers — especially the 3-cent PMS150 and newer <a
href="http://www.padauk.com.tw/en/product/show.aspx?num=4">PMS150C</a> — are all the rage these days. I first heard of the part via a <a
href="https://twitter.com/mikelectricstuf/status/1049809911918592002?lang=en">@mikelectricstuf tweet</a>. Dave Jones of the EEVBlog did a brief (for him) <a
href="https://www.youtube.com/watch?v=VYhAGnsnO7w">video</a> looking at the Padauk stuff, and then a pair of videos <a
href="https://www.youtube.com/watch?v=Rixo78hv_lw">using the Padauk ICE</a> and <a
href="https://www.youtube.com/watch?v=r45r4rV5JOI">programming an OTP part</a>. <a
href="http://sdcc.sourceforge.net/index.php#News">SDCC recently got support</a> for the Padauk &#8220;pdk14&#8221; and &#8220;pdk15&#8221; architecture, there&#8217;s a <a
href="https://free-pdk.github.io/">free open-source programmer</a>, and <a
href="https://abnielsen.com/2019/04/24/driving-300-ws2812b-rgb-leds-with-a-3-cent-microcontroller-pms150c">several</a> blog posts (including a <a
href="https://cpldcpu.wordpress.com/2019/08/12/the-terrible-3-cent-mcu/">neat comparison of other low-cost parts</a>) and <a
href="https://www.eevblog.com/forum/blog/eevblog-1144-padauk-programmer-reverse-engineering/">forum threads</a> have hit the Internet.</p><p>The parts, of course, date back much further. Padauk was founded in 2005 (and filed patents in <a
href="https://patents.google.com/patent/US20070067605">2005</a> and <a
href="https://patents.google.com/patent/US20070162663A1/en">2006</a>, describing their Field Programmable Processor Array technology, which we&#8217;ll discuss later). I&#8217;m not sure the English-speaking world became aware until at least 5 years later: <a
href="https://twitter.com/marcan42/status/131869545903296512">Hector Martin noticed</a> the datasheets for the Padauk parts ripping sections out of the Microchip PIC datasheets way back in 2011, and <a
href="https://kyle.machul.is/2011/11/09/everything-you-ever-wanted-to-know-about-mykeepon-except-for-the-parts-i-dont-know-about-yet/">Kyle Machulis did some early investigating</a> into these parts used in the MyKeepon.</p><p>Some of the write-ups have been a little loose on technical details, and few seem to be interested in determining which sorts of applications these parts are suited for — mostly dismissing the parts as novelty items. I wanted to dive a bit deeper into the ecosystem and figure out where you should and shouldn&#8217;t use low-cost parts like these, so I&#8217;ve spent some time in the last few weeks exploring.</p><p>I built a couple cute projects with them — a NeoPixel SPI bridge adapter, as well as a small bike light controller. You can <a
href="https://github.com/jaydcarlson/padauk-experiments/">check out my project code on GitHub</a>.</p><h2>Padauk Ecosystem</h2><p>The Padauk ecosystem comprises:</p><ul><li>Different microcontrollers ranging from 6 to 26 I/O, with 512 to 4096 words of program memory and 64-256 bytes of RAM — all with the same 16 MHz main oscillator.</li><li>A proprietary, extremely light-weight IDE.</li><li>Various versions of programmers — each capable of programming all the Padauk devices.</li><li>Various versions of two ICEs — one for the single-FPPA parts, and one for the multi-FPPA parts.</li></ul><p>Here&#8217;s a big table I built that has all the parts, plus some electrical specifications that might help your selection process: ((The groupings and color codes match the <a
href="http://www.padauk.com.tw//upload/SelectionGuide/selection_guide_2019H1__20190227_EN.pdf">official selection guide PDF</a>. Note that the PMS (commercial) line is also available as PMC (industrial). Though their operating ranges differ, they are otherwise identical. ))</p><div
style="overflow-x: auto;"><style>tr{mso-height-source:auto}col{mso-width-source:auto}br{mso-data-placement:same-cell}.style16{mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.00_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.00\\\)\;_\(\0022$\0022* \0022-\0022??_\)\;_\(\@_\)";mso-style-name:Currency;mso-style-id:4}.style0{mso-number-format:General;text-align:general;vertical-align:bottom;white-space:nowrap;mso-rotate:0;mso-background-source:auto;mso-pattern:auto;color:black;font-size:11.0pt;font-weight:400;font-style:normal;text-decoration:none;font-family:Calibri,sans-serif;mso-font-charset:0;border:none;mso-protection:locked visible;mso-style-name:Normal;mso-style-id:0}td{mso-style-parent:style0;padding-top:1px;padding-right:1px;padding-left:1px;mso-ignore:padding;color:black;font-size:11.0pt;font-weight:400;font-style:normal;text-decoration:none;font-family:Calibri,sans-serif;mso-font-charset:0;mso-number-format:General;text-align:general;vertical-align:bottom;border:none;mso-background-source:auto;mso-pattern:auto;mso-protection:locked visible;white-space:nowrap;mso-rotate:0}.xl65{mso-style-parent:style0;font-weight:700}.xl66{mso-style-parent:style0;text-align:center;vertical-align:middle}.xl67{mso-style-parent:style0;font-weight:700;text-align:center;vertical-align:middle;white-space:normal}.xl68{mso-style-parent:style0;font-weight:700;white-space:normal}.xl69{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#92D050;mso-pattern:black none}.xl70{mso-style-parent:style0;background:#92D050;mso-pattern:black none}.xl71{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#4472C4;mso-pattern:black none}.xl72{mso-style-parent:style0;background:#4472C4;mso-pattern:black none}.xl73{mso-style-parent:style0;font-size:14.0pt;font-weight:700;background:#ED7D31;mso-pattern:black none}.xl74{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#ED7D31;mso-pattern:black none}.xl75{mso-style-parent:style0;background:#ED7D31;mso-pattern:black none}.xl76{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:black none}.xl77{mso-style-parent:style0;background:#FCE4D6;mso-pattern:black none}.xl78{mso-style-parent:style0;font-weight:700;background:#C65911;mso-pattern:black none}.xl79{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#C65911;mso-pattern:black none}.xl80{mso-style-parent:style0;background:#C65911;mso-pattern:black none}.xl81{mso-style-parent:style0;color:windowtext}.xl82{mso-style-parent:style0;color:windowtext;text-align:center;vertical-align:middle}.xl83{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#305496;mso-pattern:black none}.xl84{mso-style-parent:style0;background:#305496;mso-pattern:black none}.xl85{mso-style-parent:style0;background:#D9E1F2;mso-pattern:black none}.xl86{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#D9E1F2;mso-pattern:black none}.xl87{mso-style-parent:style0;background:#E2EFDA;mso-pattern:black none}.xl88{mso-style-parent:style0;text-align:center;vertical-align:middle;background:#E2EFDA;mso-pattern:black none}.xl89{mso-style-parent:style0;font-weight:700;text-align:center;vertical-align:middle;background:#D9E1F2;mso-pattern:black none}.xl90{mso-style-parent:style0;font-weight:700;text-align:center;vertical-align:middle}.xl91{mso-style-parent:style0;font-weight:700;text-align:center;vertical-align:middle;background:#E2EFDA;mso-pattern:black none}.xl92{mso-style-parent:style0;color:windowtext;border-top:.5pt solid #ED7D31;border-right:none;border-bottom:none;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl93{mso-style-parent:style0;color:windowtext;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl94{mso-style-parent:style0;color:windowtext;text-align:center;vertical-align:middle;border-top:.5pt solid #ED7D31;border-right:none;border-bottom:none;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl95{mso-style-parent:style0;color:windowtext;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl96{mso-style-parent:style0;color:windowtext;text-align:center;vertical-align:middle;border-top:none;border-right:none;border-bottom:.5pt solid #ED7D31;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl97{mso-style-parent:style0;color:windowtext;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:black none}.xl98{mso-style-parent:style16;color:windowtext;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";border-top:.5pt solid #ED7D31;border-right:none;border-bottom:none;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl99{mso-style-parent:style16;color:windowtext;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)"}.xl100{mso-style-parent:style16;color:windowtext;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl101{mso-style-parent:style16;color:windowtext;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#FCE4D6;mso-pattern:black none}.xl102{mso-style-parent:style16;font-weight:700;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#C65911;mso-pattern:black none}.xl103{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#FCE4D6;mso-pattern:black none}.xl104{mso-style-parent:style16;font-size:14.0pt;font-weight:700;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#4472C4;mso-pattern:black none}.xl105{mso-style-parent:style16;font-weight:700;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#305496;mso-pattern:black none}.xl106{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#D9E1F2;mso-pattern:black none}.xl107{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)"}.xl108{mso-style-parent:style16;font-size:14.0pt;font-weight:700;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#92D050;mso-pattern:black none}.xl109{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:#E2EFDA;mso-pattern:black none}.xl110{mso-style-parent:style0;color:windowtext;font-weight:700;text-align:center;vertical-align:middle;border-top:none;border-right:none;border-bottom:.5pt solid #ED7D31;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl111{mso-style-parent:style0;color:windowtext;font-weight:700;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl112{mso-style-parent:style0;font-weight:700;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:black none}.xl113{mso-style-parent:style0;color:windowtext;font-weight:700;text-align:center;vertical-align:middle}.xl114{mso-style-parent:style0;color:windowtext;font-weight:700;text-align:center;vertical-align:middle;background:#FCE4D6;mso-pattern:black none}.xl115{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";background:white;mso-pattern:black none}.xl116{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";text-align:center;vertical-align:middle}.xl117{mso-style-parent:style16;mso-number-format:"_\(\0022$\0022* \#\,\#\#0\.0000_\)\;_\(\0022$\0022* \\\(\#\,\#\#0\.0000\\\)\;_\(\0022$\0022* \0022-\0022????_\)\;_\(\@_\)";text-align:center;vertical-align:middle;background:#D9E1F2;mso-pattern:black none}.xl118{mso-style-parent:style0;font-weight:700;background:#D9E1F2;mso-pattern:black none}.xl119{mso-style-parent:style0;color:windowtext;font-weight:700;border-top:none;border-right:none;border-bottom:.5pt solid #ED7D31;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}.xl120{mso-style-parent:style0;color:windowtext;font-weight:700}.xl121{mso-style-parent:style0;font-weight:700;background:#E2EFDA;mso-pattern:black none}.xl122{mso-style-parent:style0;color:white;font-weight:700;background:#305496;mso-pattern:black none}.xl123{mso-style-parent:style0;color:white;font-size:14.0pt;font-weight:700;background:#4472C4;mso-pattern:black none}.xl124{mso-style-parent:style0;color:white;font-weight:700;background:#C65911;mso-pattern:black none}.xl125{mso-style-parent:style0;color:white;font-size:14.0pt;font-weight:700;background:#ED7D31;mso-pattern:black none}.xl126{mso-style-parent:style0;color:white;font-size:14.0pt;font-weight:700;background:#92D050;mso-pattern:black none}.xl127{mso-style-parent:style0;color:windowtext;text-align:center}.xl128{mso-style-parent:style0;color:windowtext;text-align:center;background:#FCE4D6;mso-pattern:black none}.xl129{mso-style-parent:style0;color:windowtext;font-weight:700;text-align:center;vertical-align:middle;border-top:.5pt solid #ED7D31;border-right:none;border-bottom:none;border-left:none;background:#FCE4D6;mso-pattern:#FCE4D6 none}</style><table
style="border-collapse: collapse; table-layout: fixed; width: 1165pt;" border="0" width="1551" cellspacing="0" cellpadding="0"><tbody><tr
style="mso-height-source: userset; height: 40.5pt;"><td
class="xl68" style="height: 40.5pt; width: 99pt;" width="132" height="54"> </td><td
class="xl67" style="width: 46pt;" width="61">LCSC Price @ 100</td><td
class="xl67" style="width: 83pt;" width="111">IO Max</td><td
class="xl67" style="width: 83pt;" width="111">FPPA</td><td
class="xl67" style="width: 58pt;" width="77">ROM (KB)</td><td
class="xl67" style="width: 58pt;" width="77">RAM (B)</td><td
class="xl67" style="width: 58pt;" width="77">ADC</td><td
class="xl67" style="width: 58pt;" width="77">8-bit PWM</td><td
class="xl67" style="width: 58pt;" width="77">11-bit PWM</td><td
class="xl67" style="width: 58pt;" width="77">1/2 VDD LCD</td><td
class="xl67" style="width: 58pt;" width="77">CMP</td><td
class="xl67" style="width: 63pt;" width="84">MULT</td><td
class="xl67" style="width: 63pt;" width="84">IRC</td><td
class="xl67" style="width: 63pt;" width="84">Min Supply</td><td
class="xl67" style="width: 70pt;" width="93">Min Supply @ Max Speed</td><td
class="xl67" style="width: 63pt;" width="84">uA @ 1 MHz 5V</td><td
class="xl67" style="width: 63pt;" width="84">uA @ ILRC 3.3V</td><td
class="xl67" style="width: 63pt;" width="84">nA PD @ 3.3V</td></tr><tr
style="height: 18.75pt;"><td
class="xl125" style="height: 18.75pt;" height="25">SOVA PMS</td><td
class="xl73"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl74"> </td><td
class="xl75"> </td><td
class="xl74"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl124" style="height: 15.0pt;" height="20">IO Range</td><td
class="xl78"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl80"> </td><td
class="xl79"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl92" style="height: 15.0pt;" height="20">PMS15A</td><td
class="xl98"> </td><td
class="xl94">6</td><td
class="xl94">1</td><td
class="xl94">0.5</td><td
class="xl94">64</td><td
class="xl94">&#8211;</td><td
class="xl94">1</td><td
class="xl94">&#8211;</td><td
class="xl94">&#8211;</td><td
class="xl94">&#8211;</td><td
class="xl94">&#8211;</td><td
class="xl94">62</td><td
class="xl94">2</td><td
class="xl94">3</td><td
class="xl129">450</td><td
class="xl94">13</td><td
class="xl94">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl120" style="height: 15.0pt;" height="20">PMS150C</td><td
class="xl99"><span
style="mso-spacerun: yes;"> </span>$ 0.0318</td><td
class="xl82">6</td><td
class="xl82">1</td><td
class="xl82">1</td><td
class="xl82">64</td><td
class="xl82">&#8211;</td><td
class="xl82">1</td><td
class="xl82">&#8211;</td><td
class="xl82">&#8211;</td><td
class="xl82">1</td><td
class="xl82">&#8211;</td><td
class="xl82">62</td><td
class="xl82">2</td><td
class="xl82">3</td><td
class="xl113">450</td><td
class="xl82">13</td><td
class="xl82">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl93" style="height: 15.0pt;" height="20">PMS152</td><td
class="xl100"><span
style="mso-spacerun: yes;"> </span>$ 0.0432</td><td
class="xl95">14</td><td
class="xl95">1</td><td
class="xl95">1.25</td><td
class="xl95">80</td><td
class="xl95">&#8211;</td><td
class="xl95">1</td><td
class="xl95">3</td><td
class="xl95">&#8211;</td><td
class="xl95">1</td><td
class="xl95">&#8211;</td><td
class="xl95">55</td><td
class="xl111">1.8</td><td
class="xl95">3.5</td><td
class="xl95">1000</td><td
class="xl95">15</td><td
class="xl95">600</td></tr><tr
style="height: 15.0pt;"><td
class="xl81" style="height: 15.0pt;" height="20">PMS154B</td><td
class="xl116"><span
style="mso-spacerun: yes;"> </span>&#8211;<span
style="mso-spacerun: yes;"> </span></td><td
class="xl82">14</td><td
class="xl82">1</td><td
class="xl82">2</td><td
class="xl82">128</td><td
class="xl82">&#8211;</td><td
class="xl82">2</td><td
class="xl82">3</td><td
class="xl82">4</td><td
class="xl82">1</td><td
class="xl82">&#8211;</td><td
class="xl82">70</td><td
class="xl82">2.2</td><td
class="xl82">2.2</td><td
class="xl113">450</td><td
class="xl82">12*</td><td
class="xl82">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl119" style="height: 15.0pt;" height="20">PMS154C</td><td
class="xl101"><span
style="mso-spacerun: yes;"> </span>$ 0.0547</td><td
class="xl96">14</td><td
class="xl96">1</td><td
class="xl96">2</td><td
class="xl96">128</td><td
class="xl96">&#8211;</td><td
class="xl96">2</td><td
class="xl96">3</td><td
class="xl96">4</td><td
class="xl96">1</td><td
class="xl96">&#8211;</td><td
class="xl96">70</td><td
class="xl110">1.8</td><td
class="xl110">1.8</td><td
class="xl110">450</td><td
class="xl96">12*</td><td
class="xl96">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl124" style="height: 15.0pt;" height="20">8-bit ADC</td><td
class="xl102"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl80"> </td><td
class="xl79"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl77" style="height: 15.0pt;" height="20">PMS171B</td><td
class="xl103"><span
style="mso-spacerun: yes;"> </span>$ 0.0614</td><td
class="xl76">14</td><td
class="xl76">1</td><td
class="xl76">1.5</td><td
class="xl76">96</td><td
class="xl76">12</td><td
class="xl76">2</td><td
class="xl76"> </td><td
class="xl76"> </td><td
class="xl76">1</td><td
class="xl76"> </td><td
class="xl76">50</td><td
class="xl112">1.8</td><td
class="xl76">3</td><td
class="xl76">700</td><td
class="xl76">36</td><td
class="xl76">600</td></tr><tr
style="height: 15.0pt;"><td
class="xl124" style="height: 15.0pt;" height="20">12-bit ADC</td><td
class="xl102"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl79"> </td><td
class="xl80"> </td><td
class="xl79"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl92" style="height: 15.0pt;" height="20">PMS132B</td><td
class="xl100"><span
style="mso-spacerun: yes;"> </span>$ 0.0738</td><td
class="xl97">14</td><td
class="xl97">1</td><td
class="xl97">2</td><td
class="xl97">128</td><td
class="xl97">12</td><td
class="xl97">2</td><td
class="xl97">3</td><td
class="xl97"> </td><td
class="xl97">1</td><td
class="xl97">1</td><td
class="xl97">55</td><td
class="xl97">2.2</td><td
class="xl97">3.5</td><td
class="xl97">1000</td><td
class="xl97">15</td><td
class="xl97">600</td></tr><tr
style="height: 15.0pt;"><td
class="xl81" style="height: 15.0pt;" height="20">PMS133</td><td
class="xl99"><span
style="mso-spacerun: yes;"> </span>$ 0.0864</td><td
class="xl82">18</td><td
class="xl82">1</td><td
class="xl82">3</td><td
class="xl82">256</td><td
class="xl82">14</td><td
class="xl82">2</td><td
class="xl82">3</td><td
class="xl82">4</td><td
class="xl82">1</td><td
class="xl82">1</td><td
class="xl82">63</td><td
class="xl82">2.2</td><td
class="xl82">3.5</td><td
class="xl82">750</td><td
class="xl127">40</td><td
class="xl113">100</td></tr><tr
style="height: 15.0pt;"><td
class="xl119" style="height: 15.0pt;" height="20">PMS134</td><td
class="xl100"><span
style="mso-spacerun: yes;"> </span>$ 0.1061</td><td
class="xl97">22</td><td
class="xl97">1</td><td
class="xl97">4</td><td
class="xl97">256</td><td
class="xl97">14</td><td
class="xl97">2</td><td
class="xl97">3</td><td
class="xl97">4</td><td
class="xl97">1</td><td
class="xl97">1</td><td
class="xl97">63</td><td
class="xl97">2.2</td><td
class="xl97">3.5</td><td
class="xl97">750</td><td
class="xl128">40</td><td
class="xl114">100</td></tr><tr
style="height: 18.75pt;"><td
class="xl123" style="height: 18.75pt;" height="25">PMS</td><td
class="xl104"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl71"> </td><td
class="xl72"> </td><td
class="xl71"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl122" style="height: 15.0pt;" height="20">IO Range</td><td
class="xl105"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl84"> </td><td
class="xl83"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl85" style="height: 15.0pt;" height="20">PMS150</td><td
class="xl106"> </td><td
class="xl86">6</td><td
class="xl86">1</td><td
class="xl86">1</td><td
class="xl86">60</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">37</td><td
class="xl86">2.2</td><td
class="xl86">2.5</td><td
class="xl86">1000</td><td
class="xl89">6</td><td
class="xl86">500</td></tr><tr
style="height: 15.0pt;"><td
style="height: 15.0pt;" height="20">PMS153</td><td
class="xl107"><span
style="mso-spacerun: yes;"> </span>$ 0.0623</td><td
class="xl66">12</td><td
class="xl66">1</td><td
class="xl66">1</td><td
class="xl66">64</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">35</td><td
class="xl66">2.2</td><td
class="xl66">2.5</td><td
class="xl66">1000</td><td
class="xl66">7</td><td
class="xl66">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl85" style="height: 15.0pt;" height="20">PMS156</td><td
class="xl106"><span
style="mso-spacerun: yes;"> </span>$ 0.0775</td><td
class="xl86">16</td><td
class="xl86">1</td><td
class="xl86">1</td><td
class="xl86">64</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">4</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">37</td><td
class="xl86">2.2</td><td
class="xl86">2.5</td><td
class="xl86">1700</td><td
class="xl86">8</td><td
class="xl86">500</td></tr><tr
style="height: 15.0pt;"><td
class="xl65" style="height: 15.0pt;" height="20">PMC251</td><td
class="xl107"><span
style="mso-spacerun: yes;"> </span>$ 0.0841</td><td
class="xl66">12</td><td
class="xl66">2</td><td
class="xl66">1</td><td
class="xl66">64</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">24</td><td
class="xl66">2.2</td><td
class="xl66">3</td><td
class="xl66">1700</td><td
class="xl66">8</td><td
class="xl66">400</td></tr><tr
style="height: 15.0pt;"><td
class="xl122" style="height: 15.0pt;" height="20">8-bit ADC</td><td
class="xl105"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl84"> </td><td
class="xl83"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl118" style="height: 15.0pt;" height="20">PMS271</td><td
class="xl106"><span
style="mso-spacerun: yes;"> </span>$ 0.0833</td><td
class="xl86">16</td><td
class="xl86">2</td><td
class="xl86">1</td><td
class="xl86">64</td><td
class="xl86">8</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">4</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">24</td><td
class="xl86">2.2</td><td
class="xl86">3</td><td
class="xl86">1700</td><td
class="xl86">8</td><td
class="xl86">400</td></tr><tr
style="height: 15.0pt;"><td
class="xl122" style="height: 15.0pt;" height="20">12-bit ADC</td><td
class="xl105"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl83"> </td><td
class="xl84"> </td><td
class="xl83"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl85" style="height: 15.0pt;" height="20">PMS130</td><td
class="xl117"><span
style="mso-spacerun: yes;"> </span>&#8211;<span
style="mso-spacerun: yes;"> </span></td><td
class="xl86">14</td><td
class="xl86">1</td><td
class="xl86">1.5</td><td
class="xl86">88</td><td
class="xl86">12</td><td
class="xl86">2</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">1</td><td
class="xl86">37</td><td
class="xl86">2.2</td><td
class="xl86">2.5</td><td
class="xl86">1700</td><td
class="xl86">15</td><td
class="xl86">1000</td></tr><tr
style="height: 15.0pt;"><td
style="height: 15.0pt;" height="20">PMS131</td><td
class="xl107"><span
style="mso-spacerun: yes;"> </span>$ 0.0818</td><td
class="xl66">14</td><td
class="xl66">1</td><td
class="xl66">1.5</td><td
class="xl66">160</td><td
class="xl66">12</td><td
class="xl66">2</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">1</td><td
class="xl66">37</td><td
class="xl66">2.2</td><td
class="xl66">2.5</td><td
class="xl66">1700</td><td
class="xl66">15</td><td
class="xl66">1000</td></tr><tr
style="height: 15.0pt;"><td
class="xl85" style="height: 15.0pt;" height="20">PMS232</td><td
class="xl106"><span
style="mso-spacerun: yes;"> </span>$ 0.1621</td><td
class="xl86">18</td><td
class="xl86">2</td><td
class="xl86">2</td><td
class="xl86">88</td><td
class="xl86">10</td><td
class="xl86">1</td><td
class="xl86">&#8211;</td><td
class="xl86">4</td><td
class="xl86">&#8211;</td><td
class="xl86">&#8211;</td><td
class="xl86">24</td><td
class="xl86">2.2</td><td
class="xl86">3</td><td
class="xl86">1700</td><td
class="xl86">15</td><td
class="xl86">500</td></tr><tr
style="height: 15.0pt;"><td
style="height: 15.0pt;" height="20">PMS234</td><td
class="xl115"><span
style="mso-spacerun: yes;"> </span>$ 0.2000</td><td
class="xl66">26</td><td
class="xl66">2</td><td
class="xl66">4</td><td
class="xl66">208</td><td
class="xl66">11</td><td
class="xl66">1</td><td
class="xl66">&#8211;</td><td
class="xl66">4</td><td
class="xl66">1</td><td
class="xl66">&#8211;</td><td
class="xl66">24</td><td
class="xl66">2.2</td><td
class="xl66">4</td><td
class="xl66">1700</td><td
class="xl66">15</td><td
class="xl66">500</td></tr><tr
style="height: 18.75pt;"><td
class="xl126" style="height: 18.75pt;" height="25">MTP</td><td
class="xl108"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl70"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl69"> </td><td
class="xl70"> </td><td
class="xl69"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl87" style="height: 15.0pt;" height="20">PFS154</td><td
class="xl109"><span
style="mso-spacerun: yes;"> </span>$ 0.0659</td><td
class="xl88">14</td><td
class="xl88">1</td><td
class="xl88">2</td><td
class="xl88">128</td><td
class="xl88"> </td><td
class="xl88">2</td><td
class="xl88">3</td><td
class="xl88">4</td><td
class="xl88">1</td><td
class="xl88">&#8211;</td><td
class="xl88">70</td><td
class="xl88">2</td><td
class="xl88">3.5</td><td
class="xl88">550</td><td
class="xl88">12*</td><td
class="xl91">100</td></tr><tr
style="height: 15.0pt;"><td
style="height: 15.0pt;" height="20">PFS172</td><td
class="xl116"><span
style="mso-spacerun: yes;"> </span>$ 0.0818</td><td
class="xl66">14</td><td
class="xl66">1</td><td
class="xl66">2</td><td
class="xl66">128</td><td
class="xl66">12</td><td
class="xl66">2</td><td
class="xl66">&#8211;</td><td
class="xl66">&#8211;</td><td
class="xl66">1</td><td
class="xl66">&#8211;</td><td
class="xl66">56</td><td
class="xl90">1.8</td><td
class="xl66">3</td><td
class="xl66">600</td><td
class="xl66">76</td><td
class="xl66"> </td></tr><tr
style="height: 15.0pt;"><td
class="xl121" style="height: 15.0pt;" height="20">PFS173</td><td
class="xl109"><span
style="mso-spacerun: yes;"> </span>$ 0.0818</td><td
class="xl88">18</td><td
class="xl88">1</td><td
class="xl88">3</td><td
class="xl88">256</td><td
class="xl88">14</td><td
class="xl88">2</td><td
class="xl88">3</td><td
class="xl88">5</td><td
class="xl88">1</td><td
class="xl88">&#8211;</td><td
class="xl88">93</td><td
class="xl88">2.2</td><td
class="xl88">3.5</td><td
class="xl88">750</td><td
class="xl88">87</td><td
class="xl91">100</td></tr></tbody></table></div><p><em>Parts in bold-face are parts I evaluated during this review. Specifications in bold-face are best-in-class.</em></p><p>There are a few interesting take-aways:</p><p><strong>No comms peripherals. </strong>The Padauk microcontrollers have an interrupt controller, at least one timer, sometimes an ADC, comparator, and/or PWM controller, and&#8230; well, that&#8217;s it. One of the first things I noticed about these parts is all UART, I2C, and SPI communication you&#8217;ll need for a project has to be implemented in software.</p><p><strong>Multiple &#8220;processing-unit&#8221; design. </strong>Higher-end Padauk parts — like the PMS2xx, PMC2xx, and PGC2x — have two &#8220;processing units&#8221; in their &#8220;FPPA&#8221; while the unreleased PGC4xx will be a 4-FPPA design. I put &#8220;processing units&#8221; in quotes for reasons explained later. It looks like they have had legacy 8-core designs (like the <a
href="http://www.padauk.com.tw/en/product/show.aspx?num=78&amp;kind=84">MCS11</a>) that are no longer carried by distributors.</p><p><strong>Flash and OTP options. </strong>Most modern western-designed MCUs use flash memory for program storage. This is convenient for us developers, but it&#8217;s kind of silly when you consider that most embedded devices have no mechanism for firmware updates. Flash memory is expensive and finicky to implement at a process level. Typical low-voltage-programmed flash memory is less immune to damage than the high-voltage OTP-programmed memory (which, itself, is less immune when compared to true mask ROM).</p><p><strong>Middling low-power capabilities.</strong> Any low-cost 8-bit MCU in 2019 needs to target ultra-low-current battery-powered applications (where other parts can&#8217;t compete), but the Padauk series as a whole doesn&#8217;t fare well compared to other vendors. Across their entire line, 1 MHz run-mode current consumption varies from 450 &#8211; 1700 µA when operating at 5V. Note, however, that the newer parts are actually quite good — the PMS150C uses about 300 µA at 3.3V, which is similar to the exceptionally low-power <a
href="https://www.silabs.com/documents/public/data-sheets/efm8sb1-datasheet.pdf">EFM8SB1</a> that uses about 270 µA when running at the same speed. Sleep current is below 1 µA with the oscillators stopped, which should be good enough for most battery-operated applications.</p><p><strong>Poor battery support</strong>. Not only is the current consumption rather high on older parts, but the minimum supply voltage is, too. All microcontrollers should be 1.8V-friendly, but most Padauk MCUs bottom out at 2.2V — only the newer PMS152, PMS154C, and PMS171B are rated for 1.8V operation, and only the PMS154C can run full-speed at 1.8V. Most parts need at least 2.5V for full-speed operation, while some — like the two-FPPA PMS parts, 12-bit PMS parts, and the MTP flash-programmable parts — need 3.5 or even 4V. This means many Padauk-powered gadgets will die long before their batteries do.</p><p><strong>Flexible pin-count.</strong> Many Padauk parts are simultaneously available in 8-pin, 16-pin, and sometimes 18-20 pin packages. While high-pin-count ARM MCUs are often available in ~80-ball CSPs and much, much larger 100- or 144-pin LQFPs, I haven&#8217;t seen many other 8-bit MCUs offered in package sizes with such stark differences in pin count.</p><p><strong>Inflexible packages</strong>. While most Padauk datasheets advertise SOT, SOP, QFN, and sometimes MSOP, I wasn&#8217;t able to find packages other than SOP and SOT available from Padauk distributors (official and unofficial), so I think the QFN and MSOP packages are only available on request. It&#8217;d be nice to have widely-available 15-20 I/O chips in a 3&#215;3 or 4&#215;4 QFN. 16-pin SOIC packages are massive, so they rarely make it into my designs.</p><h2>Architecture</h2><p>All Padauk MCUs have what appears to be an identical architecture. They use an accumulator-based machine where all instructions — other than jumps, <em>call</em>, <em>ret</em>, and <em>ldtab </em>— are executed in a single cycle. The instruction set is somewhere between a mid-range and enhanced mid-range <a
href="/pf/microchip-pic16-five-digit-enhanced/">Microchip PIC16</a> — it supports indirect loads and stores from an arbitrary memory location, but not with a literal offset or automatic incrementing. Translation for programmers: you can use pointers to dereference memory, but your pointer arithmetic has to be done to the pointer&#8217;s memory location first, and using separate instructions that will incur cost. For example, to walk through an array, it will take at a minimum three cycles — two to dereference the pointer, and one to increment the pointer&#8217;s value.</p><p>Like the PIC16, there&#8217;s just a single interrupt vector. Interrupts are automatically disabled before the ISR executes, and re-enabled afterwards. Unlike the PIC16, the stack is located in main RAM, so you don&#8217;t have to worry about deep call stacks. The Padauk parts use a 2T architecture where the PIC16 uses a 4T — that means a Padauk part running at 16 MHz (the maximum frequency) will execute a maximum of 8 MIPS (125 ns instruction cycle), which is equivalent to a PIC16 running at 32 MHz.</p><p>The instruction set is optimized for traditional low-end 8-bit fare: there are dedicated instructions to set, clear, and compare individual bits in both peripheral and memory locations give you rock-steady timing performance (and efficient ROM usage) when writing bit-bang code. There&#8217;s also dedicated instructions to load and store the 16-bit timer value in a RAM location in a single cycle — neat!</p><h2>Peripherals</h2><p>There&#8217;s only a few peripherals to select from:</p><ul><li>Clock system with 16-MHz and ~70 kHz internal oscillators</li><li>16-bit timer</li><li>Watchdog timer</li><li>One or two 8-bit timers*</li><li>11-bit PWM generator*</li><li>VDD/2 LCD bias generator*</li><li>Analog comparator*</li><li>8 or 12-bit ADC*</li></ul><p><em>* available on some models</em>.</p><h3>GPIO</h3><p>GPIO pins are the meat and potatoes of any MCU, and because these Padauk parts have so peripherals, you&#8217;ll be using GPIO pins even more than usual.</p><p>GPIO input pins have selectable pull-up resistor (nominally 100k at 5V). GPIO input pins have a 2V threshold voltage when running at 5V (and 1.5V when running at 3.3V).((The cheapest logic-level converter I could find is <a
href="https://lcsc.com/product-detail/Interface-ICs_DIODES_74LVC1T45W6-7_74LVC1T45W6-7_C168856.html">$0.05 each in volume</a>, so yes, it&#8217;s cheaper to program a Padauk PMS150C to be a logic-level converter than to just buy a logic level converter)). Leakage current isn&#8217;t specified in the datasheet, but from my observations, it&#8217;s extremely low — low enough not to affect power consumption in sleep mode in a meaningful way.</p><p>In general, GPIO output pins can be configured globally for normal or low drive strength. Normal drive will source 12 mA at 5V and 5 mA at 3V. Low drive will source 3.5 mA at 5V and about 1.5 mA at 3V. Sinking current is 15 mA at 5V and 5 mA at 3V for normal drive strength, and 5 mA at 5V and 2 mA at 3V for low drive strength. Each MCU appears to have a single open-drain pin (PA5 — reset) which can sink almost twice as much current as the other GPIO pins (but obviously can&#8217;t drive the pin).</p><p>By default, a change-in-value on any GPIO pin will wake up a sleeping Padauk part, but you can disable wake-up on specific pins if you&#8217;d like.</p><h3>Clock System</h3><p>All Padauk MCUs have a clocking system that supports an external crystal, along with a 16-MHz high-speed internal oscillator and a low-speed internal oscillator. Depending on the part, the nominal value of this oscillator ranges from 24 &#8211; 93 kHz. For example, the PMS150C has an IRC frequency of 62 kHz, while the PMS271&#8217;s is 24 kHz, and the PFS173 is 93 kHz. ((I can&#8217;t, for the life of me, figure out why the IRC frequencies vary chip to chip. There seems to be no rhyme or reason to intentionally do this; I wonder if the designers simply threw in whatever they could fit in the remaining area, spun some samples, and figured out what they had come up with. I know oscillator design can get finicky, so that&#8217;s the only explanation I could come up with.)) Padauk seems to be a bit inconsistent with this nomenclature; you can set SYSCLK to a maximum frequency of IHRC/2 (8 MHz). Or, you can set SYSCLK to ILRC — but when you set it to ILRC, it doesn&#8217;t run at 63 kHz, as indicated in the datasheet, but rather half that (31.5 kHz). I assume some datasheet ILRC ratings are for the actual ILRC oscillator, and some datasheets rate them for the effective speed the system runs at when sourced from one of these oscillators (which is half).</p><p>These oscillators are designed to be extremely low-power and low-cost; Padauk provides no specification for the performance of the oscillators prior to calibration, but I wouldn&#8217;t be surprised if it were 10-15% error, or worse. However, once calibrated, the oscillators are good to 1% under constant voltage and temperature (which makes sense if you know anything about RC circuits).</p><p>Padauk has an ingenious solution to this problem: their in-circuit programmer will actually measure and calibrate each MCU during the programming process. You just have to insert a macro in your code to trigger this process — something like this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">.ADJUST_IC SYSCLK=IHRC/2, IHRC=16MHz, VDD=3.3V, Bandgap=On; </pre><p>&nbsp;</p><p>&nbsp;</p><h3>16-bit Timer</h3><p>The 16-bit timer is a simple up-counting, non-reloadable counter. Its clock source selection is independent of the CPU clock, and can also count from one of two GPIO pins. It has a divide-by-1, 4, 16, or 64 prescalar, and an overflow interrupt. The timer&#8217;s value can be read and written to from software, and&#8230; that&#8217;s it.</p><h3>Watchdog Timer</h3><p>All Padauk parts have a watchdog timer clocked from the internal low-frequency oscillator.</p><h3>8-bit Timer</h3><p>Many (but not all) Padauk parts also have one or two 8-bit timers that have an auto-reload (period) output-compare mode as well as 8- or 6-bit PWM. The 8-bit timer has the same prescalar and input settings as the 16-bit timer, but can also take an input from the optional analog comparator (useful for counting threshold-exceeded events), as well as from a few GPIO input complements (letting you count rising- or falling-edge events). The timer also has a divide-by-1 to 31 integer scalar to give you a bit more control over the period.</p><p>You&#8217;ll want as much prescalar control as you can get, since, when the timer is in PWM mode, you&#8217;ll have a fixed period of 256 (0 to 255) — preventing fine-grained control over frequency. Luckily, this isn&#8217;t usually an issue with PWM applications. There&#8217;s an interesting Code Option bit that you can flick on to disable the PWM output whenever the comparator output goes high (useful for, say, current-limiting H-bridge motor drivers).</p><h3>11-bit PWM</h3><p>Some Padauk parts feature a 3-channel 11-bit &#8220;SuLED&#8221; PWM generator designed specifically for RGB LED control. Padauk introduces this feature on the 4-cent PMS152. The 8-pin version of this chip has just enough pins to implement an SPI daisy-chained RGB LED controller, so I wouldn&#8217;t be surprised if we saw applications like that. This peripheral also has selectable complementary outputs, a /2 to /128 prescalar, and an adjustable period register, too (if you don&#8217;t need all 11 bits of resolution).</p><h3>ADC</h3><p>There are 8- or 12-bit ADCs available on several Padauk parts. The input mux seems wide enough to allow all — or almost all — pins to function as analog inputs, though I didn&#8217;t check every chip and package.</p><p>You can choose from an external pin or internal VDD reference, and there&#8217;s also a 1.2V band-gap you can measure, but you can only use the bandgap as a reference on 12-bit ADC parts. These higher-end parts also have a 1/4 VDD measurement input which — when coupled with the 1.2V bandgap — makes measuring battery life a breeze (why don&#8217;t more microcontrollers have this feature?).</p><h3>Multiplier</h3><p>Some Padauk parts have a hardware multiplier. It&#8217;s kind of weird — it&#8217;s both an instruction set extension, but also a memory-mapped peripheral that must be loaded with data. You load the values you want into it, perform the <em>mul</em> instruction, and get the values out. The compiler has no idea how to use it, so this is all done by you, manually. It&#8217;s extremely goofy.</p><h3>Sleep</h3><p>The Padauk parts have two low-power instructions — <em>stopexe </em>(wait-for-interrupt, basically) and <em>stopsys </em>(clock-power-down sleep). I love how simple it is to do low-power on these parts; every GPIO input pin is, by default, a wake source, so anytime you&#8217;re in a busy loop waiting for something, you can just throw a stopsys instruction in there and you&#8217;ll get instant power-savings. Wake-up time is configurable as 32 or 2048 ticks of the oscillator, so as fast as 2 µs. It&#8217;s not clear to me why you&#8217;d ever configure the system for slow wake-up, as there doesn&#8217;t seem to be any advantages, but it&#8217;s an option, too.</p><h2>FPPA — A Multi-Core Microcontroller?</h2><p>Some of the Padauk parts feature what they call an FPPA — <em>Field Programmable Processor Array</em>. Without ever looking into the details, people incorrectly tout this as a multi-core microcontroller. It&#8217;s obviously a cute play on &#8220;FPGA&#8221; — but it&#8217;s also a complete misnomer, as it is neither field-programmable, nor a processor array. You see, not even the flash-based Padauk parts support the self-programming functionality needed for in-field firmware updates, and even more confusingly, this thing doesn&#8217;t actually have more than one processor. Instead, this part has what I would call a <em>multi-context </em>processor design.</p><h3>Multi-what?</h3><p>While an MCU&#8217;s CPU has access to ROM, RAM, and peripherals, it does its work using internal registers. For the Padauk part, these registers store which program memory location the CPU is executing (<em>Program Counter</em>), a pointer to the current stack value (<em>Stack Pointer</em>), the source and destination of arithmetic operations (<em>Accumulator</em>), and the state of the CPU&#8217;s operations (<em>Flag Register</em>).((This architecture is sometimes called an <em>accumulator-based machine</em>, and it contrasts with architectures that have many working registers.))</p><p>A CPU&#8217;s <em>context</em> is simply the current state of all these registers. While this may seem strange to believe, if we copied the context of a CPU at one instant in time, and dumped it back into the CPU later on, the CPU would appear to pick up right where it left off — since it would start executing the same program memory instruction, with the same stack pointer, and the same data in the accumulator. So if we want to preserve the <em>context</em> of an execution cycle, we just need to save these registers.((Incidentally, this is what happens when interrupts execute — the context is saved, the CPU executes the ISR, and then the context is restored.))</p><p>Going back to the Padauk&#8217;s FPPA feature, each FPP is just a bag of CPU registers — program counter, stack pointer, accumulator, and CPU flag register — that represent the context of the CPU. The CPU takes turns executing each context for one clock cycle before switching to the next.</p><h3>Why would we want to have multiple CPU contexts?</h3><p>We usually only think about saving and restoring a CPU&#8217;s context when we&#8217;re dealing with interrupts, or if we want to run a multi-tasking system that allows us to run multiple functions &#8220;simultaneously.&#8221; ((of course, we can&#8217;t actually run multiple instructions concurrently, because we only have one CPU. However, if we constantly switch between the CPU contexts for two different tasks, it will appear as though they are executing simultaneously.)) Having multiple FPPs lets you switch context quickly — the FPPA feature is basically like a hardware-based time-slicing RTOS.</p><div
class="wp-block-image"> <figure
class="aligncenter"><img
data-attachment-id="1551" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/image-1-2/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/08/image-1.png" data-orig-size="1037,658" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-1" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/08/image-1-300x190.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/08/image-1-1024x650.png" class="wp-image-1551" src="https://jaycarlson.net/wp-content/uploads/2019/08/image-1-1024x650.png?cbc196&amp;cbc196" alt="" srcset="https://jaycarlson.net/wp-content/uploads/2019/08/image-1-1024x650.png 1024w, https://jaycarlson.net/wp-content/uploads/2019/08/image-1-300x190.png 300w, https://jaycarlson.net/wp-content/uploads/2019/08/image-1-768x487.png 768w, https://jaycarlson.net/wp-content/uploads/2019/08/image-1.png 1037w" sizes="(max-width: 1024px) 100vw, 1024px" /> <figcaption>Some Padauk parts have multiple FPPs, which enables quick context-switching between different tasks</figcaption> </figure></div><p><strong>Let that sink in for a moment, and consider the ramifications:</strong> An 8-cent part like the PMS271 lets you build a preemptive multitasking system with a 4 MHz context-switching speed. If that doesn&#8217;t sound impressive, consider that most RTOS projects found in the wild are running on 100 MHz ARM Cortex MCUs and don&#8217;t have a context-switching (tick) speed much faster than 1 kHz.</p><h3>Ok, but why would you need or want this capability?</h3><p>Let&#8217;s back up. Recall that none of the Padauk parts have communication peripherals, so if you need SPI, I2C, UART, 1-Wire, or any other communication interface, you&#8217;ll have to do it in software. This has some definite advantages: comms peripherals take up valuable silicon and often go unused. It&#8217;s hard for IC vendors to figure out what to stuff in MCUs — will customers need an SPI master? Two UARTs? I2C slave support? A separate I2C master and I2C slave? By moving everything to software, you can implement just the comms peripherals you need for your application, without having extra junk laying around.</p><p>This raises a problem, though: bit-banging a communication interface is tedious and imprecise. Sure, it&#8217;s easy if that&#8217;s the only thing your part is doing — but if it&#8217;s managing a PID control loop or calculating HSL values to PWM to an RGB LED, it&#8217;s going to be hard to get the timing correct for any communication you may need.</p><p>This is where the Padauk FPPA comes in handy: you can dedicate an FPP core to, say, a UART transceiver, and it can process incoming UART data and transmit responses back without having to worry about anything else.</p><h3>Specialized Instructions</h3><p>While this is certainly better than doing everything on a single core, anyone who has written software-based bit-banged peripherals before knows that getting accurate timing is a headache. Think about the number of instructions it takes to test a bit and jump out of a while() loop once the bit gets set or cleared. Or think about the tediousness of trying to write cycle-accurate delay() loops.</p><p>Padauk has a solution. These are the only MCUs I&#8217;ve seen that, at a hardware level, support <em>wait </em>and <em>delay </em>CPU instructions. You can delay for up to 256 cycles with a single instruction, and you can also delay until a bit is set (<em>wait1</em>) or cleared (<em>wait0</em>). These instructions remove the latency, unpredictability, and code size bloat you&#8217;d encounter when doing conditional loops.</p><p>This makes implementing cycle-accurate communication interfaces a cinch.((Note that the neither of these instructions are available on single-FPP devices, and the delay instruction is only available on some of the multi-FPP ones)).</p><div
class="wp-block-image"> <figure
class="aligncenter"><img
data-attachment-id="1564" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/image-1-3/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-1.png" data-orig-size="462,432" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-1" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-1-300x281.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-1.png" class="wp-image-1564" src="https://jaycarlson.net/wp-content/uploads/2019/09/image-1.png?cbc196&amp;cbc196" alt="" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/image-1.png 462w, https://jaycarlson.net/wp-content/uploads/2019/09/image-1-300x281.png 300w" sizes="(max-width: 462px) 100vw, 462px" /> <figcaption>The Padauk IDE has a &#8220;Code Generate&#8221; button that launches this lightweight code generator.</figcaption> </figure></div><div
class="wp-block-image"> <figure
class="aligncenter"><img
data-attachment-id="1563" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/image-4/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/image.png" data-orig-size="462,192" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-300x125.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/image.png" class="wp-image-1563" src="https://jaycarlson.net/wp-content/uploads/2019/09/image.png?cbc196&amp;cbc196" alt="" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/image.png 462w, https://jaycarlson.net/wp-content/uploads/2019/09/image-300x125.png 300w" sizes="(max-width: 462px) 100vw, 462px" /> <figcaption>I tested several generated code blocks, like this SPI code, and all worked flawlessly — though you&#8217;ll have to modify the resulting code.</figcaption> </figure></div><p>To sweeten the deal even more, Padauk has a code-gen tool built into their IDE that does all the work for you — just tell it you want a UART receiver operating at 9600 baud, or an I2C slave device, and it will generate the code for you.</p><p>In many ways, the FPPA approach is actually <em>better</em> than having dedicated hardware peripherals: you can implement the number and type of peripherals you actually need, there&#8217;s no unused comms peripherals laying around, and because the peripherals are implemented in software, you can implement arbitrary protocols, or do goofy things that wouldn&#8217;t otherwise be easy.</p><p>I saw <a
href="https://abnielsen.com/2019/04/24/driving-300-ws2812b-rgb-leds-with-a-3-cent-microcontroller-pms150c/">Anders Nielsen&#8217;s blog post</a> about driving the WS2812B with a Padauk PMS150C, and was inspired to write a little SPI-to-WS2812B converter using one of these 2-FPP parts — specifically the PMS271. This will make WS2812B LED strips behave like APA102C strips.</p><h2>Development on the Padauk</h2><h3>In-Circuit Emulator (ICE)</h3><div
class="wp-block-image"> <figure
class="alignright is-resized"><img
data-attachment-id="1595" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/20190903-9768/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768.jpg" data-orig-size="2048,1475" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20190903-9768" data-image-description="&lt;p&gt;Padauk PDK3S-I-003 Multi-FPPA in-circuit emulator (ICE)&lt;/p&gt;
" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-300x216.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-1024x738.jpg" class="wp-image-1595" src="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-1024x738.jpg?cbc196&amp;cbc196" alt="" width="400" height="289" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-1024x738.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-300x216.jpg 300w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768-768x553.jpg 768w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9768.jpg 2048w" sizes="(max-width: 400px) 100vw, 400px" /> <figcaption>Padauk PDK3S-I-003 Multi-FPPA in-circuit emulator (ICE)</figcaption> </figure></div><p>Many people scoffed at the one-time programmability of the Padauk parts (<a
href="https://twitter.com/jaydcarlson/status/1161469403508236289">even me</a>), but after using the entire ecosystem for a few days, I totally get it — and I&#8217;m starting to wonder why you don&#8217;t see more In-Circuit Emulator (ICE) tools anymore, because it makes perfect sense for stuff like this.</p><p>For the uninitiated, an ICE is essentially a special-built system that pretends to be your target microcontroller — running code full-speed, with all peripherals available — but also has all the debug circuitry and communication channels necessary to communicate with your host computer.</p><p>You wire the ICE into your product where the microcontroller would go. With the large SOIC packages common with Padauk parts, I could imagine soldering breadboard wires to the SOIC pads of my product PCB, and connecting the wires straight into the ICE.</p><p>I&#8217;m using the plural form because Padauk has <a
href="http://www.padauk.com.tw/en/technical/index.aspx?kind=26">different ICEs for different microcontrollers</a>. I tested out both the 3S-I-003 (for multi-FPPA parts), and the 5S-I-S02B (for single-FPPA parts).</p><p>The 3S-I-003 is large, with lots of unnecessary LED indicators, and requires a separate 9V wall-wart in addition to the USB connection. It looks like it can simulate parts with up to 5 full GPIO ports (40 I/O total). They have a push-button permanently wired to PA0, and a transistor-controlled LED attached to PA1.</p><div
class="wp-block-image"> <figure
class="alignright is-resized"><img
data-attachment-id="1603" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/20190903-9765-2/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9765-1.jpg" data-orig-size="2048,1371" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20190903-9765" data-image-description="&lt;p&gt;The new 5S-I-S02B is a small ICE designed for single-core Padauk devices. &lt;/p&gt;
" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9765-1-300x201.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9765-1-1024x686.jpg" class="wp-image-1603" src="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9765-1-1024x686.jpg?cbc196&amp;cbc196" alt="" width="400" height="270" /> <figcaption>The new 5S-I-S02B is a small ICE designed for single-core Padauk devices.</figcaption> </figure></div><p>The single-FPPA 5S-I-S02B ICE is much smaller than the multi-FPPA one, and seems to run fine without a 9V power connection. Both ICEs have removable HC49-packaged crystals and nicely-labeled I/O.</p><p>Once I started using the ICEs, I realized they didn&#8217;t feel much different than using a traditional microcontroller dev board. The Padauk ICEs have high-speed USB interfaces; once connected, they load the program into RAM inside the emulator IC, which keeps download times quick.</p><p>And this is when I really started wondering why other low-pin-count vendors don&#8217;t provide an ICE. If you&#8217;re developing an application with a part that only has a few I/O pins, why would you want to spare even a single one for debugging? Let alone the three or four that many architectures require?</p><p>All the sudden, the OTP nature of the Padauk parts became a bit of a non-issue. You sit in front of your computer, ICE in hand, and work through your project. You code, build, test, code, build, test, code build test&#8230;. and once you get things where you want them, you pull up the programmer, program your OTP part, solder it to your real board, and see your hard work pay off.</p><p>There <em>are</em> a few gotchas when using Padauk ICEs — they don&#8217;t perfectly emulate each MCU correctly, so be sure to read the MCU datasheet for notes about using the ICE. One issue I noticed that <em>wasn&#8217;t</em> mentioned in the datasheet is the ICE doesn&#8217;t appear to emulate the various ILRC frequencies of the Padauk parts — from the table above, these vary from 24 to 93 kHz. For my &#8220;bike light&#8221; test project, I had all my delays dialed in nicely for my emulator, but when I programmed a PFS173 with the firmware, it was strobing much more quickly. But when I programmed a PMS150C, it behaved identically to the ICE, so I suspect the ICE&#8217;s ILRC frequency is around 62 kHz. Another issue with using an ICE is that there&#8217;s no way to get power consumption figures. For more complex projects, you may want to use one of the Padauk flash parts, or buy an SOIC ZIF socket to allow you to iterate your code using the actual MCU.</p><p>I will say that — like everything else about this ecosystem — everything is optimized for low-cost, high-volume products that have very simple firmware. I could imagine the flash parts would be useful in more complex projects, where you may want to do quite a bit of testing and firmware development in-situ — here, flash memory is a nice thing to have. Just remember that you&#8217;ll be giving up PA3, PA5, and PA6 if you want to be able to do in-circuit flash programming of the MTP parts.</p><div
class="wp-block-image"> <figure
class="aligncenter is-resized"><img
data-attachment-id="1597" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/20190903-9770/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770.jpg" data-orig-size="2048,1336" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20190903-9770" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-300x196.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-1024x668.jpg" class="wp-image-1597" src="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-1024x668.jpg?cbc196&amp;cbc196" alt="" width="512" height="334" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-1024x668.jpg 1024w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-300x196.jpg 300w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770-768x501.jpg 768w, https://jaycarlson.net/wp-content/uploads/2019/09/20190903-9770.jpg 2048w" sizes="(max-width: 512px) 100vw, 512px" /> <figcaption>The Padauk programmer can run attached to a computer or stand-alone.</figcaption> </figure></div><h3>Padauk 5S-P-003 Programmer</h3><p>This Padauk programmer feels like a typical production programmer you&#8217;d see at a manufacturer. It&#8217;s got a programming socket, a big &#8220;PROGRAM&#8221; button on it, and a 16&#215;2 character LCD that keeps track of good / no-good count as you program them. You can use the programmer while attached to your computer, controlled with a GUI tool, or you can disconnect it and use the programmer in a stand-alone mode. I found programming speeds to be incredibly fast — less than a second.</p><h3>Mini C Compiler</h3><p>Before I actually pulled the trigger on my Padauk order, the scariest part about the ecosystem was the compiler. I <a
href="https://jaycarlson.net/microcontrollers/#compilers">definitely had some fun</a> with compilers while working on the the $1 Microcontrollers series, so when I noticed that Padauk&#8217;s &#8220;Mini C&#8221; compiler didn&#8217;t support function arguments, return values, for() loops, and many other common C expressions, I became really nervous.</p><p>But here&#8217;s the thing: when you&#8217;re working on a part with no peripherals, 1K of program memory, and 64 bytes of RAM, you&#8217;re probably not going to the moon (that would require <a
href="https://www.youtube.com/watch?v=2KSahAoOLdU">70K of program memory and 2K of RAM</a>). And here&#8217;s a thought: would you really even <em>want </em>those features? Wouldn&#8217;t you prefer an IDE that lets you get to be a bit more specific with what you want the MCU to be doing?</p><p>I discovered this while working on my SPI-to-WS2812 converter. When I first need a for() loop, I wrote:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">int i = 7; 
while(i &gt;= 0) {
   ...
   i--;
}</pre><p>This works, but it&#8217;s not nearly as cycle-efficient as using one of Padauk&#8217;s handy macros:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">.FOR i, &lt;7,6,5,4,3,2,1,0&gt;
  ...
.ENDM</pre><p>When the compiler encounters these macros, it does a source-level replacement of &#8220;i&#8221; in the content of the block with each value — copying-and-pasting the entire block.</p><p>This gives you immense flexibility to hand-tune things. I anticipate most Padauk projects will have ample program memory space for doing this sort of macro expansion, but if you need to pack things in tighter, you can convert your &#8220;compile-time&#8221; loops to &#8220;run-time&#8221; loops.</p><p>There are many other macros the compiler supports, many of which would be extremely challenging to try to write using traditional preprocessor commands and a &#8220;dumb&#8221; C compiler. For example, you can delay an arbitrary number of clock cycles like so:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">.delay 1100;</pre><p>The neat thing about this macro is that it will get compiled into different instructions depending on the constant value specified; if the delay value is small, the compiler will simply insert the appropriate number of NOPs (or the CPU&#8217;s actual <em>delay</em> instruction, if supported). Once the parameter gets larger, the compiler will create a traditional software loop that counts down the correct delay value. The compiler knows how many cycles each instruction takes, so this generated code is cycle-accurate.</p><p>I can hear you exclaiming &#8220;on a real microcontroller, you&#8217;d just use a timer!&#8221; — which is utter nonsense. Timers are only accurate when there&#8217;s no CPU involved (PWM generation, output compare toggling, input capture, etc). Timers become inaccurate once you start polling a timer register (which can take plus-or-minus a few cycles depending on things like the CPU&#8217;s pipeline or flash memory wait states) or waiting on ISRs (which can have 30 or more clock cycles of latency, and the exactly latency is usually indeterminate). If you want to belch out a really accurate digital waveform, or measure one, this is a great platform for doing that.</p><h3>Getting Closer to the Metal</h3><p>Once you get past basic blinking, you&#8217;ll quickly realize how limiting the compiler is. Other than the macros — which come in handy — the rest of Mini C is pretty weird and cerebral.</p><p>The Mini-C compiler is interesting in that it forces you to understand your architecture and what you can and can&#8217;t do on it. You&#8217;ll get a compilation error if you try to write a line of code like this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">int b = *(ptr + i);</pre><p>Why? Because your MCU does not have the ability to do indirect addressing with offsets (constant or otherwise). The compiler wants you to tell it precisely what you want to do. Maybe you want to do this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">ptr += i; // wipes out the old value of ptr, but it's fast
int b = *ptr;</pre><p>Or maybe this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">int newPtr = ptr + i; // uses a new memory allocation and is slower
int b = *newPtr;</pre><p>Both of these have trade-offs. The more you develop in Mini-C, the more you&#8217;ll start to realize exactly how much performance, code size, and RAM usage you&#8217;re used to sacrificing every day, just to make your software a bit briefer to write.</p><h2>Performance testing</h2><p>I wanted to put the Padauk PMS150C through its paces with my usual <a
href="https://jaycarlson.net/microcontrollers/#biquad">Biquad Filter Test</a>.</p><p>When it was all said and done, the part clocked in at 21.73 µs per sample — that&#8217;s <strong>46 kHz</strong> — which was as good or better than much more expensive parts in my $1 round-up, and perfectly acceptable for many applications.</p><p>But it was definitely not easy getting there. The C code I used for those original MCU tests looked something like this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">volatile int16_t in[25];
volatile int16_t out[25];

const int16_t a0 = 16384;
const int16_t a1 = -32768;
const int16_t a2 = 16384;
const int16_t b1 = -25576;
const int16_t b2 = 10508;

int16_t z1, z2;
int16_t outTemp;
int16_t inTemp;

void main()
{
	while(1) {
		_pa = 2;
		for(i=0;i&lt;25;i++)
		{
			inTemp = in[i];
			outTemp = inTemp * a0 + z1;
			z1 = inTemp * a1 + z2 - b1 * outTemp;
			z2 = inTemp * a2 - b2 * outTemp;
			out[i] = outTemp;
		}
		_pa = 0;
	}
}</pre><p>The Padauk code looks like this:</p><pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">WORD in[11];
WORD out[11];

WORD z1, z2;

WORD pOut, pIn; // these are pointers, but aren't typed as such

int i;

void	FPPA0 (void)
{
	.ADJUST_IC	SYSCLK=IHRC/2		//	SYSCLK=IHRC/2

	PAC.6 = 1; // make PA6 an output
	while(1) {
		PA.6 = 1;
		pOut = out;
		pIn = in;
		i = 0;
		do {
			*pOut = (*pIn &lt;&lt; 14) + z1;
			z1 = -(*pIn &lt;&lt; 15) + z2
				+ (*pOut &lt;&lt; 14)
				+ (*pOut &lt;&lt; 13)
				+ (*pOut &lt;&lt; 9)
				+ (*pOut &lt;&lt; 8)
				+ (*pOut &lt;&lt; 7)
				+ (*pOut &lt;&lt; 6)
				+ (*pOut &lt;&lt; 5)
				+ (*pOut &lt;&lt; 3);

			z2 = (*pIn &lt;&lt; 14)
				- (*pOut &lt;&lt; 13)
				- (*pOut &lt;&lt; 11)
				- (*pOut &lt;&lt; 8)
				- (*pOut &lt;&lt; 3)
				- (*pOut &lt;&lt; 2);

			i++;
			pOut++;
			pIn++;
		} while(i &lt; 11);

		PA.6 = 0;
	}
}</pre><p>There&#8217;s several things going on. First of all, don&#8217;t bother including &lt;stdint.h&gt; — it doesn&#8217;t exist. You&#8217;ll be using &#8220;WORD&#8221; for 16-bit numbers, &#8220;BYTE&#8221; for 8-bit ones, &#8220;EWORD&#8221; for 24-bit, and &#8220;DWORD&#8221; for 32-bit. I think int is 8 bits (??) on this architecture.</p><p>Starting in <em>FPPA0()</em> — the equivalent of <em>main()</em> — you&#8217;ll see that, indeed, Padauk has no <em>for()</em> loops. You may think it would make more sense to replace with a <em>while()</em> loop, but there&#8217;s a huge gotcha: the Padauk compiler cannot access memory with an offset determined by a variable; in other words, if <em>i</em> is a variable, you cannot access the <em>i</em>th element of <em>myArray</em> by calling <em>myArray[i]</em>. There are two ways of accessing array elements: using the aforementioned <em>.FOR</em> macro, or by walking through it by incrementing a pointer, as shown above.</p><p>While a macro .FOR would be faster, I quickly ran out of ROM space, since the entire contents of the function will be duplicated multiple times. I also tried calling the filter code through a function to reduce the ROM requirements, and it was similar in performance.</p><p>As for the filter function itself, you&#8217;ll see that all the multiplies have been replaced with shift-adds. The Padauk part does not recognize the * operator for multiplication; trying to use it to multiply two variables together results in a syntax error. No, I&#8217;m not joking.</p><p>Now, on some level, this makes sense since the PMS150C has no hardware multiplier — having said that, this is the kind of stuff you want your compiler to do for you.</p><p>And even when you move up to a Padauk part that <em>does</em> have a hardware multiplier, like a PMS132B or PMS134, the compiler still doesn&#8217;t recognize the operation.</p><h3>What about the multiplier?</h3><p>By the way, for those keeping score, the hardware multiplier helps quite a bit: the PMS134 can process each sample in 14 µs, for a sample rate of <strong>70 kHz</strong>. To put that into context, at this point, we&#8217;re obtaining about half the math performance of an 8 MHz Microchip megaAVR — pretty impressive for a 7-cent chip ((OK, the PMS134 is closer to 10 cents, but the PMS132B has similar specs — minus a few peripherals — and should be able to hit the same numbers)).</p><h3>Should you switch to SDCC?</h3><p>Wouldn&#8217;t it be nice if you could use a standards-compliant compiler, like SDCC, to target the Padauk parts? That would solve all these problems, wouldn&#8217;t it?</p><p>I don&#8217;t know — I didn&#8217;t try it. Why not? Because I honestly have no idea how you&#8217;d develop code on one of these parts with SDCC in a useful fashion. There doesn&#8217;t appear to be a way of loading an arbitrary binary into the ICE through the Padauk IDE software, and even if you could, there would be no way of getting the Padauk IDE to set breakpoints and inspect variables unless it knew how memory was mapped back to source code.</p><p>To this end, there&#8217;s really no good way to iteratively develop code using SDCC — the only way would either be to blow through hundreds of OTP parts or use an expensive MTP (flash) part. Either way, you&#8217;d lose all ability to debug, which is critical for tiny parts like this. If you&#8217;re a maker/hobbyist used to the printf() route on your AVR, think for a minute how many resources will be consumed with a single call to that function on one of these parts. Also keep in mind you have no UART&#8230;</p><div
class="wp-block-image"> <figure
class="aligncenter"><img
data-attachment-id="1565" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/image-2-2/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-2.png" data-orig-size="1015,750" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-2" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-2-300x222.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-2.png" class="wp-image-1565" src="https://jaycarlson.net/wp-content/uploads/2019/09/image-2.png?cbc196&amp;cbc196" alt="" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/image-2.png 1015w, https://jaycarlson.net/wp-content/uploads/2019/09/image-2-300x222.png 300w, https://jaycarlson.net/wp-content/uploads/2019/09/image-2-768x567.png 768w" sizes="(max-width: 1015px) 100vw, 1015px" /> <figcaption>The IDE has everything you want, plus a few extras I wish other vendors would incorporate. For example, why doesn&#8217;t every MCU IDE let me know when the MCU is <em>actually </em>asleep?</figcaption> </figure></div><h3>Padauk FPPA IDE</h3><p>OK, I kind of like ghetto IDEs — one of my favorite underdogs from the $1 Microcontroller series was the <a
href="/pf/holtek-ht-66/">Holtek HT-IDE 3000</a>. Padauk&#8217;s FPPA IDE makes the Holtek one look like Visual Studio 2019.</p><p>This thing is lean, mean, and suuuuuper basic. But it totally gets the job done, and if you hate it, you can go use your favorite text editor instead. Here&#8217;s what to expect with it, though:</p><ul><li><strong>3.9 MB download.</strong> The IDE is free, and there&#8217;s no registration.</li><li><strong>Half-second build times</strong>. The compiler is statically linked as library call instead of a separate executable, and the compilation process itself is trivial.</li><li><strong>1.3 seconds to launch a debug session.</strong> The Padauk ICE communicates using a Cypress high-speed USB 2.0 interface, and it shows. Starting and stopping debugging, setting breakpoints, stepping through code, and inspecting memory felt like I was debugging a PC app locally — not an embedded system.</li><li><strong>Light and Dark themes:</strong> Just go to <em>Help &gt; Color</em> to switch. Then ponder the menu location for that feature.</li><li><strong>No code completion</strong>. You won&#8217;t get a lot of IntelliSense-like features here, but there are plausibly-useful tooltips that appear when you hover over symbols, and you can go to definitions of (some) things, too. A smattering of macros have hard-coded help links to them — anything that&#8217;s underlined has instant help available.</li></ul><h2>Test Projects</h2><p>In addition to the performance evaluation above, I built two test projects to evaluate what the overall experience is like to develop on these parts.</p><p>The source files for these projects are <a
href="https://github.com/jaydcarlson/padauk-experiments/">available on GitHub</a>.</p><h3>NeoPixel SPI adapter</h3><div
class="wp-block-image"> <figure
class="alignright is-resized"><img
data-attachment-id="1608" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/neopixel-driver/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/neopixel-driver.gif" data-orig-size="400,224" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="neopixel-driver" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/neopixel-driver-300x168.gif" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/neopixel-driver.gif" class="wp-image-1608" src="https://jaycarlson.net/wp-content/uploads/2019/09/neopixel-driver.gif?cbc196&amp;cbc196" alt="" width="400" height="224" /> <figcaption>This PMC251 serves as an SPI-to-NeoPixel bridge, converting a 500 kHz MOSI / SCK signal pair to a WS2812B-compatible pulse train.</figcaption> </figure></div><p>I wanted to try out the dual-FPPA functionality found on the PMC2xx and PMS2xx parts, and since I just got done talking about how great it is for communication, I thought I&#8217;d create a NeoPixel SPI adapter built around the PMC251.</p><p>The firmware takes a 480 &#8211; 510 kHz SPI signal (data and clock only) and outputs it as a WS2812B-compatible pulse train. There is a one-byte (16 µs) latency, which should be fine for most applications.</p><p>This part is around 7 or 8 cents, depending on if you get the <a
href="https://lcsc.com/product-detail/Others_PADAUK-Tech-PMC251-S08_C317603.html">8-pin</a> or <a
href="https://lcsc.com/product-detail/Others_PADAUK-Tech-PMC251-S14_C317604.html">14-pin</a> version (either will work for this project).</p><p>Because of the flexible logic input thresholds on the Padauk parts, this implementation should work down to 3.0V logic levels or lower, which the WS2812B wouldn&#8217;t natively support if you tried driving it directly (for 3.3V interfacing, <a
href="https://learn.adafruit.com/neopixel-levelshifter">Adafruit recommends using a 74HCT125 logic-level converter</a>, which is substantially more expensive than this Padauk part).</p><div
class="wp-block-image"> <figure
class="aligncenter"><img
data-attachment-id="1609" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/image-6/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-6.png" data-orig-size="1014,339" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image-6" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-6-300x100.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/image-6.png" class="wp-image-1609" src="https://jaycarlson.net/wp-content/uploads/2019/09/image-6.png?cbc196&amp;cbc196" alt="" srcset="https://jaycarlson.net/wp-content/uploads/2019/09/image-6.png 1014w, https://jaycarlson.net/wp-content/uploads/2019/09/image-6-300x100.png 300w, https://jaycarlson.net/wp-content/uploads/2019/09/image-6-768x257.png 768w" sizes="(max-width: 1014px) 100vw, 1014px" /> <figcaption>The NeoPixel SPI adapter has pretty tight timing requirements that mean your 500 kHz SPI signal can&#8217;t stop mid-transmission.</figcaption> </figure></div><p>The biggest problem I ran into was the ~9 µs timeout of the WS2812B. The fastest SPI signal I could reliably receive was about 460 kHz, but this introduced too much delay while waiting for the next byte. I tried increasing the SPI frequency to 500 kHz, but I would start losing bits when I was running the system at the normal 16 MHz frequency of the chip (which is really 8 MHz for the instruction clock, which is really 4 MHz for the instruction clock for each FPP).</p><p>I was able to trim some code down to tighten things up, but the real breakthrough was when I remembered I could nudge the system clock up or down with a single line of code, and the Padauk programmer would calibrate this into each part. I raised the clock to 18 MHz, which allowed me to reliably receive SPI traffic up to 510 kHz. This provided a 6 or 7 µs window between transmitted bytes that the NeoPixels seemed to be able to handle.</p><p>The dev tools worked well — once I had the code working on the ICE, I popped a fresh PMC251 onto a breakout board, threw it in the programmer, flashed the image, moved it over to my breadboard, and everything just worked.</p><h3>Bike Light</h3><div
class="wp-block-image"> <figure
class="alignright"><img
data-attachment-id="1606" data-permalink="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/bike-light/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/09/bike-light.gif" data-orig-size="400,224" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="bike-light" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/09/bike-light-300x168.gif" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/09/bike-light.gif" class="wp-image-1606" src="https://jaycarlson.net/wp-content/uploads/2019/09/bike-light.gif?cbc196&amp;cbc196" alt="" /> <figcaption>I used the PMS150C to build a simple flashing bike light</figcaption> </figure></div><p>This is a simple project that uses a tactile push-button switch to toggle on or off a blinking LED, potentially as a bicycle light. While many people might implement this project using a slide switch and a 555 timer, this implementation has substantially fewer BOM lines as well as a much lower BOM cost.</p><p>In the GIF above, I&#8217;m flashing a single LED, however, the MCU will blink all pins on port A the same — on SOT23-6 devices, you can use up to 3 LEDs, while SO-8 packages will blink up to 5 LEDs.</p><p>This project was mostly designed as a practical test of the sleep power modes of the Padauk parts. In sleep mode, the PMS150C sips on just 350 nA when powered from a 3.3V supply. Considering this includes the leakage current from the nternal pull-up on the GPIO input pin used for the push-button, this is pretty impressive. A CR2032 battery could power this thing in sleep mode for 10-15 years — the limiting factor would be the self-discharge of the battery itself.</p><h2>Closing Thoughts</h2><p>The Padauk parts are nearly perfect for a set of specific, targeted applications. They should not be considered general-purpose microcontrollers that are drop-in replacements for other more expensive parts, but rather, extremely optimized parts that you reach for when you really want to show off your engineering chops and get BOM cost down to a minimum. Anyone who <a
href="https://hackaday.com/2019/04/26/making-a-three-cent-microcontroller-useful/">thinks these parts are terrible</a> doesn&#8217;t understand (or at least value) how to design embedded systems properly.</p><p>So what are the usage cases to avoid? Basically anything where you need a whole lot of math, a whole lot of comms, or a whole lot of analog.</p><p>Because any comms you need will be done in software, it is unlikely you&#8217;ll be able to run a receiver at bauds faster than about 500 kbps. But for 100 kHz I2C, transmit-only UART, and slower SPI, I had no problems. In fact, compared to other MCUs, doing everything in software was downright easy, since there&#8217;s no peripheral configuration registers to consult in the datasheet.</p><p>The compiler is great for efficiently shuffling bits around, but it&#8217;s really restrictive for any sort of signal processing duties. It has no math library, so you&#8217;ll be writing routines for anything more complicated than addition and subtraction. Still, forcing yourself to use it definitely offers some bare-metal learning outcomes. SDCC support for these is interesting, but without tie-ins with the vendor tools, it&#8217;s more of a novelty than a useful tool right now.</p><p>If you&#8217;re not building large quantities of a product, remember that spending hundreds of dollars on ICEs and programmers will bump up the per-unit cost of development. Hobbyists, hackers, makers, and people working in small shops building one-offs will likely only find these parts amusing — but for engineers designing products in volume, I couldn&#8217;t find any reason <em>not</em> to consider these parts for a wide range of simple applications.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/">What&#8217;s up with these 3-cent microcontrollers?</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2019/09/06/whats-up-with-these-3-cent-microcontrollers/feed/</wfw:commentRss> <slash:comments>25</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">1546</post-id> </item> <item><title>How I Teach Embedded Systems</title><link>https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/</link> <comments>https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Fri, 26 Jul 2019 03:10:39 +0000</pubDate> <category><![CDATA[Uncategorized]]></category> <guid
isPermaLink="false">https://jaycarlson.net/?p=1470</guid><description><![CDATA[<p>I reworked and taught the Intro Embedded Systems course at my university this year; here's everything I learned along the way.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/">How I Teach Embedded Systems</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p><em><strong>Update (9/19/2019):</strong> I recently spoke with Elecia and Christopher White from <a
href="https://embedded.fm">Embedded Podcast</a> about this post and embedded systems education in general. <a
href="https://embedded.fm/episodes/303">The episode</a> dives into a lot more content than what I wrote about here — be sure to listen if you&#8217;re interested!</em></p><p>I&#8217;ve been <em>very</em> quiet on the internet lately — I bought a new house, I&#8217;ve been working on a ton of projects, and I&#8217;ve been (happily) swamped teaching in the Electrical &amp; Computer Engineering department at my university this year.</p><p>In the fall, I taught an Advanced Embedded Systems special topics elective, and this spring, I taught the Introduction to Embedded Systems course.</p><p>I wanted to write up a few notes explaining how I changed our Embedded Systems class this semester to help others interested in Embedded Systems education.</p><h2>What is Embedded Systems?</h2><p>When you think about it, Embedded Systems is one of the strangest classes in an Electrical Engineering curriculum<strong>.</strong> Most classes taught to freshman and sophomores focus on applying analysis techniques to pre-designed systems:</p><ul><li><em>Calculate the current going through resistor</em></li><li><em>Determine the output impedance of the amplifier</em></li><li><em>Find the 3dB frequency of the low-pass filter</em></li><li><em>Determine if the given system is causal</em></li></ul><p>At the junior/senior level, students are asked to design/evaluate systems.</p><ul><li><em>Design an operational amplifier circuit that amplifies a microphone with a 4.7 kOhm output impedance by a factor of 100, and provides an output impedance less than 100 ohms.</em></li><li><em>Design a buck converter that can supply a 5V 1A load from a 12V input.</em></li><li><em>Design an FSK communication system that can operate at 22 Mbps with a BER of 10^-4.</em></li></ul><p>Embedded Systems isn&#8217;t well-grounded in fundamental concepts; rather, it often serves as the <em>application</em> of all the above concepts into real-world systems. And it&#8217;s not because embedded systems are the end-all/be-all of electrical engineering  — rather, because embedded systems are the simplest real-world examples of these fundamental principles of EE.</p><p>Also, while we teach students how to design embedded systems, designing this stuff is more about following the<a
href="https://en.wikipedia.org/wiki/Engineering_design_process"><em> Design Process</em></a> — not using a formula to select the optimal bias resistor value for an amplifier (which is what most EE students think of when they think of &#8220;design&#8221;).((In many ways, the Design Process is much more abstract and challenging than typical EE design problems. It&#8217;s also much more wishy-washy, which makes many professors uncomfortable teaching it.))</p><p><figure
id="attachment_1526" aria-describedby="caption-attachment-1526" style="width: 756px" class="wp-caption aligncenter"><img
data-attachment-id="1526" data-permalink="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/postcopydigitalbloomsverbs-2-1/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1.png" data-orig-size="756,567" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="PostCopyDigitalBloomsVerbs-2-1" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1-300x225.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1.png" class="wp-image-1526 size-full" src="https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1.png?cbc196&amp;cbc196" alt="" width="756" height="567" srcset="https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1.png 756w, https://jaycarlson.net/wp-content/uploads/2019/07/PostCopyDigitalBloomsVerbs-2-1-300x225.png 300w" sizes="(max-width: 756px) 100vw, 756px" /><figcaption
id="caption-attachment-1526" class="wp-caption-text">Obligatory Bloom&#8217;s Taxonomy graphic.</figcaption></figure></p><h3>Embedded Systems is messy; messy means memorization.</h3><p>It is the <em>practical application</em> of fundamental skills where things get messy. That means embedded systems are messy, and Embedded Systems is a messy course. If you think about it, the messier something is, the more that learning outcomes will fall under recall and recognition<em> —</em> rather than analysis and evaluation.</p><p>That may seem counterintuitive — shouldn&#8217;t messy, complex systems yield (or even <em>require</em>) higher-order Bloom&#8217;s stuff? No, quite the opposite.</p><p>Think of a microcontroller blinking an LED attached to a GPIO pin. If we used analysis-oriented cognitive processes instead of &#8220;lower order&#8221; thinking, we couldn&#8217;t blink an LED attached to a GPIO without applying  KVL/KCL, Ohm&#8217;s Law, and nonlinear models of transistors. We&#8217;d have to do this for every transistor in the microcontroller. Otherwise, we would have no idea if it would &#8220;work&#8221; or not.</p><p>Of course, we don&#8217;t use bottom-level analysis techniques to blink an LED. Instead, we teach students to memorize that a push/pull GPIO output cell will attempt to drive a pin to VDD or GND depending on the GPIO&#8217;s register value. We teach students to memorize that GPIO pins can only supply a certain amount of current, so you can&#8217;t drive large loads. We teach students to memorize that if their GPIO pin doesn&#8217;t work, they probably forgot to make it an output. We teach students to memorize that each GPIO pin is part of a GPIO port, which is controlled by a single register. We teach students to memorize that some MCUs allow you to read and write individual bits in registers, and some architectures don&#8217;t, and some only let you modify bits in some registers, but not others. We teach students to memorize the names of the GPIO registers for their specific MCU, and we teach students to memorize the steps necessary to compile, assemble, program, and debug their software.</p><p>All of these are abstractions — which are good. Abstract reasoning is good. But let&#8217;s not forget that abstract reasoning relies on a ton of memorization and recall. As soon as you abstract something out of your mental workspace, you have to remember how it works.</p><p>Embedded Systems education should use pedagogical approaches that are proven winners when it comes to recall-oriented learning.</p><h2>Matching the Pedagogy with the Learners</h2><p>Alright, so we&#8217;ve established that any practical Embedded Systems course will be heavily rooted in recall, recognition, understanding, and application. And design/evaluation work in Embedded Systems is generally less concrete than in our circuits classes. We need to take these ideas and form a pedagogy that also links up with our students.</p><p>In the Electrical &amp; Computer Engineering department at UNL, Embedded Systems is taught at the Sophomore level. Sophomores are old enough to have <a
href="https://onlinelibrary.wiley.com/doi/full/10.1111/j.1467-7687.2008.00743.x">good relational reasoning ability</a>, but many are too young to have a fully developed prefrontal cortex <a
href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3621648/">necessary for proficient high-order abstract reasoning</a>.</p><p>From a course scaffolding perspective, sophomore ECE students have taken a one-hour-a-week C programming course, where they seemed to learn to do little more than malloc() character arrays on a UNIX server and print them. These students have not (nor will ever) take a computer architecture course, and they won&#8217;t take a digital logic design class until their junior year.</p><p>As an educator, I have to be cognizant of this when planning learning outcomes and pedagogy for the course. Here&#8217;s what I came up with:</p><ul><li><strong>Use a reverse classroom approach, with online interactive reading assignments.</strong> These are the gold standard for low-order learning tasks in modern education circles. This approach allows us to cover a huge amount of content in a short time, so we can get students caught up on architecture, programming, and digital logic at the same time they&#8217;re doing embedded development.</li><li><strong>Use project-based learning for higher-order learning.</strong> Having students practice conceptual topics with real hardware is critical to seeing how these topics apply to real-world embedded engineering, and it gives students the opportunity to practice the design process.</li><li><strong>Use regular in-class quizzing as a summative assessment.</strong> These quizzes are the primary grade component for the students&#8217; official records.</li></ul><h2>Online Reading Assignments</h2><p><figure
id="attachment_1496" aria-describedby="caption-attachment-1496" style="width: 449px" class="wp-caption alignright"><img
data-attachment-id="1496" data-permalink="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/chrome_2019-07-25_14-21-39/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39.png" data-orig-size="449,771" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="chrome_2019-07-25_14-21-39" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39-175x300.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39.png" class="wp-image-1496 size-full" src="https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39.png?cbc196&amp;cbc196" alt="" width="449" height="771" srcset="https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39.png 449w, https://jaycarlson.net/wp-content/uploads/2019/07/chrome_2019-07-25_14-21-39-175x300.png 175w" sizes="(max-width: 449px) 100vw, 449px" /><figcaption
id="caption-attachment-1496" class="wp-caption-text">An example snippet out of the GPIO output reading assignment.</figcaption></figure></p><p>I experimented with a traditional lecture format when I taught Advanced Embedded Systems last year, and it was extremely inefficient at handling the learning outcomes of the class.</p><p>For my Intro course last semester, I decided to use a reverse classroom. Reverse calssrooms are not where students teach the instructor (though that&#8217;s cool too!) — but rather, where students do &#8220;classwork&#8221; (learning) at home, and &#8220;homework&#8221; (practicing their learning) in class.</p><p>A lot of reverse classrooms have instructors record lectures and post them online for students to watch, and then bring questions to class. Instead, I generally use interactive reading assignments that I create on our university&#8217;s LMS.</p><p>Before each lecture, students work through the assigned reading and answer the built-in questions. In class, we often review the results of the reading assignment to see which questions students bumped on the most. We go through questions students have about the assignment, and then we spend the remainder of class time reinforcing these topics with peer learning exercises, demonstrations, other group work, and tons of question-and-answer time.</p><p>For what it&#8217;s worth, certain lectures — especially on electronics circuits — demanded a true lecture-style reading assignment, so I ended up creating a few Khan Academy-style videos.</p><p>I really try to avoid introducing new material in lectures — more progressed students fall asleep, and emerging learning struggle to keep up. Instead, the reading assignments provided an amazingly efficient way for students to achieve learning outcomes.</p><p>The interactivity is key: Over-confident students who would otherwise brush through a reading — skimming over important details, only to be punished on a homework or quiz — are forced to re-read and think about details they omitted when they are asked questions about the material. By interspersing questions in between content instead of having students fill out separate quizzes, the questions serve as a speed bump that forces students to avoid rushing through material.</p><p>Plus, when students are finished with their reading assignment, they get instant feedback on their learning progress. This feedback cycle is critical to learning; many students would bring questions to class that were based on reading assignment questions they missed.</p><p>This is the whole goal of a reverse-classroom approach; we get to reinforce and strengthen learning in the classroom, instead of trying to do this outside of the classroom.</p><h2>Course Roadmap: Top-down, JIT, and Corkscrew Learning</h2><p>We spent our first week block-diagramming real-world embedded systems — mostly focused on consumer electronics products the students see in their own lives. The reading material presented very high-level explanations of a microcontroller, an IC, a circuit board, the basic peripherals inside the microcontroller, and how these things are generally tied together.</p><p>You may be surprised how little material students must learn before they can start making good-quality predictions about how products are designed. Two lectures in, students were block-diagramming ovens, gaming controllers, calculators, and electric drills.</p><p>Sure, their ovens had heating elements directly attached to DACs, and their electric drills neglected a forward/backward switch, but I was amazed at the early models students constructed in their brains about embedded systems. They know that buttons are hooked up to GPIO pins. They know that many displays require a display controller to sit on a communications bus, and they know that, as one student said, &#8220;I2C is cool because you can put multiple sensors and things on it.&#8221; Not bad for the first week of class!</p><p>Traditionally, instructors of this course presented material bottom-up, topic-by-topic. First, an introduction to binary. Then, a C programming review. After that, GPIO. Then ADCs. Then timers. Then UART/SPI/I2C. Et cetera.</p><p>This is extremely convenient for the instructor — they can work out all the learning outcomes relevant to each topic, and pound them out methodically.</p><p>Instead, I&#8217;m a big fan of JIT (just-in-time) learning, and what I call the <em>corkscrew</em> approach: circling back around through the same material, over and over again, each time digging deeper and uncovering more details (and exceptions to the rule, in the case of embedded systems).</p><p>As an example: I wouldn&#8217;t feel comfortable graduating a student from my course without them being able to explain output impedance of a GPIO pin. However, I don&#8217;t need them to have mastery of this to turn an LED on or off, or as a pre-requisite for operating a UART. We can cover a &#8220;first pass&#8221; through GPIO, then move onto other peripherals and, later on in the semester, circle back around to output impedance.</p><p>So how do you know when to provide instruction for a topic? We do most everything just-in-time (JIT). By the third week, we hadn&#8217;t covered conditional statements or binary operators in C, but we&#8217;ve worked through pointers (including a challenging reading assignment problem). Why? Because their first GPIO assignment will require that they can modify memory using C programming. And that&#8217;s about <em>all</em> it will require. We didn&#8217;t get to output impedance until we discussed PWM, since so many PWM applications students consider involve driving high-power loads.</p><p>But JIT doesn&#8217;t just describe the order of topics; I use it to provide real-time feedback on reading assignment questions. I will often configure our LMS&#8217;s &#8220;wrong&#8221; answers to provide additional instruction to students who misunderstood a concept. That way, answers aren&#8217;t simply &#8220;wrong&#8221; — there&#8217;s a learning component built into the question itself. Students are eager to complete the reading and get immediate feedback on what they have and haven&#8217;t mastered. This JIT feedback is so much more powerful than traditional paper-and-pencil formative assessments, where the students may get their quiz back a week or more later, with nothing more than a grade and perhaps the correct answers circled.</p><h3>Don&#8217;t avoid details</h3><p>One fault I see with some embedded systems curricula is to strive for affective engagement by simply throwing in the towel and converting their classes into something that would belong at a makerspace. They end up with course material that has very little relevance to the actual learning outcomes for the course, and instead focus on things like hobby servo motors, 3D printing, and driving WS2812s with Arduino libraries. This is fun stuff to play with — I encourage my students to take up electronics as a hobby. But this stuff doesn&#8217;t belong an embedded systems classroom, where we have so little time to cover such a huge amount of information.</p><p>I think a lot of instructors end up equating &#8220;top down&#8221; with &#8220;stay out of the weeds&#8221; — that&#8217;s simply not true, though (otherwise the word &#8220;down&#8221; would not appear in &#8220;top down&#8221;).</p><p>Because of all the harsh sentiment expressed about &#8220;the dirty low-level details&#8221; my initial gut feeling was that students would get excited about the high-level stuff and snooze during the low-level details. However, something quite different ended up happening in the classroom.</p><p>In the third week of class, I introduced GPIO (and, really, the concept of memory-mapped peripherals) to my students by typing out the bare op-codes of a &#8220;blinky&#8221; program in the hex editor programming tool, uploaded the code to an 8051 MCU, and ran it in front of the class. I expected quite a bit of snoozing, but instead, many of them were absolutely enthralled.</p><p>I could see that the material clicked in their brains instantly. They finally put the pieces together that we had been talking about: all compilers do is turn C code into these primitive machine instructions, and a GPIO port is just a register sitting in memory space somewhere. They <em>know</em> there&#8217;s no such thing as a &#8220;set pin high&#8221; CPU instruction, since they <em>saw</em> nothing but &#8220;MOV&#8221; and &#8220;JMP&#8221; instructions.((Here, the 8051 was super useful — the fully orthogonal instruction set let me write an entire blinky program in something like 5 bytes of code. There&#8217;s nothing wrong with doing classroom demos using microcontrollers other than the one found in the lab kit — in fact, it can help strengthen learning.))</p><p>When a student came to me later that week, unsure of why her breakpoint was &#8220;broken&#8221; in the lab she was working on, I reminded her to look at the disassembly view, and she quickly noticed, &#8220;oh weird, the compiler didn&#8217;t emit any instructions for that line of code. No wonder.&#8221; Those sorts of realizations don&#8217;t usually happen in the third week of an embedded systems class because instructors are afraid of diving into the deep end.</p><p>Learners need a concrete understanding of how these systems work <strong>at all levels</strong> to feel comfortable and confident. They like the details, and they can even get excited by them — just as long as they&#8217;ve been primed to see how these details come together to create amazing outcomes.</p><p>Us more experienced folks are better at abstraction; we can comfortably and confidently use systems that we don&#8217;t fully understand. We have to fight the urge to teach topics that way.</p><h2>Project-Based Learning</h2><p>In addition to reading assignments, there&#8217;s a project-based learning (PBL)  component to my course. This is somewhat comparable to traditional &#8220;lab assignments&#8221; found in other Embedded Systems courses (and I even refer to them as &#8220;labs&#8221; in class), but they end up serving different goals and function differently in a pedagogical sense.</p><p>The old labs for the class were weighted strongly enough that I&#8217;d consider them summative assessments: students were expected to show up to lecture, learn how to use their microcontroller by staring at the lecture slides while the instructor went over things, and then demonstrate their achievement by programming the lab, writing a report, and turning it in for credit.</p><p>These labs, which used Arduino, were things like:</p><ul><li>Use Serial.print() to experimentally determine the size of various data types.</li><li>Time a GPIO pulse with a logic analyzer or oscilloscope to estimate how many clock cycles it takes to write a value to a port.</li><li>Read a UART character, &#8220;encrypt&#8221; it using a shift cypher, and send it back to the computer.</li></ul><p>I don&#8217;t know how other universities handle embedded labs, but I found these to be very bizarre — they have an oddly experimental/investigative tone to them; they seem to view the microcontroller as a black box, whose properties we can discover only through experimentation ((This may seem similar to other classes in an undergraduate EE curriculum, though it&#8217;s missing a big point — in those other classes, students calculate what a property <em>should </em>be, and then experimentally verify. It reinforces to students that we can form models of systems that help us predict behavior without having to actually observe the behavior experimentally.))</p><p>Students leave the class thinking the only way of seeing how quickly a UART interrupt can work is by trying it and timing it with a scope.</p><p>To make matters worse, the labs are often extremely prescriptive (with literal step-by-step instructions that guide the student precisely through every task), yet ask complex questions that aren&#8217;t explored in lectures or lab material. Sadly, these questions often represent the kernel of what the lab is about — they&#8217;re the stuff the student should leave the class understanding.</p><p>For example, in their lab reports for the GPIO lab, students are expected to  explain why wiggling a GPIO pin in a while() loop does not produce a 50% duty cycle. That&#8217;s how the question is framed. This requires them to have a high-order understanding of cycle-by-cycle timing of machine instructions without having ever looking at a disassembly of their C source code, or taught about computer architecture.</p><p>I&#8217;ve never graded those labs, but I&#8217;d imagine I&#8217;d see very poor-quality answers from the students.</p><h2>Revising the Lab Kits</h2><p>When I started thinking about what I would change about the class, one of the first things to go was the Arduino platform it was taught with.</p><p>I honestly have no idea why Arduino is used as much as it is in EE / CS embedded education programs, since it has such poor alignment with most learning outcomes for these classes:</p><ul><li><strong>Difficulty accessing dev environment internals:</strong> how do I view the assembly code output from Arduino? Or the hex file that will get programmed? Can I control how variables are placed in RAM, or configure the linker or compiler optimization settings in any manner?</li><li><strong>Difficulty accessing hardware internals:</strong> there&#8217;s no debugger. It&#8217;s insane to teach an embedded systems course with a platform that does not allow you to set breakpoints or inspect or modify memory.</li><li><strong>Strange, non-standard C preprocessor secret sauce:</strong> &#8220;void main()&#8221;? Nah. Call functions without declaring them first? Sure. Wait, what headers are included by default? Who knows. Students leave the course thinking that <em>DDRB</em>, <em>Serial.print()</em> and <em>uint16_t</em> are all reserved words in C that you can use anywhere.</li></ul><p>My other (more pragmatic) issue with the Arduino platform is the nonstandard tooling. There are tons of MCUs students will encounter professionally. These generally all work the same: you write software in C, and then you compile it, getting some sort of hex file. You use a debugger or a programmer to communicate with the MCU and load the program code into the flash memory of the microcontroller, and then you run it. Most of the time, you have a debugger attached that can set break points, inspect memory, and receive trace data. The Arduino Uno ecosystem is not representative or similar to any other microcontroller ecosystem, so it seems like a bizarre choice.</p><p>With the Arduino out, it was time to go MCU shopping. I approached the course as yet another engineering problem: you need to pick the right part for the job.</p><h3><img
data-attachment-id="1506" data-permalink="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/20190113-9514/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514.jpg" data-orig-size="4096,3049" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20190113-9514" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514-300x223.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514-1024x762.jpg" class="aligncenter size-full wp-image-1506" src="https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514.jpg?cbc196&amp;cbc196" alt="" width="4096" height="3049" srcset="https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514.jpg 4096w, https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514-300x223.jpg 300w, https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514-768x572.jpg 768w, https://jaycarlson.net/wp-content/uploads/2019/07/20190113-9514-1024x762.jpg 1024w" sizes="(max-width: 4096px) 100vw, 4096px" />Microchip PIC16</h3><p>For the project-based learning component of the course, I selected the PIC16F18446 + MPLAB Snap debugger. This is not a microcontroller I would generally use in my professional work, so why teach this course around the PIC16?</p><ul><li>DIP package allows students to breadboard their MCU to remove any &#8220;black box&#8221; concerns that come with dev boards</li><li>Simple peripherals</li><li>Extremely easy-to-read datasheet with step-by-step directions to configure peripherals</li><li>Low-cost ($15) debugger</li><li>Free IDE that runs on Windows, macOS, and Linux</li><li>Decent IO viewer in the IDE that allows students to interact with peripherals (and potentially see why their code isn&#8217;t working)</li><li>Toolchain supports bitwise operations with fluent syntax (<em>RB5 = 1</em> sets pin RB5 high, without touching other GPIO pins)</li><li>Peripheral code-gen tools built into the IDE</li><li>Lots of breakpoints (3? 4?) compared to other PIC parts</li></ul><p>I looked at literally every MCU I reviewed in the round-up, and I think I made the best decision. Many deal-breakers to consider:</p><ul><li>The Texas Instruments MSP430 LaunchPad FET doesn&#8217;t seem to work in macOS. I find the MSP430 datasheets to be far too cerebral, and the clock architecture is a bit too complicated for beginners.</li><li>The Silicon Labs EFM8 ticks off almost all the checkboxes above, but you can&#8217;t do any GPIO operations without enabling the Crossbar, which is confusing for students new to memory-mapped I/O. No DIP package either means I&#8217;d have to have students solder SOICs onto adapter boards, or use old-stock C8051 parts.</li><li>The clock system and power gating on most Arm parts is way too complicated for students new to MCUs to understand, so that excludes a huge number of parts.</li><li>Other MCUs often don&#8217;t have dev environments for macOS or Linux. Any student serious about embedded systems needs to have a Windows computer (for the CAD software alone), but our department doesn&#8217;t have specific computer guidelines, and students get mixed messages from other instructors in the department that work outside of the embedded systems field.</li></ul><p>For what it&#8217;s worth, the PIC16F18446 is not without its problems:</p><ul><li><strong>Programming and debugging speed is atrocious.</strong> This isn&#8217;t an MPLAB Snap problem — it&#8217;s just the PIC16. Students learned to be a bit more methodical when they were developing: measure twice, debug once.</li><li><strong>Peripheral Pin Select is clunky and error-prone for beginners.</strong> My students quickly learned of the spectrum between &#8220;easy&#8221; and &#8220;flexible&#8221; — while I like that students can route any function to any pin, there are a few gotchas that can be maddening to figure out. For example, when programming the MCU as an SPI master, you have to route the SCK pin as both an <em>output </em>from the MSSP peripheral, and also as an <em>input</em> back into the MSSP peripheral.</li><li><strong>ANSEL is mis-named.</strong> Why would you have to modify a register named &#8220;Analog Select&#8221; if you want to use a GPIO pin as a digital input? Well, because, &#8220;ANSEL&#8221; doesn&#8217;t really mean &#8220;enable analog&#8221; — it means &#8220;disable the digital input buffer.&#8221; At least the PIC16 doesn&#8217;t use backwards GPIO data direction values like the AVR.</li><li><strong>Weird interrupt syntax.</strong> Students struggled to understand why you had to write &#8220;__interrupt()&#8221; — which looks like a function — as a modifier to their ISR. Students would often declare a function with this name, and end up with bizarre code compilation errors.</li><li><strong>IO View is broken half the time.</strong> If you want to inspect peripheral registers in MPLAB X, IO View seems like a good place to do it. Unfortunately, in my experience, its values often get frozen. There&#8217;s nothing worse than students not being able to trust their tools.</li></ul><h2>New Format</h2><p>In my class, each lab has an experimental component and a PBL component.</p><h3>Experimental Component</h3><p>The experimental component is where students learn how to use a peripheral or microcontroller component. As an example, let&#8217;s look at the GPIO lab. <span
style="font-size: inherit;">I didn&#8217;t mind the existing idea — time GPIO values with a scope to infer instruction timing — but we reworked the problem to make it a bit more realistic, while adding more thorough analysis built into the lab.</span></p><p>In the real world, you <strong>always</strong> know how many cycles it takes for an instruction to execute (it&#8217;s clearly printed in the datasheet), but it&#8217;s relatively common to make oscillator configuration mistakes that cause your MCU to run at a speed different than you think it should be running at.</p><p>As a result, I had my students write C code to toggle a GPIO pin, and then look at the disassembly output and step through the instructions with their debugger. They calculated the number of cycles their code should take to execute, and then compared it with the actual execution time to determine the clock frequency of their microcontroller.</p><p>By walking them through each component of this in a prescriptive manner, they practiced reading datasheets to look at instruction timing, calculated how many cycles their loop would take to execute, captured experimental data, and fit their calculations to the data.</p><h3><img
data-attachment-id="1503" data-permalink="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/12-led-rgbw-led-light-mixing-8-dmx-ch-ip20-led-par-15w-dmx-par-light-jpg_640x640/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640.jpg" data-orig-size="640,640" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640-300x300.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640.jpg" class="aligncenter size-full wp-image-1503" src="https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640.jpg?cbc196&amp;cbc196" alt="" width="640" height="640" srcset="https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640.jpg 640w, https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640-150x150.jpg 150w, https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640-300x300.jpg 300w, https://jaycarlson.net/wp-content/uploads/2019/07/12-LED-RGBW-LED-Light-Mixing-8-DMX-CH-IP20-Led-Par-15W-DMX-Par-Light.jpg_640x640-256x256.jpg 256w" sizes="(max-width: 640px) 100vw, 640px" />PBL Component</h3><p>Additionally, each lab has a project-based learning (PBL) component, which chips away at a semester-long design project.</p><p>I&#8217;ve seen a wide variety of embedded projects used in instruction — many of which fall into the category of &#8220;small toy robots&#8221; — and I wanted to find something that felt like a commercial product that a student would go out and buy. I had students program a commercially-available DMX light, pictured above.</p><p><iframe
class='youtube-player' width='1170' height='659' src='https://www.youtube.com/embed/0bKzHjpYZUo?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p><p>I was inspired by watching Big Clive&#8217;s teardown of the light fixture. The light fixture lets students program almost all the important peripherals on their MCU:</p><ul><li>GPIO inputs for push-button switches</li><li>I2C for the 4-digit 7-segment display driver</li><li>Timers/PWM for the main LED array</li><li>ADC for the microphone</li><li>UART for the DMX receiver</li></ul><p>These light fixtures are very inexpensive — we bought a class set of them from eBay for something like $7 each.</p><p><img
data-attachment-id="1505" data-permalink="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/20190120-9523-2/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1.jpg" data-orig-size="4096,2734" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20190120-9523" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1-1024x684.jpg" class="aligncenter size-full wp-image-1505" src="https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1.jpg?cbc196&amp;cbc196" alt="" width="4096" height="2734" srcset="https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1.jpg 4096w, https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2019/07/20190120-9523-1-1024x684.jpg 1024w" sizes="(max-width: 4096px) 100vw, 4096px" />I did a quick respin of the control board design — swapping out the Nuvton N76 with the same PIC16F18446 we used in the lab kit — but kept everything else the same.</p><p>It worked really well. Students were given the light fixtures at the beginning of class and they were essentially paperweights, containing a simple demo firmware image that lit each color when you pressed a button. By the end, they were fully-functional DMX lights — complete with extra features and capabilities the students designed and implemented on their own in the last few weeks of class. One of my students <a
href="https://www.youtube.com/watch?v=8v7zW0Y9Dsg">uploaded a YouTube video</a> illustrating how these projected turned out.</p><p>There was a lot of other learning that was happening undercover; students had to disassemble and reassemble their light fixture whenever they wanted to program the board. They got into the habit of how everything goes together, and what cable plugs into what. They saw that there&#8217;s nothing magical inside a plastic enclosure for a product, and they started building confidence — feeling like they were a lot closer to being able to design this stuff than they ever thought before.</p><h2>Summative Assessment</h2><p>I do not use projects/labs for summative assessment. Students need the freedom to work with others (and me and my TA) on the projects since a lot of reinforcement happens while they&#8217;re working on things. Plus, projects and labs focus on different orders of learning than the reading assignments do, so if you use the labs for summative assessment, you&#8217;re testing students over material they have yet to be formatively assessed on, which is unfair to them, and prevents the instructor from providing learning interventions before the assessment.</p><p>As a result, it makes more sense to use the PBL component as additional formative assessment in conjunction with the reading assignments — both covering different areas of learning. If you&#8217;re shaky on formative versus summative assessment, all you need to know is that formative assessments serve as diagnostic tools that students and instructors can use to evaluate learning along the way. Summative assessment is used to evaluate achievement.</p><p>At the end of the day, I have to assign a grade to each student in my class, and I want that grade to ultimately reflect <em>achievement</em> — not effort.</p><p>As a result, I designed several small tests that I administered in class roughly every two weeks. These summative assessments had roughly 10 short-answer and multiple-choice questions on them; they were always conceptual in nature, so students with good understanding of the material could complete them in as much time as it took to write out the answers.</p><p>Students who couldn&#8217;t complete them immediately generally had much worse scores, so there&#8217;s not much point in giving students more than 10-15 minutes to finish. Even so, I allow students as much time as they&#8217;d like to complete the assessment, just so students don&#8217;t feel unfairly treated or rushed.</p><h1>Wrapping Things Up</h1><p>It was an eye-opening year teaching both of the Embedded Systems classes, and we&#8217;re about a month away from kicking off the fall semester, where I&#8217;ll be teaching my Advanced Embedded Systems class again (which, itself, will be completely different than last time around).</p><p>Teaching isn&#8217;t complicated; it can be approached just like an engineering problem — broken into small pieces and thought out. Once the pedagogy is working, it&#8217;s fun to dial things in and optimize your course. As an example, if I teach my Intro class again, I&#8217;m going to be thinking about how I can minimize the amount of one-on-one time students had to spend with me in office hours to be able to work through the material; there&#8217;s a lot of JIT intervention papers I&#8217;ve been reading, and I have tons of ideas floating around.</p><p>I&#8217;d love to hear what other instructors who teach Embedded Systems do in their classes — there&#8217;s far too few published studies on Embedded Systems education, and few instructors block about this stuff. Let&#8217;s get the conversation going!</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/">How I Teach Embedded Systems</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2019/07/26/how-i-teach-embedded-systems/feed/</wfw:commentRss> <slash:comments>17</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">1470</post-id> </item> <item><title>Make your J-Link less annoying with this two-wire 3.3V power hack</title><link>https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/</link> <comments>https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Fri, 18 Aug 2017 07:11:51 +0000</pubDate> <category><![CDATA[Embedded]]></category> <category><![CDATA[J-Link]]></category> <guid
isPermaLink="false">https://jaycarlson.net/?p=986</guid><description><![CDATA[<p>I love the J-Link &#8212; it&#8217;s extremely fast, reliable, and works with basically everything. The J-Link EDU&#160;has been a big...</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/">Make your J-Link less annoying with this two-wire 3.3V power hack</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p>I love the J-Link &#8212; it&#8217;s extremely fast, reliable, and works with <a
href="https://www.segger.com/downloads/supported-devices.php">basically everything</a>. The <a
href="https://www.segger.com/products/debug-probes/j-link/models/j-link-edu/">J-Link EDU</a>&nbsp;has been a big hit with students and hobbyists who just want to get stuff done (instead of messing with open-source debug adapters) &#8212; and at <a
href="http://www.mouser.com/ProductDetail/Segger-Microcontroller/J-Link-EDU/?qs=8mcwQFjNnDX90s7DXoBPKg%3D%3D&amp;gclid=CjwKCAjw_dTMBRBHEiwApIzn_AGWlfPR1Z8G_Wh9Gz2MGnzZHh87giVrqcKPE2LkEjDgGnKmURjH5RoCbmcQAvD_BwE">only $60</a>, it&#8217;s a no-brainer.</p><p>While Segger tried to build a debug adapter that can be everything to everyone, they made some engineering decisions that are well-intentioned, yet somewhat annoying:</p><ul><li><strong>No 3.3V output to power your target.</strong> Even though 99.9% of MCUs you hook up to this thing are going to run off 3.3V, the only voltage output Segger provides is a software-switchable 5V supply (that no vendor IDE allows you to easily enable).</li><li><strong>You must feed the IO voltage level back into VTref.</strong> This allows the fancy logic-level converters to operate at the proper voltage for your target &#8212; which 99.9% of the time is running off 3.3V.</li></ul><p>If you have two wires and a soldering iron, this is easily remedied, though.</p><p>We&#8217;re going to pop off the high-side switch controlling the 5V supply, and repurpose that pin to carry 3.3V from the internal regulator. We&#8217;ll route this to the NC across from VTref so we can bridge it with a standard 0.1&#8243; jumper. Here&#8217;s the game plan:</p><p><img
data-attachment-id="992" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/segger/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/Segger.jpg" data-orig-size="762,387" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="Segger" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/Segger-300x152.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/Segger.jpg" class="aligncenter wp-image-992 size-full" src="https://jaycarlson.net/wp-content/uploads/2017/08/Segger.jpg?cbc196&amp;cbc196" alt="" width="762" height="387" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/Segger.jpg 762w, https://jaycarlson.net/wp-content/uploads/2017/08/Segger-300x152.jpg 300w" sizes="(max-width: 762px) 100vw, 762px" /></p><p>I tried this on my personal EDU version of the J-Link, but this should work great on other J-Link models (which mostly share identical hardware).</p><p>Start by prying open your J-Link by targeting the flexures on the side (don&#8217;t bother popping off the rubber feet or sticker on the bottom &#8212; there&#8217;s no screws under there).</p><p><img
data-attachment-id="990" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/20170817-7929/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170817-7929" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929-1024x684.jpg" class="alignnone wp-image-990 size-full" src="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929.jpg?cbc196&amp;cbc196" alt="" width="2048" height="1367" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7929-1024x684.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /></p><p>Resist your urge to feel angry that you blew lots of money on a microcontroller and some 15-cent level shifters.</p><p>After you crack open the&nbsp;J-Link, you&#8217;ll notice a 3.3V regulator on the right (supplied from USB VBUS). You&#8217;ll notice a transistor in a high-side switch configuration in the top-left next to the screw.</p><p>Simply pop off that transistor (we don&#8217;t want to inadvertently back-feed the 3.3V regulator with 5V!), and solder a wire from the regulator to the connector:</p><p><img
data-attachment-id="995" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/20170817-7937/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937.jpg" data-orig-size="2048,992" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170817-7937" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937-300x145.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937-1024x496.jpg" class="alignnone wp-image-995 size-full" src="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937.jpg?cbc196&amp;cbc196" alt="" width="2048" height="992" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937-300x145.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937-768x372.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7937-1024x496.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /></p><p>Next, flip the board over, and connect pin 19 to pin 2:</p><p><img
data-attachment-id="996" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/20170817-7935/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935.jpg" data-orig-size="2048,1365" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170817-7935" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935-1024x683.jpg" class="alignnone wp-image-996 size-full" src="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935.jpg?cbc196&amp;cbc196" alt="" width="2048" height="1365" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935-768x512.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7935-1024x683.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /></p><p>Put it back together, install a jumper, and use your silliest-looking chicken-scratch handwriting to label your accomplishment:</p><p><img
data-attachment-id="997" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/20170817-7948/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948.jpg" data-orig-size="2048,1666" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170817-7948" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948-300x244.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948-1024x833.jpg" class="alignnone wp-image-997 size-full" src="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948.jpg?cbc196&amp;cbc196" alt="" width="2048" height="1666" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948-300x244.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948-768x625.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/08/20170817-7948-1024x833.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /></p><p>Once it&#8217;s done, you won&#8217;t be needing that bench supply anymore — just wire up your debugger to your target and go!</p><p><img
data-attachment-id="1007" data-permalink="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/20170818-7949/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170818-7949" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949-1024x684.jpg" class="alignnone size-full wp-image-1007" src="https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949.jpg?cbc196&amp;cbc196" alt="" width="2048" height="1367" srcset="https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/08/20170818-7949-1024x684.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /></p><p><strong>Notes:</strong> You can always switch back to an arbitrary VTref by removing the jumper. I didn&#8217;t take the time to try to identify the 3.3V regulator, but given its SOT-23 package, I wouldn&#8217;t pull more than 100 mA from it without inspecting the package for overheating. If you have an older model with an 1117 regulator on it, you&#8217;re good to 800 mA. In any case, use your brain, and remember this hack offers no overload current protection, and if you were to accidentally back-feed this with something other than 3.3V, at best, you&#8217;d fry the regulator, and at worst, you&#8217;d fry the $3 MCU that turns your $300 debugger into a paperweight.</p><p>Happy JTAGing!</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/">Make your J-Link less annoying with this two-wire 3.3V power hack</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2017/08/18/make-j-link-less-annoying-two-wire-3-3v-power-fix/feed/</wfw:commentRss> <slash:comments>12</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">986</post-id> </item> <item><title>Printf-style EFM8 trace messages using a C2 debugger connection</title><link>https://jaycarlson.net/2017/07/16/printf-style-trace-messages-using-c2/</link> <comments>https://jaycarlson.net/2017/07/16/printf-style-trace-messages-using-c2/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Sun, 16 Jul 2017 18:03:41 +0000</pubDate> <category><![CDATA[EFM8]]></category> <category><![CDATA[C2]]></category> <category><![CDATA[Debugging]]></category> <category><![CDATA[Silicon Labs]]></category> <guid
isPermaLink="false">https://jaycarlsonnet.wordpress.com/?p=4</guid><description><![CDATA[<p>A method for printing trace messages to your computer from your EFM8 or C8051F MCUs using the Silicon Labs C2 debugger API.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/07/16/printf-style-trace-messages-using-c2/">Printf-style EFM8 trace messages using a C2 debugger connection</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p>I was over on the Silicon Labs 8-bit MCU forum, where <a
href="http://community.silabs.com/t5/8-bit-MCU/How-to-do-printf-over-C2D-interface/td-p/202756" target="_blank" rel="noopener">someone asked about doing EFM8 printf-style debugging using the C2 debugger connection</a>. I actually faced an identical dilemma a few weeks ago while working on a <a
href="https://www.fastcompany.com/3034239/a-cheap-sensor-to-see-if-clean-water-projects-are-actually-working-as-planned" target="_blank" rel="noopener">smart water sensor</a>. I didn&#8217;t frame the problem in my head the same way the forum post did, because <em>everyone knows it&#8217;s impossible to print messages over a SiLabs C2 debugger connection</em> — but naïveté breeds innovation, and this forum post unwittingly inspired a sudden realization that I could get something hacked together to do exactly what was asked: print trace messages over a debugger connection without any sort of UART.</p><h1>Background</h1><p>There are two common mechanisms for debugging code on a bare-metal MCU platform: on-chip debugging, and tracing. On-chip debugging (OCD) is a powerful technology that lets your computer control execution of the core, set breakpoints, and read/write registers, memory and flash data. Tracing is much simpler — messages are printed to the computer that tell the developer where the MCU is, and what it is doing. If you&#8217;ve used an Arduino before, you are no doubt familiar with tracing, as it&#8217;s your only option for finding problems in your code.</p><p>While I end up using OCD with almost everything I work on, tracing is extremely useful when you&#8217;re interested in studying how your system is behaving <em>in situ</em>; while you can certainly set a breakpoint, wait for the MCU to hit it, and then inspect the value of variables, this will grind the entire platform to a halt, which could have huge ramifications for any time-critical code.</p><p>Tracing is traditionally done through a hardware UART on the MCU; a TTL-level USB-to-serial adapter transfers the data to the computer, which displays it on a terminal. But this requires dedicating an entire (and often the only) UART to this purpose. On a small pin-count MCU, it&#8217;d be nice if we could print trace messages using the same interface we debug with.</p><p>This is not a new idea; in fact, part of the ARM Cortex-M SWD debugging interface specification is SWO — Single-Wire Output — which can be used to print trace messages while the MCU is running. Lower-end ARM cores also have semihosting, which is a similar (but much slower) mechanism.</p><p>This project mimics the SWO/semihosting idea, but my implementation targets the EFM8 and newer C8051F MCUs from Silicon Labs, which uses the Silicon Labs C2 interface for debugging. Having said that, it should be extendable to Microchip/Atmel&#8217;s debugWIRE and ICD debuggers as well.</p><h1>Implementation</h1><p>The overall method can be summarized as:</p><ul><li>Set aside some XRAM at an agreed-upon location.</li><li>The EFM8 writes trace strings into that XRAM using sprintf().</li><li>The EFM8 writes a final byte to the location which contains the number of bytes to read (called the <em>flag</em>).</li><li>The debugger periodically polls the flag until it is non-zero. When it is, it reads that number of bytes, resets flag to zero, formats the data it read as an ASCII string, and displays it.</li><li>The EFM8 waits for the flag to be reset to zero before repeating this process.</li></ul><p>To implement this on the host side, I created a WPF application that calls into the slab8051.dll backend used by Simplicity Studio to communicate with C2 debuggers.</p><p>Most of the API calls were originally from the SiUtil.dll file mentioned in <a
href="https://www.silabs.com/documents/public/application-notes/an117.pdf">AN117</a>, which is a publicly-available DLL designed for users to integrate into their own production software. Unfortunately, the DLL hasn&#8217;t been updated in quite some time, and Simplicity Studio uses a newer debugger firmware version than the SiUtil.dll file supports. Every time you use SiUtil.dll to connect to a debugger, it will download the old firmware image to the debugger. Simplicity Studio will automatically upgrade it back to the latest version — and these two programs will continue to fight over the adapter forever.</p><p><figure
id="attachment_157" aria-describedby="caption-attachment-157" style="width: 1355px" class="wp-caption aligncenter"><img
data-attachment-id="157" data-permalink="https://jaycarlson.net/code_2017-07-17_01-45-01/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01.png" data-orig-size="1355,826" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Code_2017-07-17_01-45-01" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01-300x183.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01-1024x624.png" class="alignnone size-full wp-image-157" src="https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01.png?cbc196&amp;cbc196" alt="Code_2017-07-17_01-45-01" width="1355" height="826" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01.png 1355w, https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01-300x183.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01-768x468.png 768w, https://jaycarlson.net/wp-content/uploads/2017/07/code_2017-07-17_01-45-01-1024x624.png 1024w" sizes="(max-width: 1355px) 100vw, 1355px" /><figcaption
id="caption-attachment-157" class="wp-caption-text">IDA was used to decompile slab8051.dll into a C file, which made it easy to identify the parameters of each method, and how the functions interacted with the target.</figcaption></figure></p><p>Instead, I stumbled upon the slab8051.dll interface that Simplicity Studio uses, and used IDA to decompile it to understand how the DLL is called into. By using the same DLL that Simplicity Studio uses, my application plays nicely with any running instances of Simplicity Studio (though obviously, you can&#8217;t use the app while there&#8217;s a debug session underway, as only one program can connect to the debugger at a time).</p><p>&nbsp;</p><h2>Caveats</h2><p><strong>Polling rate.</strong> Right now, the polling delay is hard-coded to 20 ms. Since the target has to be halted whenever the flag is polled, you want to ensure the MCU has plenty of time to do what it needs to do (suggesting a slow polling rate). At the same time, the longer this delay is, the longer it takes when the MCU <em>does</em> want to send a message to the host. A more efficient method would be to use some sort of multi-message buffer, so that the MCU wouldn&#8217;t have to be polled as often.</p><p><strong>Intrusive connection.</strong> The MCU will be restarted whenever the debugger first connects; sorry, this is how the Silicon Labs API works — there&#8217;s no way to attach to a running target.</p><p><strong>Interrupts Interrupted.</strong> Memory can&#8217;t be read or written to while the MCU core is running, so the software will halt the core before doing any reads/writes. This will certainly have implications with respect to interrupts/etc.</p><h2>EFM8 Code</h2><p>The code on the MCU side is extremely basic, and could be wrapped up into a macro. Here&#8217;s the example:</p><pre class="EnlighterJSRAW" data-enlighter-language="cpp">uint8_t xdata printData[255] _at_ 0x000; /* array at xdata 0x000 */

int main (void)
{
  int i, size;
  enter_DefaultMode_from_RESET();

  while (1)
  {
    i = 0;
    while(1) {
      size = sprintf(printData, "Hello, world #%u!\n", i++); // print "Hello, world #0 (etc)
      printData[254] = size; // tell the computer how many bytes to transfer
      while(printData[254] != 0); // wait for the computer software to reset our flag
    }
  }
}</pre><p>&nbsp;</p><h2><img
data-attachment-id="171" data-permalink="https://jaycarlson.net/devenv_2017-07-17_14-10-14/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14.png" data-orig-size="527,380" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="devenv_2017-07-17_14-10-14" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14-300x216.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14.png" class=" wp-image-171 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14.png?cbc196&amp;cbc196" alt="devenv_2017-07-17_14-10-14" width="501" height="362" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14.png 527w, https://jaycarlson.net/wp-content/uploads/2017/07/devenv_2017-07-17_14-10-14-300x216.png 300w" sizes="(max-width: 501px) 100vw, 501px" /></h2><h2>WPF App</h2><p>I wrote a quick WPF app that demonstrates this functionality, while exposing a few configuration parameters (buffer length, and start address). The source code for the app (along with example firmware) is <a
href="https://github.com/jaydcarlson/c2-printf" target="_blank" rel="noopener">available on GitHub</a>, along with <a
href="https://github.com/jaydcarlson/c2-printf/releases" target="_blank" rel="noopener">binaries</a>.</p><h2>Future Work</h2><p>Interestingly, while looking through the decompiled DLL, I discovered that it&#8217;s actually the DLL&#8217;s job — not the debugger itself — to halt the target before reading/writing memory. I&#8217;m planning on modifying the DLL to see what happens if I try to read/write data on the MCU without halting it first.</p><p>I haven&#8217;t investigated debuggers for other 8-bit MCUs like the PIC, AVR, or STM8, but if they have a publicly-available API that allows you to read and write to memory, I&#8217;d imagine you&#8217;d be able to do the same thing. I have an AVRDragon, PICKit, and ST-Link debugger laying around — I hope I can find some down time to experiment on these other architectures.</p><p>This hack is less useful on ARM, since many ARM MCUs have SWO — but there&#8217;s definitely still some advantages when dealing with low pin-count devices (since SWO requires a separate pin). Also, I don&#8217;t believe SWO is available on the Cortex-M0 MCUs, so I suspect there&#8217;s some space there for a mechanism like this.</p><p>Try it out and leave a comment!</p><p><a
href="https://github.com/jaydcarlson/c2-printf" target="_blank" rel="noopener">GitHub Repo</a></p><p><a
href="https://github.com/jaydcarlson/c2-printf/releases" target="_blank" rel="noopener">Pre-built Binaries</a></p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/07/16/printf-style-trace-messages-using-c2/">Printf-style EFM8 trace messages using a C2 debugger connection</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2017/07/16/printf-style-trace-messages-using-c2/feed/</wfw:commentRss> <slash:comments>1</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">4</post-id> </item> <item><title>Blinking an LED with an original 1980s Intel 8051 microcontroller</title><link>https://jaycarlson.net/2017/06/27/blinking-an-led-with-an-original-intel-8051/</link> <comments>https://jaycarlson.net/2017/06/27/blinking-an-led-with-an-original-intel-8051/#comments</comments> <dc:creator><![CDATA[Jay Carlson]]></dc:creator> <pubDate>Tue, 27 Jun 2017 03:02:17 +0000</pubDate> <category><![CDATA[EFM8]]></category> <category><![CDATA[Embedded]]></category> <guid
isPermaLink="false">http://jaycarlson.net/?p=123</guid><description><![CDATA[<p>The Intel 8051 was the first microcontroller that saw historic, widespread use — now 40 years later, let's bring it back to life, using the latest development tools available.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/06/27/blinking-an-led-with-an-original-intel-8051/">Blinking an LED with an original 1980s Intel 8051 microcontroller</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></description> <content:encoded><![CDATA[<p>The Intel 8051 has a special spot in microcontroller history — not because it was the first (that honor goes to the TMS1802NC calculator-on-a-chip from Texas Instruments), but because the 8051 was the first microcontroller that saw historic, widespread use, and became a de-facto architecture that is still widely used today.</p><p>In fact, unlike the weirdo architectures used in early MCUs, a 1980s-era 8051 is plenty modern to be programmed by current tools. In this post, we&#8217;re going to use completely modern tools (an Eclipse-based IDE running in Windows 10, a recent compiler, a USB programmer) to program a vintage-1980 microcontroller. All we&#8217;ll do is make it blink an LED inside a timer interrupt, but there&#8217;s enough going on that you should be able to develop some intuition around what has and hasn&#8217;t changed in the last 40 years.</p><p>First, a bit of a disclaimer: we&#8217;ll actually be programming the EPROM version of the 8051, called the 8751. Why? An actual 8051 has no on-board programmable flash memory; we would have to wire in a separate EPROM chip, or order mask-programmed versions from Intel. Unfortunately, the 800-number I found in the datasheet for Intel&#8217;s microcontroller division <a
href="http://hackaday.com/2017/06/19/intel-discontinues-joule-galileo-and-edison-product-lines/">seems to have been disconnected</a>.</p><p><figure
id="attachment_147" aria-describedby="caption-attachment-147" style="width: 2048px" class="wp-caption aligncenter"><img
data-attachment-id="147" data-permalink="https://jaycarlson.net/20170716-7622/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170716-7622" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622-1024x684.jpg" class=" size-full wp-image-147 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622.jpg?cbc196&amp;cbc196" alt="20170716-7622" width="2048" height="1367" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7622-1024x684.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /><figcaption
id="caption-attachment-147" class="wp-caption-text">The 87C51 is the EPROM version of the classic 8051 MCU. Note the sapphire window, allowing UV light access to the silicon die for erasing operations.</figcaption></figure></p><h2>Erasing with Light</h2><p><figure
id="attachment_130" aria-describedby="caption-attachment-130" style="width: 387px" class="wp-caption alignright"><img
data-attachment-id="130" data-permalink="https://jaycarlson.net/20170716-7601/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170716-7601" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601-1024x684.jpg" class="wp-image-130" src="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601.jpg?cbc196&amp;cbc196" alt="20170716-7601" width="387" height="258" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/07/20170716-7601-1024x684.jpg 1024w" sizes="(max-width: 387px) 100vw, 387px" /><figcaption
id="caption-attachment-130" class="wp-caption-text">An inexpensive UV box for erasing EPROM devices</figcaption></figure></p><p>Note that the 8751 is an EPROM — <em>not an EEPROM</em> —  device. This means that we program it electrically, but we <em>erase </em>it using UV light. There&#8217;s a small, sapphire window that exposes the die to light. If you recover these devices in the field, they&#8217;ll typically have a piece of tape over the window.</p><p>These ceramic / sapphire packages were very expensive, so you&#8217;ll only see these chips in boutique applications, or for engineering development and testing.</p><p>I found a UV light box specifically designed for erasing EPROM <a
href="https://www.amazon.com/dp/B014ZYWR8O">on Amazon</a>. Dial it in for &#8220;2&#8221; (does that mean &#8220;20 minutes&#8221;?) — either way, it seems to work fine.</p><h2>Development Environment</h2><p>I&#8217;ll be using Simplicity Studio from Silicon Labs as an IDE. It&#8217;s a modern, Eclipse-based tool that runs well in Windows, Linux, and macOS. Simplicity Studio is used to develop firmware for Silicon Labs&#8217; modern EFM8 and EFM32 MCUs, along with their wireless portfolio.</p><p>Since the EFM8 is an 8051-compatible MCU, Simplicity Studio will work perfectly. Simplicity Studio uses Keil C51, the industry-standard 8051 compiler. C51 is a bit archaic in terms of language support — Keil chose to implement C90, and has never gone back to update the compiler to the C99 or C11 standards. If you&#8217;re coming from a more modern compiler, such as gcc, you might be in for a bit of a shock the first time you try to declare a variable in a for() loop — and don&#8217;t forget that Keil C51 has a <a
href="http://www.keil.com/support/man/docs/c51/c51_le_keywords.htm">ton of reserved words</a> not part of the C spec; if you use them for variable names, you&#8217;ll get strange and unhelpful error messages. No biggie — it&#8217;s not like anyone has ever declared a variable named &#8220;<a
href="http://www.keil.com/support/man/docs/c51/c51_le_intdatamem.htm">data</a>&#8221; or anything like that.</p><p>My Keil grievances will have to wait for another day. We&#8217;ve got an LED to blink!</p><h2>Developing the Code</h2><p>We&#8217;ll fire up Simplicity Studio, create a new MCU project, and choose the EFM8BB10F8G. We&#8217;ll use this part because it&#8217;s the closest thing to a &#8220;stock&#8221; 8051 that Silicon Labs makes. Because this is a newer part, Silicon Labs offers a Simplicity Configurator file for it, which we&#8217;ll go with. This will help save a lot of time during development, since we can let the computer do the thinking for us. I selected an SOIC-16 package, but it&#8217;s largely irrelevant; we&#8217;ll be blinking an LED hooked up to P1.0, so I couldn&#8217;t really care less about which physical pinout Simplicity Studio thinks we&#8217;ll be using, as every package should have this pin bonded-out. <em>Be a bit careful with some pins, though, since Simplicity Studio will quietly generate code that disables pins not present on the physical package (to save power).</em></p><p><img
data-attachment-id="135" data-permalink="https://jaycarlson.net/studio_2017-07-16_23-17-01/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01.png" data-orig-size="1374,1090" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="studio_2017-07-16_23-17-01" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01-300x238.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01-1024x812.png" class="size-full wp-image-135 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01.png?cbc196&amp;cbc196" alt="studio_2017-07-16_23-17-01" width="1374" height="1090" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01.png 1374w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01-300x238.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01-768x609.png 768w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-17-01-1024x812.png 1024w" sizes="(max-width: 1374px) 100vw, 1374px" /></p><p>Simplicity Studio is going to give us some grief for not disabling the watchdog timer, or enabling the crossbar. Little does it know that we&#8217;re just leaching off of it to build us a hex file for a 40-year-old MCU we bought off eBay.</p><p>Let&#8217;s configure Timer 0 to be in Mode 1 (16-bit counter), and start it:</p><p><img
data-attachment-id="136" data-permalink="https://jaycarlson.net/studio_2017-07-16_23-20-48/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48.png" data-orig-size="1416,1090" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="studio_2017-07-16_23-20-48" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48-300x231.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48-1024x788.png" class=" size-full wp-image-136 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48.png?cbc196&amp;cbc196" alt="studio_2017-07-16_23-20-48" width="1416" height="1090" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48.png 1416w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48-300x231.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48-768x591.png 768w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-20-48-1024x788.png 1024w" sizes="(max-width: 1416px) 100vw, 1416px" /></p><p>Now let&#8217;s head over to the Interrupts peripheral, enable Global Interrupts, Timer 0 Interrupt, and make sure &#8220;Generate Interrupt Functions&#8221; is enabled:</p><p><img
data-attachment-id="137" data-permalink="https://jaycarlson.net/studio_2017-07-16_23-21-52/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52.png" data-orig-size="1416,1090" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="studio_2017-07-16_23-21-52" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52-300x231.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52-1024x788.png" class=" size-full wp-image-137 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52.png?cbc196&amp;cbc196" alt="studio_2017-07-16_23-21-52" width="1416" height="1090" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52.png 1416w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52-300x231.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52-768x591.png 768w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-21-52-1024x788.png 1024w" sizes="(max-width: 1416px) 100vw, 1416px" /></p><p>Once you&#8217;re done <strong>save the hwconf file by hitting Ctrl-S</strong>. This will automatically generate all the initialization code, as well as the interrupt stubs.</p><p>Now we actually have to write a bit of code in our <strong>Interrupts.c</strong> file:</p><p>[cpp]<br
/> SI_INTERRUPT (TIMER0_ISR, TIMER0_IRQn)<br
/> {<br
/> P1_B0 = !P1_B0;<br
/> TCON_TF0 = false;<br
/> }<br
/> [/cpp]</p><p>A lot of the 8051&#8217;s SFRs are bit-addressable, which makes this a breeze. No, there&#8217;s no compiler trickery going on — that code is going to get compiled into CPL (complement bit) and CLR (clear bit) instructions.</p><p>You may be wondering how we&#8217;re using a GPIO pin without making it an output first. Unlike other architectures, the 8051 defaults to a quasi-bidirectional I/O scheme; if we write a 0, the pin will sink as much current as it can; if we write a 1, the pin will float up to VDD, via internal pull-up resistors. And if you want to make a pin an input, write a &#8220;1&#8221; to it to pull it up, and then read from it as usual. It&#8217;s an elegant, ingenious default that I&#8217;ve grown to love over the years.</p><p>We built the program. It&#8217;s 49 bytes long (this includes all the C startup code, timer init code, etc). Gotta love CISC architectures!</p><p><img
data-attachment-id="138" data-permalink="https://jaycarlson.net/studio_2017-07-16_23-27-39/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39.png" data-orig-size="1060,248" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="studio_2017-07-16_23-27-39" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39-300x70.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39-1024x240.png" class=" size-full wp-image-138 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39.png?cbc196&amp;cbc196" alt="studio_2017-07-16_23-27-39" width="1060" height="248" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39.png 1060w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39-300x70.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39-768x180.png 768w, https://jaycarlson.net/wp-content/uploads/2017/07/studio_2017-07-16_23-27-39-1024x240.png 1024w" sizes="(max-width: 1060px) 100vw, 1060px" /></p><p><figure
id="attachment_145" aria-describedby="caption-attachment-145" style="width: 2048px" class="wp-caption aligncenter"><img
data-attachment-id="145" data-permalink="https://jaycarlson.net/20170717-7649/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649.jpg" data-orig-size="2048,1367" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="20170717-7649" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649-300x200.jpg" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649-1024x684.jpg" class=" size-full wp-image-145 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649.jpg?cbc196&amp;cbc196" alt="20170717-7649" width="2048" height="1367" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649.jpg 2048w, https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649-300x200.jpg 300w, https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649-768x513.jpg 768w, https://jaycarlson.net/wp-content/uploads/2017/07/20170717-7649-1024x684.jpg 1024w" sizes="(max-width: 2048px) 100vw, 2048px" /><figcaption
id="caption-attachment-145" class="wp-caption-text">The TL866A programmer can flash seemingly every memory chip and MCU ever made, including our 40-year-old Intel 87C51.</figcaption></figure></p><h2>Programming the 8051</h2><p>I bought <a
href="https://www.amazon.com/dp/B00K756PB6">one of these TL866A MiniPro universal programmers on Amazon</a>. It seems to do the business, and supports a wide range of devices. The official software is Windows-only, but there&#8217;s an <a
href="https://github.com/vdudouyt/minipro">open-source *nix-friendly command-line utility</a>. I selected the Intel 87C51, and did a <strong>Device &gt; Read</strong> to ensure the MCU was erased:</p><p><img
data-attachment-id="139" data-permalink="https://jaycarlson.net/minipro_2017-07-16_23-29-39/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39.png" data-orig-size="771,574" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="MiniPro_2017-07-16_23-29-39" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39-300x223.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39.png" class="size-full wp-image-139 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39.png?cbc196&amp;cbc196" alt="MiniPro_2017-07-16_23-29-39" width="771" height="574" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39.png 771w, https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39-300x223.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-29-39-768x572.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></p><p>Looks good. Let&#8217;s program it:</p><p><img
data-attachment-id="141" data-permalink="https://jaycarlson.net/minipro_2017-07-16_23-32-07/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07.png" data-orig-size="771,574" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="MiniPro_2017-07-16_23-32-07" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07-300x223.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07.png" class="size-full wp-image-141 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07.png?cbc196&amp;cbc196" alt="MiniPro_2017-07-16_23-32-07" width="771" height="574" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07.png 771w, https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07-300x223.png 300w, https://jaycarlson.net/wp-content/uploads/2017/07/minipro_2017-07-16_23-32-07-768x572.png 768w" sizes="(max-width: 771px) 100vw, 771px" /></p><p>Good to go!</p><h2>Hooking It Up</h2><p>Alright, now it&#8217;s time to put the MCU on a breadboard and see if it works. Here&#8217;s a pinout of the chip:</p><p><img
data-attachment-id="142" data-permalink="https://jaycarlson.net/8051/" data-orig-file="https://jaycarlson.net/wp-content/uploads/2017/07/8051.png" data-orig-size="445,575" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="8051" data-image-description="" data-medium-file="https://jaycarlson.net/wp-content/uploads/2017/07/8051-232x300.png" data-large-file="https://jaycarlson.net/wp-content/uploads/2017/07/8051.png" class="size-full wp-image-142 aligncenter" src="https://jaycarlson.net/wp-content/uploads/2017/07/8051.png?cbc196&amp;cbc196" alt="8051" width="445" height="575" srcset="https://jaycarlson.net/wp-content/uploads/2017/07/8051.png 445w, https://jaycarlson.net/wp-content/uploads/2017/07/8051-232x300.png 232w" sizes="(max-width: 445px) 100vw, 445px" /></p><p>Few funny things to note:</p><ul><li>Reset (RST) is <strong>active high</strong>, not active low as it is on modern MCUs. Use a pull-down resistor to ground on the pin.</li><li>No internal power-on-reset circuitry; you&#8217;ll need to use a big capacitor — like a 10 uF — hooked between the reset pin and 5V. This will briefly assert the reset signal when the chip is powered on.</li><li>External access enable (EA) must be tied to 5V (i.e., de-asserted) for the MCU to execute code from internal EPROM memory; otherwise, it will attempt to execute code from the external memory bus.</li><li>There&#8217;s obviously no sort of internal oscillator on this chip; build a crystal oscillator or ceramic resonator circuit, and attach it to XTAL1 and XTAL2. I used a 6 MHz crystal; much faster, and your blinking LED will give you a seizure.</li><li>Recall that the LED is attached to P1.0 (pin 1) — make sure to wire it in an open-drain (sinking) configuration; i.e., the anode should be wired to 5V, and the cathode should be wired to the MCU pin (through a resistor).</li></ul><p>Here&#8217;s a video of the results of my breadboarding:</p><p><iframe
class='youtube-player' width='1170' height='659' src='https://www.youtube.com/embed/2YQ2wdr0g28?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p><h2>Wrap-Up / Why does this work?</h2><p>It may seem perplexing that I can take a hex file meant for a modern, 3.3V MCU from 2017 and dump it on a 40-year-old MCU made by a different company — all without altering a single bit or doing any sort of trickery. Did I leave out some steps? Not at all; that&#8217;s just the nature of the 8051. We can get away with this because an &#8220;8051-compatible&#8221; MCU is simply an <em>extension</em> of the original architecture; not a reworking of it. In other words, the EFM8 has the same Timer0 as the original 8051 does; its Timer0 is at the same base address, and has the same configuration registers to configure it to do the same things. The EFM8 has the same GPIO port structure, with the same GPIO registers at the same GPIO addresses.</p><p>So if you program the EFM8, are you working with an obsolete dinosaur? Not at all! The EFM8 extends the original 8051 by adding a ton more timers and PWM capabilities, plus more than a dozen channels of 12-bit ADC conversion. Some EFM8s have 12-bit DACs, USB functionality, and can run at up to 72 MHz. Silicon Labs has completely pipelined and optimized the original 8051 core, too, so an EFM8 runs dozens of times faster than an 8051 running off the same clock speed. Oh, and it&#8217;s really, really, <em>really</em> low power.</p><p>The 8051 is probably the only true cross-manufacturer MCU architecture. Anyone who&#8217;s done ARM programming is grimacing right now. You probably thought that ARM Cortex-M programming would be great to learn, since so many manufacturers build ARM Cortex-M microcontrollers. What everyone forgot to tell you is that ARM Cortex-M is just a core; the moment you want to actually <em>do something </em>with that microcontroller, you&#8217;ve got to access GPIO, UART, SPI, I2C, Timers, and all sorts of other peripherals — and all of these (alright, <em>almost</em> all of these) are manufacturer-specific. So every time you switch to a different ARM microcontroller, you get to learn an entirely new set of peripherals. This is simply not true with the 8051.</p><p>It&#8217;s what makes it a great architecture to learn — in 1980, or in 2017.</p><p>The post <a
rel="nofollow" href="https://jaycarlson.net/2017/06/27/blinking-an-led-with-an-original-intel-8051/">Blinking an LED with an original 1980s Intel 8051 microcontroller</a> appeared first on <a
rel="nofollow" href="https://jaycarlson.net">Jay Carlson</a>.</p> ]]></content:encoded> <wfw:commentRss>https://jaycarlson.net/2017/06/27/blinking-an-led-with-an-original-intel-8051/feed/</wfw:commentRss> <slash:comments>9</slash:comments> <post-id
xmlns="com-wordpress:feed-additions:1">123</post-id> </item> </channel> </rss>