Running the Nibbler on a 2 Hz Clock – Who Needs 2 MHz Anyway?

Nibbler-2hz-clockNow that the Nibbler hardware is up and running I can go about and modify the hardware a bit. It's cool to have the board running at 2.4 MHz as everything written in assembler for a 4-bit CPU just runs at a breathtaking speed. Who needs GHz's on such a system? While speed is cool it has the slight disadvantage that doing something as benign as letting an LED blink once a second requires massive delay loops. With 4-bit counters it actually requires 4 nested delay loops. No, the board has no interrupts that one could work with as the focus was on reducing the hardware as much as possible while still having a real computer to work with.

As everything about the Nibbler is static, it's possible to turn down the clock rate as low as 0 Hz. For educational purposes I decided to replace the 2.4 MHz clock generator on the board with a 2 Hz clock I assembled out of two Not (Inverter) gates, a capacitor and a resistor. The extra LED and resistor shown in the image next to the Not-gates IC are not really needed as they are just for showing the clock impulses.

At two Hertz, each assembly instruction of the Nibbler takes exactly two clock pulses, or one second. At that rate it's actually possible to count instructions and visualize where the program currently executes. For the purpose I've written a short program with 5 instructions that switches the on-board LED on and off:

; x-2hz-clock-led.asm

; OUT ports
#define OUT_PORT_LED $E ; 1110 – bit 0 is low
 
; =================================================
 
led_blink_loop:
    ; LED on
    lit #0
    out #OUT_PORT_LED

    ; LED off
    lit #4
    out #OUT_PORT_LED

    jmp led_blink_loop

At 2.4 GHz the only thing that can be observed is a constantly glowing LED though not as bright as it could as it's only switched on 50% of the time. At 2 Hz, however, the LED blinks with a frequency of around 1 Hz. When the program starts and the LED is off it takes exactly 4 clock pulses before the LED is switched on because the output port for the LED is only pulled to ground in the 2nd cycle of the second instruction. 4 cycles later the LED is switched off again. It then takes 6 cycles before the LED is turned on again because there's the jump instruction at the end of the program that takes 2 cycles in addition to the two instructions that load the value to be written to the output port into the accumulator (lit #0 = load immediate) and the output command itself that writes the content of the accumulator to the output port.

Counting machine instruction executions with your fingers, when's the last time you did that? 🙂

LTE dual-SIM, dual standby, GSM-only for the second SIM

Three and a half years ago I had a closer look at how a dual-SIM 3G mobile worked in practice and how both SIM cards can be used simultaneously, or not. Up to today, the two articles (see here and here) remain one of the most viewed ones so I'm not alone with my interest. These days, there are also dual-SIM LTE phones available, not only in the mid- and low-range market but also in the high-end sector. Time to have a look how these work in practice and if two networks can be used simultaneously.

By and large, the behavior of the dual-SIM LTE phone I had is pretty much identical to the Dual-SIM 3G phone from three and a half years back. The phone can receive (i.e. listen) to two networks simultaneously but can only be active (i.e. transmit and receive) in one at at a time. One can, for example, browse the Internet via one network (used with the first SIM card) while the device keeps listening for incoming voice calls and SMS messages on the other network (with the second SIM card). When a voice call comes in on the second SIM card, the mobile interrupts the communication with the first network during the phone call. In other words, it's not possible to access the Internet via one network and have a phone call over the other network at the same time. That means that, like three and a half years ago, it's still a dual-standby approach.

Also, like the device three and a half years ago, one transceiver chain is limited to GSM while the other chain is capable of GSM, UMTS and LTE. SIM cards can by assigned to one of those chains via the menu so its possible to switch SIM cards to and from the LTE chain for data transfers when necessary. This is useful, for example, when using one SIM card for Internet access in the home country and another SIM card for Internet access when traveling abroad. To get an idea of how that looks like in practice click on the links above. The user interface looks a bit different now but the steps to switch and select SIM cards are still the same.

The Nibbler 4-Bit CPU Project – First Run

Nibbler-first-run-smI you haven’t seen my previous posts on the Nibbler, have a look here for what happened so far.

It’s a November evening which means it’s dark and cold outside and I’m looking out my windows to see a steady stream of car headlights. I’m glad I’m back home. Earlier today I’ve bought the missing chip for my Nibbler board and it’s time after all the effort put into understanding the concept and assembling the hardware if it will actually work. Adrenaline is flowing freely now, not only because my progress was slowed down by a pre-scheduled visit to the dentist. I was close to canceling it, I had a good enough ‘technical’ reason but it would have been that, just an excuse. So one dentist appointment later I finally sit at my desk and insert the remaining chip into the waiting socket on the Nibbler board. Once more I verify that all sockets contain the correct chip and come away satisfied.

Time for attaching the board to the power supply. If all goes well, “press any button” should show up on the display. I should have changed the text it into “hello world” but I decided to go ahead with a binary from the author rather than something written myself. More time for playing around with the software later, it’s a hardware thing today. I connect the board to my 5V battery I normally use for recharging my phone as I don’t even a regulated power supply. I intend to run it on a 5V USB mobile phone charger later but as I’m not quite sure the 5V delivered by a charger is flat enough for the Nibbler I decided on the battery instead.

I flip the master switch on the board and the green power supply LED turns on instantly – Apart from that – NOTHING happens on the display. What!?

Pressing the reset button a couple of times I refuse to believe that something could be seriously wrong. But the display remains dark. I then press the up/down/left/right keys and the piezo speaker starts making noises every time I press a button. Hope returns as the program I flashed into the ROM is supposed to do that. So the program must be running! Yay! But why is there nothing on the display, is the display or the output port chip broken? Then comes the flash of insight – I soldered a potentiometer onto the board to control the LCD module’s contrast. During the assembly phase I put it into a middle setting to ensure that I would at least see something when I first power-up the board. Perhaps a middle setting is not good enough? So I change the setting with a screwdriver first in one direction, resulting in nothing, then in the other direction and suddenly “press any button” shows up on the display. HURRAY – it’s only the contrast setting! As you can imagine, I’m overjoyed!

For the next half our I run a number of programs Steve Chamberlain has put together for the Nibbler, all in a single ROM and accessible via different jumper settings, a cool idea from William Bucholz, the creator of the PCB board. Everything works as it should. Wonderful! Now that the hardware is running I can further explore the hardware in ways that are just not possible with a simulator. But before that some sleep is in order to get the adrenaline from the dentist appointment and from those seconds between power-on and realizing that the contrast level has to be adjusted to see something on the display out of the system.

To be continued…

The Nibbler 4-Bit CPU Project – The Missing Chip

Almost-fully-assembled-nibblerThe circuit board is soldered, the microcode and program ROMs are flashed so the final step before switching on my 4-bit CPU board is to put the chips into the sockets. I'm glad I took extra care when doing that because quite to my dismay one bag contained the wrong IC for the data bus driver. Instead of a 74HC244 2x 4-bit buffer with a 3-state output that is required to select either the ALU or the FETCH register for output on the 4-bit data bus, a 74HC574 was delivered which contains d-type flip-flops. Apart from having a completely different functionality, input and output pins on that chip are different than on the 244.

If I hadn't caught the mistake, a number of chips would probably have been fried at first power-on. I could hardly believe it as the invoice correctly showed a 74HC244 and also the the bag for the chip had a 74HC244 sticker on it. I'm glad I didn't trust the bag labeling and checked the number on the chip once more after having inserted it on the board.

Missing-chipsQuite frustrating to sit in front of a fully completed board and not being able to power it on due to a single component missing that is worth only a couple of cents. Fortunately, a local supplier had a 74HC244 in stock so instead of waiting for it to be delivered I went to pick it up in the shop during lunch break the next day. The second picture shows the chips I picked up in the local store. Joy for less than 2 euros! Almost showtime now!

Is the Raspberry Pi Zero The First Computer Shipped As A Magazine Supplement?

When I was a teenager it took me two years to convince my parents to buy me a computer. I would have taken anything, big small, TV output, LCD display, whatever, just programmable please. I finally got one but it took too long, mostly because even home computers were expensive at the time. Well, times have really changed, haven't they!?

Yesterday, Eben Upton, one of the creators of the Raspberry Pi, announced the $5 Raspberry Pi Zero. It's much smaller than a "normal" Raspberry Pi, has fewer connectors but is more powerful than the first Raspbery Pi and can act as a fully functional as a desktop computer as it has an HDMI (mini) out and old fashioned TV interface (for which a connector has to be soldered onto the board). Even better, to get one, just go around the corner to a newsstand (at least in the UK) and pick up the latest edition of the Magpi magazine for 6 pounds in which the Raspberry Pi Zero is included as a supplement. Wow, I just imagine myself as a boy having done that instead of having had to preach to my parents for years about the need for having a computer.

I wasn't quite sure when I started writing this article but while writing it, I found this video in which Eben confirms that the Pi Zero is the first "real" computer ever shipped as a magazine supplement! True, an SD card is needed as a mass storage device in addition to an HDMI cable to connect it to a TV as well as a mouse and keyboard which easily exceed the price of the Pi itself, but hey, compared to two years preaching that's a hurdle that can be overcome easily as all of these things are available in abundance and can probably be gotten second hand for next to nothing.

A "real" computer as a supplement in a computer magazine that can be bought at a news stand! I'm sure the late Steve J. would agree, this is insanely great!

No Google Play Store In China

When I was recently in China a number of my fellow travelers asked me if I could access the Google Play store. Over a Wi-Fi connection without a VPN I couldn't. I wasn't really all that much surprised, most Google services, Facebook, etc., etc, and most VPN services with servers outside of China are blocked as well, so why should the Play Store be accessible?

Well, for one thing I thought at first, because there are said to be 700 million Android based smartphones and tablets in China. As we are all taught how important it is to download software only from a carefully controlled App store these days, how are those 700 million devices getting software and updates? So I asked one of my local friends with a Chinese Android device if Chinese Android devices can access the Google Play store. As expected I got the answer that the Play store does not work in China and that people just search for Apps on Baidu (the local Google search equivalent) and install it right from a web page. Baidu offers and app store for Android as well but direct installation from web pages seems to be quite popular as well. So much for security screened apps and automatic updates.

Perhaps 700 million Android devices without access to the official store is one of the reasons why Android still makes it easy to download apps from, what is called, "unknown sources" in the user interface and allows to use alternative App stores (of which there seem to be quite many in China). If I were a cynic I would probably be thankful for the censorship so I have more freedom.

Which makes me wonder what kind of concessions Apple had to make as their app store can be accessed in China…

The Nibbler 4-Bit CPU Project – Flashing The ROMs

Tl866a-flash-hardwareThere we go, soldering the Nibbler circuit board is almost complete. One thing I've never done before, however, is to flash ROM chips, which is required for the two Microcode ROMs and the program ROM. In other words, that part is black magic tor me. But even black magic can be tackled given the right equipment.

In my case I bought a TL866A Flash programmer which seems to flash pretty much every Flash and EPROM on the planet. Having ordered it at a store in Germany it cost me around 90 euros. Yes, I know, it can be had for much less via eBay straight out of Hong Kong, but I wanted to have it quick and hassle free. I expected some major hardware Vodoo before the microcode and programs would end up in the ROM chips but the whole process was surprisingly hassle free. Selecting the IC type, selecting the ".bin" binary file to be flashed which just has to be the same size or smaller than what the Flash or ROM chip can handle and then pressing the "Program" button and the job was done in 10 seconds per IC. The software also lets one read the IC to verify afterward if program has actually ended up on it.

Flash-programmer-screenshotEverything looks good now, my 3 ICs are programmed so I'm ready to go. The two images on the left show the TL866A Flash programmer connected to the PC and a screenshot of the software. Obviously I immediately got comments from friends pointing out that I've strayed from my "Linux-only" on the desktop at home approach. Agreed, a small "OS sin" on my part but since it was my first time I didn't want to start using the hardware via Windows in a virtual machine. Now that I know how things work, I'm pretty confident that that would work as well, so the "OS sin" would at least be jailed in a virtual machine 🙂

5G Above 5GHz – More Than Just A Few Meters?

Last month I had a post about 5G heavily relying on spectrum beyond 5 GHz and the catch that today's consumer devices using such spectrum can only cover a few meters. In other words, using spectrum in the 30 or even 70 GHz range (called millimiter-waves, or mmW for short) won't work for cellular networks where base stations are several hundreds of meters apart from each other even in dense population areas. Fortunately, not everybody agrees.

After I posted my article I was made me aware of this very interesting IEEE article in which the authors describe their study of how such ultra high frequency ranges could become usable in a cellular environment. Their conclusion, based on experiments in a real environment, is that by using a high number of tiny antennas for beamforming in mobile devices and base stations, it's possible to overcome the high attenuation of the air interface in the 30 and 70 GHz bands and thus significantly increase the transmission range. They predict that the combination of beamforming and using large 1 GHz carriers can increase overall air interface capacity by an order of a magnitude compared to the 20 MHz carriers used for LTE today.

As antennas are small, a space in a smartphone of 1.5 to 1.5 centimeters could hold 16+ tiny antennas which would be enough to achieve the desired beamforming effect. The authors note, however, that with the current approach of treating each signal path separately it is not feasible to process so many inputs and outputs and that new methods have to be found, especially on the smartphone side, to master this new level of complexity while keeping the amount of energy necessary for the processing in check.

Another challenge pointed out by the authors is indoor coverage, because even with beamforming, millimeter waves are still not penetrating walls and other solid obstacles well. In other words, mmW base stations must also be put inside buildings to also go beyond today's data rates there. In many cases it's unlikely that several operators can deploy their mmW equipment inside a single building so the authors note that a new business model might be required where a third party offers mmW access equipment for interconnection to traditional mobile backhaul networks.

While beamforming holds the solution to extending the range of millimeter-wave systems to usable distances one issue that is created by this is how synchronization and broadcast channels that have to be transmitted omnidirectionally can reach devices. In addition, the channel state from and to each device needs to be continuously tracked in order to keep the beams aligned to individual devices. This is likely going to impact a device's power saving abilities as the transmitter can't be off for long periods even if no data has to be transmitted.

The authors list many further points that have to be considered due to the completely different nature of using mmW in combination with beamforming compared to today's LTE systems. It's by far not a drive-by read so bring some time if you want to explore the paper, it's definitely worth it.

Thanks to Guy Daniels for pointing this the paper via his article on the topic here!

 

The Nibbler 4-Bit CPU Project – Soldering Things Together

Nibbler-solderingA few days ago, the printed circuit board (PCB) for my 4-bit do-it-yourself CPU project has arrived. The next step was to get the parts together. That's a bit of a tricky thing as many components, especially the 74HC181 chip that implements the Arithmetic Logic Unit (ALU), while having been quite popular in the 1970's, are a bit on the antique side these days.

In the end, I bought the parts in 3 different stores. Most of the parts came from Digikey in the US and I was surprised how fast they delivered. I ordered on a Monday evening European time and the parts were delivered two days later on Wednesday morning. As I was ordering parts for more than 65 euros, delivery to Europe was free of charge and Digikey took care of customs procedures, taxes. etc. An incredible turn-around time, looks their logistics are quite optimized.

Other, more common parts, like most logic chips came from an electronics store in Germany with an equally impressive turn-around time. The 74HC181 ALU IC was a special case, neither Digikey nor the German electronics store had that part in stock. Thanks to Google, I was able to find the ALU at Darisus, another electronics mail delivery company in Germany that had it in stock. All parcels arrived Wednesday so I was set to go in less than two days. Quite a difference to the days when you ordered by mail and expected a response a week or two later…

The picture on the left shows my current progress. Most parts and the IC sockets are already soldered, the next step is to flash the microcode- and the program ROMs.

3G Mobile Video Calls Are Dead – Long Live Mobile Video Calls

Incredible, I made my first video call only or already a decade ago, depending on how you look at it. At the time I was convinced it would become a mass market phenomenon once more people had 3G phones. It didn't really work out like that, however, and I have to admit that the service never really became popular, perhaps because most network operators massively overpriced the service and failed to continuously innovate and evolve the service.

Today, 3G video calling is still in the same state as it was 10 years ago. For today's devices the resolution and frame rate of the video is far too low and picture quality on the large screens of today's devices is far from what people expect. In the meantime some network operators have even given up on the service entirely and have begun blocking the service for new subscriptions.

But I'm glad that others haven't given up and have continued to innovate. Facetime on mobile has reached some popularity, e.g. see my post from New York from back in 2011. Personally, I use Skype for smartphone and tablet video telephony. Over LTE and even 3G, the video resolution and frame rates are fantastic. These days, I'm seeing more and more people engaged in video calling, especially at airports. Still a niche when compared to the billions of voice minutes generated every day, I agree, but nevertheless quite mature and useful today.