Posts

Intel RapidCAD

Image
    A few years ago, on an online marketplace, I came across a lot with a bunch of old processors. They were being sold for scrap to chemically extract the gold. Among the usual P1, brown Athlons, and green Celerons, something unfamiliar caught my eye - an Intel chip marked RapidCAD. Although I've been familiar with the x86 architecture since the 8088 days, it was my first time encountering such a processor. At first, I thought it was something specialized: perhaps a cache controller, some kind of ARM, or an i960. But an internet search really surprised me. It turned out to be a full-fledged x86 (that very rare upgrade for 386 boards), the existence of which I hadn't even suspected before.    I wonder why the first chip was made in the USA, and the second one in Malaysia?

Emulating EEPROM in CH32V003 Internal Flash

Image
Looking at this diagram, we can see 4 blocks of flash memory: Option Bytes (Configuration Bytes) : 64 bytes (addresses 0x1FFF F800 – 0x1FFF F83F ). Reserved for static hardware settings of the microcontroller (for example, flash memory read protection). Additionally, the block contains two free bytes ( Data0 and Data1 ), which developers can use to store their own settings. Vendor Bytes (Calibration Data) : 64 bytes (addresses 0x1FFF F7C0 – 0x1FFF F7FF ). The block programmed during manufacturing and is accessible only for reading. It contains the unique chip identifier (ID) and important factory calibration values for the ADC (ADC) and internal oscillators (HSI/LSI). System Flash (Bootloader) : 1920 bytes (addresses 0x1FFF 0000 – 0x1FFF 077F ). This block contains the system bootloader, also programmed at the WCH factory once and permanently locked against user erasure or modification. Main Memory (Code Flash) : 16 KB in CH32V003 (addresses 0x0800 0000 – 0x0800 3FFF ). This ...

How to Use the Built-in Operational Amplifier in CH32V003

Image
The CH32V003 microcontrollers (as well as the CH32V006) feature a very interesting piece of hardware - a built-in operational amplifier (OPA). In this article, I will explore and practically demonstrate how to use it for measuring small voltages, such as reading data from various sensors or current shunts. Before we get to soldering, let’s take a quick look at the architecture. The built-in OPA has multiplexed inputs, meaning it can be software-switched to take a signal from different pairs of pins. For example, the TSSOP20 package offers two groups: Group 0 ( PA1 — OPN0, PA2 — OPP0) and Group 1 ( PD0 — OPN1, PD7 — OPP1). However, the output always remains the same — it is hardwired to the PD4 pin (OPO). The situation is slightly different with the smaller chips in the SOP8 and SOP16 packages. The multiplexing mechanism is still present in the silicon, but the required pins are simply not physically broken out, so there are effectively no switching options. (By the way, there is...

Understanding Rotary Encoders: Teardown, Oscilloscope Signals, and C Code for CH32V

Image
A Bit of Theory An encoder is an electromechanical component that helps electronics determine the speed and direction of a shaft’s rotation, and in some cases, accurately register its angular position. Therefore, if your project involves moving parts and you need to track their rotation or angle, you cannot do without this sensor. We don’t need to look at complex industrial machinery for examples - we encounter encoders constantly in everyday life. A computer mouse wheel, a car stereo volume knob, or a washing machine mode selector - all of these are convenient physical interfaces for interacting with technology. The simplest encoders can only register movement. In the case of a mouse, we don’t care about the exact position of the wheel - we just scroll it up or down to scroll the page. But for some processes, the exact position is crucial, which is where more complex absolute encoders are used. By design, these sensors are based on various physical principles. Inside, there migh...

Available WCH-Link Programmers

Image
Wch-Link V1 When I first paid attention to CH32V microcontrollers on AliExpress, I immediately bought a few different boards: a couple with the CH32V003 and a more powerful one with the CH32V307. However, a logical question immediately arose: how do I program them? My usual ST-Link definitely wouldn’t work for this architecture. So, I just found the first available programmer with the WCH label from the same seller and added it to my order. It turned out to be the WCH-Link v1, based on the CH549G chip. Its pros: Relatively low price: during sales, you can find them starting at $2. Versatility: it supports both RISC-V based WCH microcontrollers and ARM-compatible chips in DAP mode (although I haven’t tested the latter in practice yet). Built-in USB-UART: this is incredibly convenient for debugging, and it’s a feature I often missed in the standard ST-Link. However, there were also downsides that came as an unpleasant surprise. The main drawback is that it does not program th...