Search This Blog

Wednesday, March 13, 2024

The dreaded KB5034441 - what actually worked for me

Normally I don't talk much about fixing Windows problems as the tech blogs are a dime a dozen.  However, I have yet to find one that fixes the "0x80070643 - ERROR_INSTALL_FAILURE" with KB5034441. They seem all point to the WinRE partition wasn't sized sufficiently and each of them parroting the same stuff.  

I have resize the partition, but it still fails the update.  I have tried the PatchWinREScript_2004plus.ps1 from Microsoft, but it returned with a bunch of errors.  Obviously isn't fool proof enough for the end users.  I even ask Microsoft Copilot AI for a detail step by step instructions and it still isn't enough as there were errors in some of the steps.

I tried a whole bunch of things unsuccessfully and my WinRe was disabled.  I went through the usual long list of instructions trying to restore it manually e.g. extracting install.wim etc, but given up before I would do more damages. It is like a never ending quest like 50+ hours RPG with each quest requiring completing additional subtasks and no one have any up to date info.

What actually worked for me was to simply reinstall Windows. Obviously this is with the increased WinRe partition to 800MB and the install option of preserving the data and apps. This is the one with the least user interaction required, but no one else suggested this.

I let it install all the updates again and finally the dreaded KB installed properly. Whatever prerequisites that was broken along the way is now back to what they expect.  Don't forget to do a disk clean up for the old windows install and change back all your preferences that Windows like to muck with.

When in doubt, reinstall Windows.  :P



Sunday, January 21, 2024

CH341A Pro Serial PROM Programmer mods

The CH341A Pro Serial PROM Programmer is low cost programmer based on the CH341 USB Serial chip with special protocol modes for I2C and SPI.  A good source for the hardware info for the programmer is here

Some of the modifications are well documented on the eevblog. I cleaned up the mods and added a few.

Programmer modified for 3.3V

The programmer is modified for 3.3V I/O voltages as the ZIF socket is wired for 3.3V (see J3).

  • Vcc at pin 28 - connected to 3.3V (Required).  The CH431 chip I/O rail is set to the 3.3V supply from U1.

    Modification to PCB

    Side view of the modification

  • V3 at pin 9 - connected to 3.3V (Recommended by datasheet).  The internal 3.3V regulator for USB should be connected to the external source if Vcc is running from 3.3V.  I have measured the voltage at V3 and it is pretty closed to 3.3V, but modified it anyways as it is easy.
    V3 connected to metal tab of U1 - 3.3V regulator output


  • RN1C - connected to 3.3V (Optional).  The power LED (D1) is too bright because it is connected to 5V instead of 3.3V like D2.  The power LED now has similar brightness as D2.

Top trace: Resistor pack pull up that was connected to 5V
Bottom trace: 3.3V from U1 regulator

I have made a small plug for the programming cable using a protoboard.


I have replaced the spring for the clip-on programming cable as it is too strong and bent the pins on some of my chips.

Original spring (Bottom) is replaced with a weaker spring (top) from my junk box.


Wednesday, January 17, 2024

Counterfeit STM8S003

 I went into ordering some counterfeit STM8S003 recently as the parts dried up and the prices were getting higher.  I didn't think much at the time as the seller had been around for a few years and had good reviews.

Aliexpress dispute initially rejected my claim and I had to dig much deeper for additional proof.  

I also did some extra digging and found out that STM8 is also a trademark, so leaving it in the description is sufficient enough to associate the part from ST Micro.  Aliexpress into real trouble if "STM8" result from their search engine shows a counterfeit part and they refused a refund sheltering guilty parties.

They have finally gave and started the refund process.


The seller photo edit out the company logo as it is a trademark and even left their company name in the picture.
I found another (counterfeit???) part that has the company logo intact.  The part look innocent enough except for markings on the third line..

Same part with similar pin1 dimple and "e4" logo.


Order page vs actual shipped parts

The actually shipped parts are actual a different batch of counterfeit that don't even look like the picture!  The ST logo is replace with a thinner version that looks more like 5T and the "E4" uses a different font as the top part of '4' is now closed.  The pin 1 dimple is now gone meaning that they now use a different part as the the base for the counterfeit.

Here is another look under the microscope.  The real ST part marking are engraved with a Laser while the counterfeit part is printed on.  Laser are cheap enough, that isn't the sure fire way of telling these days.

Left side is the real part that I have
Right Side is the counterfeit parts from the order

Part marking from STM8S003 datasheet

STM8S003 marking: PHL = Philippines, Year = 4, Week = 06 and Revision = Y
The counterfeit part uses a slightly different format.  CHN = China. The date code could be 03, 6 or 0, 36.

I have wired the part onto a protoboard.  My preliminary test probing the parasitic ESD protection diodes indicate that the counterfeit base part has same Power/Ground pin locations and likely it is also a microcontroller of some kind.  However unlike other simpler counterfeit parts, one can't exactly program it without knowing what it actually is.

The VCAP pin has no voltage output.  There are no active I/O pins, so likely there is no bootstrap loader.

There are a few other microcontrollers that shares a similar pinout and package.  e.g. Nuvoton N76E003AT20 (8051), HK32F003M (ARM M0) and possibly more.


I don't have a Nu-Link to try out, so there isn't much I can do.


Monday, December 25, 2023

MP2307 Buck Converter Module

I ran into some problems with a MP2307 Buck converter module recently, so I did some research on my own.

Vertically mounted modified MH-Mini-360

Here is a copy of Mini-360 schematic (.pdf) I found.


It is closed to the 3.3V output schematic in the datasheet with a few component values changed.  A variable resistor R1 was added to allow for voltage adjustment.

MP2307 is a synchronous buck converter without a low power mode.  The PWM still runs at a fixed frequency with a continuous inductor current about 1A peak to peak - positive and negative inductor current averages to zero. The negative current returns the energy to the power source. A large enough input capacitor could help to recycle the energy.

This is contributing to the high quiescent current that many have observed.

Datasheet shows Switching waveform at No Load

Richtek AN033_EN "Buck Converter Selection Criteria" talks about PSM vs PWM at low loads.


Here is a comparison of the efficiency at low load:

PSM has some disadvantages:

I have ran into low frequency switching noise of PSM interfering with my analog circuits in one of my projects.  

I used the MP2307 modules in my analog circuits as the PWM even at low load makes it easier to filter the switching noise.  See  Audio sw - Analog power supply - using as a charge pump for negative rail for analog circuits.

I have modified a module as the constant voltage/constant current charger circuit recently.


I used D4 to block current leaking from the battery during soft-start and when the input supply is disconnected. An external feedback voltage divider is connected to the battery after D4 to compensate for the diode drop.  

Battery charging current is monitored by R28.  A small DC offset of ~50mV is added so that current flowing in and out of the battery can be monitored.  The charge current is controlled by the current feedback loop at U2B. As the DC offset could be switched off for power management outside of charging making U2B output positive. D7 and D11 is used to clamp the output below the 6V limit of the MP2307.  D7 value was empirically determined as it is different than what LTSpice predicts - inaccuracy in my zener diode model.

Everything works exactly as I designed except for the Mini-360 module was overheating.  At a first glance, the MP2307 internal switch should be good enough.


Both the inductor and the MP2307 gets very hot.  The overall efficiency was around 70%. Could it be fake chips, fake inductor or something else?

It turns out, the inductor value is too low for the high duty cycle in my application.  For each switching cycle, the 10uH inductor have longer time to reach much higher current.  Both inductor and internal switch have to operate at a higher currents and cause more conduction losses.

Here is what can happen (C) when an inductor goes into saturation.  The inductor current increase more rapidly and this causes even more conduction losses at the internal switches and inductor.  

A higher inductance would have a slower rise in current.

Current vs Time plot as an inductor goes into saturation
Source: http://elm-chan.org/works/lchk/report.html

The datasheet even has an equation for the needed value:

L = 15V / (340kHz * (0.3 * 1A)) * (1 - 15V/18V) = 24.5uH, picking the next value up as 27uH.
Inductor rating is ~ 1.3 * I, so 1.3A is fine.

I only have CD75-100M inductor (10uH). I took off the wires and counted the turns 16T.

Since L is proportional to N^2, the required turns = 16T * sqrt(27/10) = 27T. I used AWG 29 wires I got from old transformer.

The core can only handle so much flux before it goes into saturation.  That flux is  proportional to N*I
2.3A * 16/27 = 1.36A which agrees with the 27uH part rating which means that it is made using the same core with more windings.

The overall efficiency went up to the 90% range after the inductor change..

At 90% efficiency, 15V*0.8A * (100% - 90%) = 1.2W for the module to dissipate.
I might charge current 0.8A (due to previous overheating) back to 1A after some more testing.

I mounted the module vertically so that its back side ground fill is also exposed.  This increases the surface area for natural convection and help with the heat dissipation.

Here are the modifications I have made.


Tuesday, December 19, 2023

Isolated power supply 2

There are primary side sensing converters e.g. LT5373 that uses the flyback pulse during the off period to regulate the output voltage. They have an article on this: Primary-Side Sensing Takes Complexity out of Isolated Flyback Converter Design.


I took a DIY approach using a regular boost converter and adding my flyback pulse sensing circuit.  The flyback pulse is rectified across C2. Q1 is a current source that is used to translate the voltage to the feedback pin across resistor R2 thus regulating the voltage across C2.   The current source is also a dummy to keep the boost converter running.

D1, C2 and R3 looks similar to the snubber used in a typical flyback converter and also functions as one.


I used the LT1961 as a simulation model because of the same switching frequency to the MT3608.  Value of R2 is changed for the higher reference voltage.


I noticed negative high voltage spikes during startup in LTSpice simulation.  These spikes goes away as the secondary side load increases as voltage ramps up.


I use a clamping diode on the switch pin to ground. The BAV99 diode comes with a second diode and is used for that purpose in my design.


The output has a PI filter consists of a small ceramic capacitor, a ferrite bead and a bulk tantalum capacitor.  At1.2MHz switching frequency, the ferrite does a good job of filtering out these ripples.

Green trace: voltage across ceramic capacitor before the ferrite bead
Red trace: voltage across tantalum capacitor after the ferrite bead

This circuit isolation is limited by the  PCB spacing as well as the enamel on the magnetic wires between the primary and secondary side.  Here is the layout on a 0.8" x 0.815" (20.3mm x 20.7mm) single sided PCB.


This circuit has good line regulation but poor load regulation unlike the LT5373.  A secondary side LDO would help.  

No load voltage: 7.45V. Full load (40 ohms) voltage: 6.51V +/- 0.01V between input voltage of 12V to 18V.  The wall wart that this module is replacing has a no load voltage 7.8V and 6.74V at 40 ohms load.