View on GitHub

Quorten Blog 1

First blog for all Quorten's blog-like writings

Quartz crystal oscillators, one of the finest and cheapest ways to keep track of time in a stable manner without a network connection. The typical circuit connects a crystal and two capacitors to an integrated circuit. As explained in a previous blog article, inside the integrated circuit is a “clock generator” circuit which is basically an inverting amplifier connected to the two pins of the crystal oscillator circuit.

But, how do you determine the capacitor values that you need to use for your crystal oscillator? Here’s how. Look for the “load capacitance” specification in your crystal’s datasheet. You must pick two capacitor values that satisfy the following formula:

C_L = load capacitance of crystal
C_p = parasitic capacitance
C_1 = first capacitor
C_2 = second capacitor
C_L = 1/(1/C_1 + 1/C_2) + C_p

But, what is the parasitic capacitance? It is the capacitance caused due to fat traces, long traces, pins, leads, etc. Generally, using a value around 3-5 pF works well, obviously if you have less ideal wire connections, you should use correspondingly larger values.

Read on →

Calculating the field of view of a DSLR camera lens is easy, right? This is the formula that you can intuitively reason up on your own and is also repeated on many different websites online.

f = lens focal length
h = horizontal sensor width
hfov = horizontal field of view
hfov = 2 * atan((h/2)/f)

But does this really work in practice? I did some tests, and… yes it does work, but only under specific conditions. Namely, the focal length specified of a lens is only effective in this equation when the lens is at infinity focus. Technically speaking, the distance between the center of the lens and the center of the sensor is what truly determines the field of view. So, because of the fact that lens focus on a simple prime lens is setup to move the lens further away from the sensor to focus on close-range objects, the field of view is effectively narrower under close-range photography conditions. Under extreme circumstances, this can nearly double the effective distance, therefore approximately halving the field of view.

Read on →

Very interesting. Jared Mauch, Getting Fiber to my Town, became his own ISP. Connected directly to the nearest fiber Internet Exchange.

Particularly important was the lessons learned from the county notification, stop-work order. The conduits need a tracing wire run through them, surveying and flagging right-of-way was required, and communicating exactly when they’re working. Lots of good reasons.

And, now you know how the pros find utility cable that they mark down on the ground with paint, they use an electric signal through that tracing wire that I’m guessing effectively functions as an RF antenna, then they can sense and match the signal strength.

How was the project funded? Pre-payment of customers up front, to help offset cost, willing to put in $5000 each. Total construction cost ended up running around $13,000, most of the cost being the digging for the conduit (~$90,000). Muach bought a Ditch Witch directional digging machine manufactured in the ’90s, borrowed a cable plower from the local Wireless ISP, and built his own fiber blower to run the fiber through the conduit.

Fiber splicing… yes it’s actually quite comparable to the challenges of punch-down termination of copper Ethernet cables.

20200912/https://www.youtube.com/watch?v=ASXJgvy3mEg

Raspberry Pi GPIO interrupts. Yes, interrupts on inputs are always a convenience to have for any system that processes input, but the fact that Raspberry Pi runs the Linux kernel means you must go through Linux first before your user-space programs can process them. And yes, often times on Raspberry Pi your user-space code will be the first point of contact with hardware devices, rather than writing a kernel driver that exposes a software interface to user-land.

One method I’ve mentioned previously is registering a GPIO interrupt as a Linux key event that is then propagated to your user-mode software. But that looks rather ugly in C source code that is otherwise direct with hardware. Surely there’s a better way?

Okay, now I’m seeing leads. RPI.GPIO has support for interrupts. But unfortunately, RPI.GPIO is now unmaintained, it never did make it to GitHub proper. It simply got replaced with gpiozero.

Read on →

As part of a making an classic Apple Macintosh RTC (Real-Time Clock) chip replacement, I’ve run up against an interesting AVR programming problem. I’m using an ATTiny85 as the specific replacement chip. In order to support the serial protocol, the AVR core must run at 8 MHz. But it also needs to use the 32.768 kHz crystal oscillator for accurate time-keeping. Normally you’d just connect up the 32.768 kHz crystal crystal circuit to the XTAL1 and XTAL2 pins of the ATTiny85 if you run the AVR core clock at the same speed. But, how do you use the crystal connection as a base frequency for a phase-locked loop that generates the 8 MHz AVR core clock signal?

Well, searching around, looks like I’ve found the way, right here described by the name behind the AVR itself, the “Microchip” named company. The appraoch given here works fully at runtime, but the process to calibrate the system clock to the watch crystal ties up the CPU.

20200911/DuckDuckGo avr phase locked loop low frequency crystal resonator
20200911/DuckDuckGo avr crystal connection
20200911/http://ww1.microchip.com/downloads/en/AppNotes/doc8002.pdf
20200911/DuckDuckGo avr055 source code
20200911/https://www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=en591195
20200911/http://ww1.microchip.com/downloads/en/AppNotes/AVR055.zip

That aside, as a fragment of the code, a simple solution to do what I want is obvious. Just enable the asynchronous timer using the ASSR register and the crystal connection will be used to drive the respective timer.

Read on →

Can you read the contents of mask ROM with a microscope photograph? Yes, here’s how. Depending on the type of mask ROM, you might need to do some preliminary physical preparation beyond just opening the chip case, like weathering away layers. But in some cases, no preparation is needed, and you can just photograph right away and look at the components to determine the memory value.

This is also a very interesting website for a college class on reverse engineering as a broader subject.

20200906/DuckDuckGo mask rom microscopy
20200906/http://security.cs.rpi.edu/courses/hwre-spring2014/Lecture9_MaskROM.pdf
20200906/http://security.cs.rpi.edu/courses/hwre-spring2014/

And, reading in even further, this was an experimental class, the instructor was really busy to create and run the class, and also the instructor has his own blog he maintains with his expertise in the area. There’s also great backstory on how he got access to some of the more expensive lab equipment.

20200906/http://siliconexposed.blogspot.com/2014/03/getting-my-feet-wet-with-invasive.html
20200906/http://siliconexposed.blogspot.com/2014/03/getting-my-feet-wet-with-invasive_31.html
20200906/http://1.bp.blogspot.com/-9NqfSrOAhgs/UznZdglIXBI/AAAAAAAAAmY/zafjvutRzDs/s1600/DSCF4975_sm.jpg

Read on →

So, whwt is the PIC microcontroller anyways? It is used in particular to implement Apple Desktop Bus (ADB) on the Macintosh SE and Apple IIgs. Here are some important datasheets for the particular version used for ADB, the PIC16CR54. Also, very important, there is a separate datasheet dedicated to describing the programming and verification interface to the PIC16CR54. If code protect is enabled, then you can’t dump out the program contents, otherwise you can using this interface, and can then duplicate an PIC chip.

20200905/DuckDuckGo PIC16CR54 datasheet
20200905/https://www.datasheetarchive.com/PIC16CR54-datasheet.html
20200905/https://www.microchip.com/wwwproducts/en/PIC16C54
20200905/http://ww1.microchip.com/downloads/en/DeviceDoc/30453E.pdf
20200905/DuckDuckGo PIC16C5X Programming Specification
20200905/http://ww1.microchip.com/downloads/en/DeviceDoc/30190h.pdf

But, I digress. To answer my first question, what is PIC exactly? Well, as it turns out, both PIC and AVR are made by the same company, and they have a huge overlap in the overall microcontroller architecture. I would reckon that PIC is an earlier version of AVR. As for AVR, there is a later version of it .

SCSI2SD? You said it’s not Open Hardware? Okay, well that may be true that it isn’t Open Hardware, but all the firmware is open-source software. Take a look at the GitHub repository over here.

20200906/http://www.codesrc.com/gitweb/index.cgi?p=SCSI2SD.git;a=summary

DuckDuckGo RaSCSI board kits are now available on Tindie!

20200905/https://www.tindie.com/products/landogriffin/rascsi-macintosh-version/

Also interestingly, the original Japanese author behind RaSCSI now has his site brought back online. Take a look over here. And, this is his Twitter. Best part about it, he is also well-aware of the 68kMLA version of RaSCSI, so he’s keeping tabs on this new development too, as we are keeping tabs in his recent new developments.

20200905/http://retropc.net/gimons/rascsi/
20200905/https://twitter.com/kugimoto0715

X68000 is the name of the game for the original target machine of RaSCSI. Is the machine covered on the English Wikipedia? Indeed it is!

20200905/https://en.wikipedia.org/wiki/X68000

Read on →

Interesting, I’ve got note of this SE/30 forever website that contains some information on the packaging and manuals that came with the Macintosh SE/30 when it was new out-of-box. However, the information is not sufficiently rigorous to be able to manufacture a replica of the boxing, and the manuals are missing from the website.

20200904/https://se30forever.com/design.html

Okay, time to jump straight into Arduino AVR microcontroller development head-first. I’ve got the simavr simulator right here, so I can start coding. How do I compile? Yes, the hint right there, use avr-gcc and avr-libc. And how do I use the compiler specifically to produce ATTiny85 firmware? Just like this.

avr-gcc -o MacPlusRTC.axf -Os -mmcu=attiny85 MacRTC.c

20200904/https://github.com/buserror/simavr
20200905/https://raw.githubusercontent.com/buserror/simavr/master/doc/manual/manual.pdf
20200905/DuckDuckGo attiny blink demo code
20200905/https://www.instructables.com/id/Attiny85-USB-Development-Board-LED-Blinking-With-A/
20200905/DuckDuckGo gcc avr
20200905/DuckDuckGo gcc avr attiny
20200905/https://github.com/vladbelous/tinyAVR_gcc_setup
20200905/http://www.lightner.net/avr/ATtinyAvrGcc.html
20200905/https://www.digikey.com/product-detail/en/microchip-technology/ATTINY85-20PU/ATTINY85-20PU-ND/735469
20200905/https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet-Summary.pdf
20200905/http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

Read on →