Thursday, August 13, 2026

Quotes - Engineering

“If you were plowing a field, which would you rather use: two strong oxen or 1024 chickens?”
— Seymour Cray
  
"... AI won't replace people, but maybe people that use AI will replace people that don't."
 - Andrew Ng, 2024 
 
"My Favorite Programming Language is Solder."
- Steve Ciarcia
Also atrributed to Bob Pease, Terry Pratchett, and others 
  
"Every year there are 200,000 Chinese engineering graduates, and they don’t know what we know. We can solve problems they cannot.” 
- Robert A. Pease, Analog Circuits: World Class Designs, 2008
 
"... there's no patent on intellectual capability."
- Jim Williams, Interview with Bob Dobkin and Jim Williams April 19, 2006
Silicon Genesis: Oral Histories of Semiconductor Technology
 
"I may be the only person at an electronics flea market who will pay more for the busted stuff!"
- Jim Williams, The Importance of Fixing,  
The Art and Science of Analog Circuit Design

"No one believes an analysis – except the person who did it.
Everyone believes a test – except the person who did it."
- ???

‘‘The best way to predict the future is to invent it.’’
 - Alan Kay

“Successful engineering is all about understanding how things break or fail.”
- Henry Petroski

"engineering ... is the art of doing that well with one dollar, which any bungler can do with two after a fashion."
- Arthur M. Wellingtony, The Economic Theory of the Location of Railways

"Engineer - the man who can do for a reasonable cost what another would expend a fortune on"
- Rutherford Aris, Vector, Tensors and the Basic Equations of Fluid Mechanics 

“In God we trust. All others bring data.”
- Bo Lojek, History of Semiconductor Engineering

"Research is when you don't know what you're doing."
- ??? 

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”
- Antoine de Saint-Exupéry, Airman's Odyssey
 
The cheapest, fastest, and most reliable components are those that aren’t there.
- C. Gordon Bell

"When you test you find something is wrong."
- Donald Trump (May 14, 2020, about the COVID tests)

I would rather have a general who was lucky than one who was good.

- Napoleon Bonaparte

"Perfect is the Enemy of Good Enough"
- Eric Johns (October 1988), U.S. Naval Institute Proceedings: 37

“If an expert says something can be done he is probably correct, but if he says it is impossible then consider getting another opinion.”
- Richard Hamming, The Art of Doing Science and Engineering 

People who are really serious about software should make their own hardware.
- Alan Kay

The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. […] Hence plan to throw one away; you will, anyhow.

Brooks's Law: 
Adding manpower to a late software project makes it later.

The Second-System:

    This second is the most dangerous system a man ever designs. 

 - Brooks, The Mythical Man Month

... this was going to be one of these Onion Syndrome deals - you peel off a couple layers, and cry; then you peel off a couple more layers, and cry some more.
- Bob Pease, What's All This Ground Noise Stuff, Anyhow?

Thinking is recommended. Heck, thinking is required.
- Bob Pease, Troubleshooting Analog Circuits

... a little known tenet of precision op amp circuits: Williams's Rule.  Williams's Rule is simple: always invert (except when you can't).
- Jim Williams, Analog Circuit Design: Art, Science, and Personalities


"Any idiot can count to ONE ..."
- Quoted by Samuel Wilensky in Analog Circuit Design: Art, Science, and Personalities
(maybe attributed to Bob Wildar)

Anyone can build a bridge that stands up, but only an engineer can build a bridge that just barely stands up.
- ????

"A user interface is like a joke – if you have to explain it, it's not that good."
- ????
 
In software, debugging is harder than writing code.  If you write the code as clever as you can, then you are not smart enough to debug it.
- ????

All problems in computer science can be solved by another level of indirection, except for the problem of too many layers of indirection.
-????

... practicing what was called "the mushroom theory of management." ... defined it as follows: "Put 'em in the dark, feed 'em shit, and watch 'em grow."
- Tracy Kidder, The Soul of A New Machine

Hardware eventually fails. Software eventually works.
-Michael Hartung

Quotes - Math and Science

 
"Even Hilbert had only a few tricks!"
- Gian-Carlo Rota, "Ten Lessons I Wish I Had Been Taught", 1997 
 
“Good, He did not have enough imagination to become a mathematician.” 
- David Hilbert, after learning that a student in his class had
dropped the subject in order to become a poet.
(David Darling, The Universal Book of Mathematics 
 
"How can you do physics and poetry at the same time? The aim of science is to make difficult things understand able in a simpler way; the aim of poetry is to state simple things in an incomprehensible way. The two are incompatible." 
- Dirac once said to Oppenheimer
(Helge Kragh, "Dirac: A Scientific Biography")  
  
"A good building should not show its scaffolding when completed."
"No self-respecting architect leaves the scaffolding in place after completing his building."
- Gauss  
 
“There’s a tradition of scientists approaching senility to come up with grand, improbable theories. Wolfram is unusual in that he’s doing this in his 40s.” 
- Freeman Dyson told Newsweek in 2002 
 
"If I had to choose one book to take to a desert island, I would take Zygmund’s Trigonometric Series if I thought I might be rescued, but Hardy and Wright’s Number Theory if I knew that I was never coming back." 
 - T.W.  Körner, Foreword to A Course of Pure Mathematics, 2008
  
"... true knowledge can only be acquired piecemeal, by the patient interrogation of nature."
- Edmund Whittaker, A History of the Theories of Aether and Electricity

"The first time you go through the subject, you do not understand it at all. The second time, you think you understand it, except for one or two small points. The third time, you know that you do not understand it, but you are so used to the subject that it does not bother you anymore."
- Arnold Sommerfeld, about thermodynamics

"All science is either physics or stamp collecting."
- Ernest Rutherford

"those who can, do; those who can't, teach."
George Bernard Shaw, Man and Superman

"Research is when you don't know what you're doing."
- ??? 

In real estate, it is location, location, location.  In mathematics, it is notation, notation, notation.
- ????
 
... where there is no confusion there is no prestige.
-Linderholm, Mathematics Made Difficult

Wednesday, August 12, 2026

Review of Computer Architecture Seventh Edition

 We had discussed the six editions of the authoritative text on computer architecture.  Eight years after the 6th edition, we have the 7th edition published in October 2025.  A quick scan of the table of content seems to show few new topics.  There is no large increase of page counts, only about 40 pages.  A third author is added. The famous processor performance chart is extended by a few years, but only to 2022 and the performance increases from 2015 is revised up to 9% a year (from 3.5%).  The top processor at 2017 is Intel Core i7 4.2GHz with performance score of 49,935, and at 2022 Intel Xeon E-2388G 3.2GHz with score 88,833.  Note the performance increase of 80% while the clock speed actually goes down (though the boost speed is a little higher).  The Moore's law seems to continue but performance increase has been significantly curtailed since 2004 when the Dennard's scaling law ended.

 What has been going on in this eight years?  The emergence of AI, represented by ChatGPT that made debut in 2022 is the most significant.  There is a mad dash to adopt AI in every industries and in everyday life.  And datacenters that support AI are being built in a such scale that causes shortage in chips and propels NVidia to one of the most valuable companies.  The vulnerability of computer architecture to malicious attack such as Meltdown and Spectre stunned computer architecture community.  The bedrock of the modern processor techniques of cache memory and speculative execution can be exploited.  The security issues are addressed in the new edition: side-channel attacks on the memory system and speculative and multithreading execution unit. With this the authors admonish the lack of adequate tools to address the security issues in processor design.

The chapter on warehouse-scale computing debuted in the fifth edition (2011) (as the book cover starts to show cloud).  The discussion always seems to me having been a little weak.  That situation has largely been remedied in this new edition.  But curiously, the concept of request-level parallelism, coined when the WSC was first introduced is merged into thread-level parallelism, as the cores become more numerous.

And the chapter on domain-specific architecture debuted in the sixth edition (2017) has shown significant improvements.

 Despite of many clever architectural innovation, the quantitative aspect of the computer design still seems naive.  The mathematical tools are so elementary (as in only elementary school arithmetic).  Perhaps we need to introduce more sophisticated tools or language to model computer architecture more precisely. Queuing theory was introduced briefly related to storage system.

 The realization of the similarities between vector processors and GPUs is significant. It bridges the two seemingly disparate concepts and allows a more uniform discussion, using the traditional language of computer architecture to discuss the GPUs which have evolved their own terminologies, unfamiliar to the outsiders.  As the GPUs break through the original 3D graphics accelerator to more general high-performance computing, that is especially suited for the AI processing.  And the GPUs have introduced low resolution float number computing unit particularly targeted the AI applications.

Thursday, May 7, 2026

Tatung Rice Cooker

The Tatung Rice Cooker is legendary.  It is durable, easily lasting twenty or thirty years.  Its construction is very simple and rugged, devoid of fancy electronics.  Currently it commands of a price of $200, several times that of the competitors.  But it often fails in a rather simple way: the power cord.  The power cord can break near the plug at the strain relief, at the entry point to the interior because of repeated twisting and flexing and the ring terminals inside because of rust (the neutral terminal seems more likely to rust, why is that?).  Replacing the power cord can extend its life for many more years.  The repair is simple.  Once the bottom cover held by one screw is removed, the wiring is clearly shown.  Note that the fiberglass sleeves are placed over the power cord wire.  The insulation has to withstand high temperature, so choose the power cord with temperature rating of 105°C.

The circuit diagram probably looks like this,

Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings
Ink Drawings

The temperature control is achieved by a magnetic switch.  When  the lever is pushed, the magnets close the springy electric contacts to power the heating coil.  The heating coil is about 18 Ohms, which is about 800W at 120V, which is the rated power.  When the coil heats up, the resistance increases and the power settles down about 740W.  The coil is completely sealed to prevent oxidation. When the water evaporates, the temperature goes up rapidly and the magnet loses magnetic field and breaks the contact.  It can be verified that the switch does not close immediately afterwards.  When the temperature is below the magnet's Curie temperature, this demagnetization is reversible.  Because the temperature drops when the contact is broken, the magnet does not lose the magnetization permanently.  The Curie temperature is 450°C for ferrite magnet.  The switch is open at about 220°C and the magnet regains its magnetic field below 160°C.

There is also a keep-warm switch, which adds a resistor (about 380 Ohms) to the coil and reduces the heating power (to about 35W) and keeps temperature around 50°C.

  

Sunday, February 22, 2026

Port MicroPython to PolarFire SoC

 We have built MicroPython for STM32F429DISC previously.  We'll use it as a guide to port MicroPython to MPFS Discovery Kit and Beagle-V Fire, featuring PolarFire SoC.  It is straightforward to compile for the minimal configuration.  We aim to achieve the same functionalities as STM32F429DISC.  In the hardware-wise comparison, the shortage of non-volatile memory can be overcome by using a micro-SD card.  PolarFire RISC V supports both single and double precision floating point; STM32F429 supports only single precision. 

STM32F429I-DISC1MPFS-DISCO-KITBeagle-V Fire
CPUCortex-M4FQuad RV64IMAFDCQuad RV64IMAFDC
Flash2M128K128K
SRAM256K1.8M1.8M
SDRAM8M1G2G
eMMC--16G
SPI Flash--16M
Debug/ProgST-LINKFlashProFlashPro
USB-UART133
Ext Headers2x 2x32RPi + MikroBusBeagle Cape 2x 2x23
ConnectorsMIPI CSIM.2 PCIe, MIPI CSI, QSH-40
ADC Channels24?-7
DAC Channels2--
User LEDs2812
Push Buttons222
Dip Switches-8-
SensorMEMS gyro--
USBOTG-OTG
Ethernet-1 GigE1 GigE
Display2.4" QVGA LCD touch--
Ext Storage-microSDmicroSD

The STM32F429DISC build includes the following modules.

>>> help('modules')
__main__          builtins          json              select
_asyncio          cmath             machine           socket
_onewire          collections       math              stm
array             deflate           micropython       struct
asyncio/__init__  dht               network           sys
asyncio/core      errno             onewire           time
asyncio/event     framebuf          os                uasyncio
asyncio/funcs     gc                platform          uctypes
asyncio/lock      hashlib           pyb               vfs
asyncio/stream    heapq             random
binascii          io                re
Plus any modules on the filesystem

The MicroPython does not seem have a good way to manage configurations.  The #define parameters that affect the build can come from a number of places, many include files and many makefiles.  And the dependencies are not always clear.

First MICROPY_CONFIG_ROM_LEVEL can range from minimum, core, basic, extra to full, which enables more feature.  We can change it from minimum to extra.  This enables the majority of features, including compiler, stack check, helper REPL, EMACS keys in REPL, scheduler, micropython module, etc.  

 Then we add the additional options enabled by STM32.  We include FROZEN_MANIFEST, which requies in the micropython-lib submodule.  We enable VFS, which turns out have some tricky dependencies.  We have to define MICROPY_VFS_FAT in the makefile in order to bring in the oofatfs.  This compiles to about 300K (text+data).  STM32 uses a portion (112K out of 2M) of its Flash to make a file system that stores initialization files like "boot.py" and "main.py". We will make use of the micro SD card.

 Next, we want to enable floating number.  We run it on one of the application cores that support floating number.  We set MICROPY_FLOAT_IMPL to double in the makefile.  This causes additional variable to be set.  This compiles to 360K and the math module is available.

We enable the machine module by defining MICRO_PY_MACHINE.  The machine module supports peripherals such as uart, spi, i2c, timer etc; board specific code has to be write to make them work. Additional python modules can be added to manifest.py.  We also include the network module.  Another useful module in STM32 is stm, which provides access to peripheral registers and we implement a similar module. The compiles to 430K.

At this point, we have the following modules,

>>> help('modules')
__main__          builtins          json              select
_asyncio          cmath             machine           socket
array             collections       math              struct
asyncio/__init__  deflate           micropython       sys
asyncio/core      errno             mpfs              time
asyncio/event     framebuf          network           uasyncio
asyncio/funcs     gc                os                uctypes
asyncio/lock      hashlib           platform          vfs
asyncio/stream    heapq             random
binascii          io                re

Now we have to write some actual code.  As a warm-up, we first add the LED class to the machine module.  Extra classes can be added by defining MACHINE_EXTRA_GLOBALS in the port modmachine.c, which is inserted into extmod/modmachine.c.  STM32 has a separate module, pyb, that contains the LED and other devices with some overlap with machine.  We can borrow code from STM32 and only change the GPIO code.  There are 8 user LEDs that can now be controlled by from Python.

Before we add the drivers for the other peripherals, GPIO, SPI, I2C, UART, Timers, we want to look into the Micropython compilation and assembly code for RISC-V by defining EMIT_RV32 and EMIT_INLINE_RV32.  MicroPython can emit native code instead of byte code.  The decorator @micropython.asm_rv32 seems to work; as example,

>>> @micropython.asm_rv32
... def mul(a0,a1):
...     mv(t0,a0)
...     mv(t1,a1)
...     mul(a0,t0,t1)
...
>>> mul(5,10)
50

But @micropython.native does not. It crashes when running the function with that decorator; the cause of the crash is illegal instruction.  Interestingly, it does not work on STM32 either.   EMIT_THUMB_ARMV7M is enabled by default, but disabling it does not solve the problem.  We'll have to investigate further.  In addition, we need to extend to support RV64.

 


 

Thursday, February 12, 2026

Sinusoidal Oscillator on PSoC

Sinusoidal signal can be generated with the wave DAC and low pass filter.  But here we will attempt to generate sine wave the analog way.  We will use a servo loop to stabilize the adjustable amplitude.

As a warm-up, we will try the simple classic Wien bridge oscillator using one PSoC opamp and a miniature light bulb.  The bulb has a resistance of 67 Ohms cold and 170 Ohms at 6mA.  It produces a nice sine signal.  




Friday, February 6, 2026

Troubleshooting a Quartz Clock

 A twenty-five year old quartz clock stopped working.  I'm curious to see what has failed.   Opening up the clock, we see a simple one-layer PCB with a COB (chip-on-board), a crystal, a transistor and a magnetic buzzer.  The clock movement comes from the stepper motor with a coil resistance of 545Ω; the coil is driven in the alternative directions every second.  A number gears form the hour, minute and second hand.  The alarm is set with another gear that causes a spring loaded contact to short out two pads when the hour hand coincides with the alarm hand and as the hour hand moves it pushes the contact away from the pads to stop the buzzer.

The clock was not completely dead.  Occasionally, it started, but it would soon stop moving.  All the electrical connections seemed OK.  To be sure of no cold soldering joints, I reflowed all the joints.  I probed all the connections that were possible to get to and it appeared that the voltages were getting to the circuit; both the stepper coil terminals sat at the rail and there were bias voltages on the quartz crystal terminals.  I could not see any obvious wrong.  During the course of troubleshooting, despair set in the first time.  Where should I go from here?

We stepped back and asked, what could possibly go wrong for 25-year old device?  Nothing on the electronics side: the COB was unlikely, the crystal might age and be out of frequency spec but not dead, and the buzzer was irrelevant.  It was more likely the wear-and-tear of the mechanical parts. 

Now I started to take apart of more the mechanical parts.  The gears seemed free to move, so I should see some movement if the electronics were driving it.  I could eventually rule out mechanical issues by noting that some voltages for the alarm were not at the correct values.  The voltages at the crystal leads would be stuck at a higher values and the voltages to the motor coil was static when compared with when it was running (the pulse to the motor was brief but still visibly to the multimeter). It implied the clock was not oscillating and the circuit did not start.  I even replaced the crystal with another one that came from a digital watch, but it did not work.  It was progress but still frustrating.

After somewhat aimlessly and repeatedly probing, I noticed that it could consistently start when the multimeter leads were placed between one of the crystal lead and the negative terminal of the battery.  I could observe the voltage decreasing from around 1V to 0.7V.  Curiously, on the PCB, there is an unpopulated footprint between the crystal lead and the negative terminal of the battery.  So perhaps placing a 10MΩ resistor and/or some capacitor there might work.  And putting the leads on the other crystal terminal stopped the clock.  However, after started, the clock would stop after a short time and leaving the probes on the circuit would not keep it running.

But why would it need an extra capacitor now?  Is aging a factor?  Has the oscillator circuit deteriorated?  Accumulation of dust or FOD causes leakage or stray capacitance?   Here we went back to the fundamentals: how does a crystal clock work?  Quartz is a pure SiO2 crystal with the piezoelectric property, i.e. an electric field physically deforms the crystal structure and vice versa.  There is a restoring force that would result in vibration.  

So dust and FOD are a strong hypothesis.  A thorough cleaning of the PCB with 99% isopropyl alcohol miraculously worked; now it could consistently start.