• A quick foray into the CH552 MCU

    11/28/2022 at 02:20 0 comments

    The CH552 is a very cheap (~$1) enhanced 8051 core MCU by Nanjing Qinheng Microelectronics, It's been on the market for a while and there are breakout board projects based on it, for example #CH552 Dragon , #CHUSBIE552 - CH552 Development board , #CH55xG Tiny on Hackaday alone. An Internet search will find many more. So this is old territory. Seeing cheap WeActStudio CH552 boards on AliExpress for less than $2 prompted me to get a couple to play with, despite being a bit adverse to the 8051 CPU architecture. (A decent C compiler can hide some of the ugliness.) This has the CH552 in a 20 pin package and an impressively small number of glue components. The board is only about the size of old 24 pin 0.6 inch width DIP chips. Even the 5V to 3.3V regulator is on the MCU chip. It's similar to other 20 pin MCU boards like the STM8 budget series.

    The previous link is to a Github repo and you may wish to make a local clone to get access to the board details. The datasheets from the manufacturer, in both Chinese and English, are also provided.

    One of the attractions of the CH55x series is on-chip support for USB which could come in useful for working with USB devices. In fact the USB connector is USB3, not the older USB2 micro USB connector. Today I just want to get it to blink.

    For this I will be using Deqing Sun's CH55xduino, which is an Arduino environment for the CH55x devices. The best place to get it is from the official Arduino repositories, search for ch55x under Boards. This provides a familiar starting point for many people. SDCC, the compiler, isn't a C++ compiler, so the object oriented aspects of some Arduino libraries have to be rewritten in plain C, and user code adapted to suit. CH55xduino has made commendable progress on this front. Later on, I'll probably invoke SDCC directly from Makefiles.

    For Linux, CH55sduino suggests installing a udev rule so that you can download code as a normal user. I modified it a bit, the original made the USB port RW to all. Instead I chowned it to the dialout group, which is the suggested group for accounts that need to communicate with serial devices on my Linux distro.

    # CH55x bootloader
    # copy to /etc/udev/rules.d/
    SUBSYSTEM=="usb", ATTRS{idVendor}=="4348", ATTRS{idProduct}=="55e0",GROUP="dialout"

    To get the blink sketch, I went to Examples and chose the CH55x version. One thing has to be edited, the definition for LED_BUILTIN has to be changed to 30, because the WeActStudio board has the LED on this line, by looking at the schematic from their git repo.

    So all I had to do was select Upload, and after a while the blue LED duly blinked.

    Now that I know it works, it'll go into my collection of MCU breakout boards which I will put to use when I get a round tuit. There seems to be a worldwide shortage of round tuits, but we all have to cope in our own way.

  • A short experiment with a DTL ring oscillator

    11/20/2022 at 10:28 1 comment

    Following #Ring Oscillators: Fairchild DTL 949 I decided to see if I could make some use of a handful of DTµL 846 quad 2-input NAND chips I have, since it's very easy to wire up a ring oscillator. 3 gates form the oscillator and the fourth buffers the output. I do not have a scope of sufficient bandwidth to measure to 10 MHz so I sent the output to a 74LS393 as a divide by 256 counter. So to get the original frequency, multiply by 256.

    The DTL chip was mounted on a repurposed precision IC socket, slightly damaged by a soldering iron. This avoids any stray capacitance from breadboards, but allows different chips to be plugged in. Here are the results of the few good chips I have (the others in my pile had one faulty gate):

    • 37 kHz -> 9.5 MHz
    • 36 kHz -> 9.2 MHz
    • 38 kHz -> 9.7 MHz

    The frequency stability is not great, it fluctuates in the short term. In the medium term I noticed it sped up a bit after "warming up". But it's pretty certain that it will not exceed 10 MHz.

    So what to do with these oscillators? Where can I use them that doesn't require the accuracy and stability of crystals, which I'm not short of? Perhaps where I don't want the added components for a crystal oscillator. But even ancient MCUs have built-in gates for crystals, requiring only a couple of load capacitors. Modern MCUs even have a builtin RC oscillator mode which is good enough when timing isn't critical. Maybe some kind of coarse timing circuit? But the divisor would be large, so might as well use a MCU again. I'll put that question in the back of my head while I move on to other projects.

    Out of interest I tried a 74LS00 chip (which has the same pinout) in the harness and I got 133 kHz -> 34 MHz.

  • The Soul of an Ancient Calculator

    08/30/2022 at 06:45 0 comments

    Around 1990 I picked up an old Sharp calculator from a flea market because it was only a couple of bucks and had 16 nixies. I believe it was this Sharp calculator model from 1969. I say I believe because at some point when I moved I threw away the case and keyboard, no perceived utility. But that the CS-361 had magnetic core memory fits with the main board I still have.

    Well it's a pity I don't have the complete machine because it could have been of interest to a museum. I'm fascinated that it used core memory. I thought it was for microcode storage, but the web page says it was for registers. The microcode probably consists of diode logic. You can also see it has germanium transistors in metal cans and plastic silicon transistors.

    No, I'm not going to try to reverse engineer the logic. Just thought I'd publish a picture of the main circuit board before I put the nixies to other uses.