Thursday, November 21, 2024

NVMe on Raspberry Pi 5

Raspberry Pi 5 introduced a PCIe connector (16-pin 0.5mm FFC) in the place of the under-utilized display connector.  Now it is possible to use an NVMe SSD.  It would require a PCIe to NVMe adapter (like Mcuzone MPS2280), which can be purchased for about $7 and comes with a board to mount an M.2 M-key NVMe SSD for size 2230/2242/2280 and a flexible flat cable to connect to RPi 5.  
Download the OS image.  xzcat | dd to the disk.  Two partitions are created and the OS takes up about 14GB.

The default EEPROM `BOOT_ORDER=0xf416`, the boot order should be NVMe, SD Card, USB.  But it still boots the SD card first.  With the SD card out, the RPi 5 boots from the NVMe.  The root partition is near full.  Use parted and resize2fs to grow the root file system.

A sustained read/write speed is 390MB/s read and 440MB/s write, which is better than the USB NVMe adapter 260MB/s read and 380MB/s write, but not dramatically.

The RPi 5 PCIe is rated for Gen 2 one-lane; the maximum throughput is 500MB/s.  

In config.txt, add `dtparam=pciex1_gen=3` to enables PCIe Gen 3 (1GB/s).  The reliability of the Gen 3 operation is not guaranteed, but it appears to work well.  The read speed is increased to 850 MB/s; the write speed is largely unchanged.  The disk is rated at up to 1700MB/s for sequential read and up to 1000MB/s for sequential write.  So the read speed is close to the bus speed, but the write speed is under performing.

The board averages about 1.2A/5V during writing.  The average idle current is 0.7A (without SSD, 0.6A).  With the NVMe SSD, the Raspberry Pi 5 does not shut down completely, still drawing 170mA despite of setting POWER_OF_ON_HALT=1 and WAKE_ON_GPIO=0 (without SSD, 4mA).

The PCIe interface appears to have some interference on the WiFi signal.  This FFC has no ground plane, which probably radiates more. The on-board WiFi has trouble picking up relatively weak signals.  Other people have reported similar issue.  The WiFi does work when it is close to the router. 

Thursday, October 31, 2024

Nano Ammeter

One of "self-explanatory" circuits in AoE2 is a nano-ammeter circuit; no explanation is given.  I doubt it is really self-explanatory to a beginner.

This circuit appears to originate from PMI's OP-41 datasheet.  (PMI is Precision Monolithics, Inc which later became a part of Analog Devices.)  OP-41 is a JFET input opamp with very low input bias (5pA @ 25C) in the inverting configuration as a logarithmic amplifier.  (OP-41 also tauts the excellent CMRR of over 100dB for a FET input opamp.)  Q1 and Q2 are matching transistors.  Their current ratio is the exponential of the difference in Vbe. If the difference in Vbe is proportional to the temperature, the current ratio is constant.  Since the Q1 base is grounded, the difference in Vbe is just the Q2 base voltage.  The resistor divider provides the Q2 base voltage that is proportionally to the temperature, as the bandgap reference subtracts the diode connected Q3 to produce a voltage is approximately proportional to Vt (although there is more complex 2nd order temperature dependency).   How good is the approximation?   We can run a Spice simulation stepping the temperature.  The Q3 current is about 65uA at -55C and 115uA at 125C and approximately linear  I (uA) ~ 0.28 * T (K) . 


The trimmer adjusts the full scale value of the current meter. 

Also the compensation network requires some explanation, which is deferred to a separate discussion.

Sunday, September 29, 2024

Common Emitter Frequency Response using EET

Even the simple common emitter circuit can result in some pretty complicated expression for the frequency response. The inclusion of a single element, the base-collector capacitance, introduces much complexity.  This circuit is analyzed in detail by most of the textbooks, including Gray & Meyer's.  None of them makes use the EET.  We give a derivation using Middlebrook's EET to see if the analysis is simplified.


 We work out the factor involving Cf,


This is a little bit less work than the more direct method,

The two methods produce the same expression, so using EET does not give more insight.  

The base-collector capacitor results in an additional pole and a right-hand side zero and shifts the dominant pole.  The dominant pole can be approximated from the input capacitance and the Miller capacitance.


Wednesday, September 25, 2024

Useful Circuits with Two Transistors

The preeminent circuit designer Barrie Gilbert asks "How many distinctly different and really useful circuits can be made with two transistors, anyway?"  and his answer "about twenty-four" (Williams, Analog Circuit Design, p179).  Let's see what they might be.  It is perhaps subjective to tell what is useful or different.  Also what type transistors, BJT, JFET, MOSFET?  Same circuit configuration with different type of transistors should not be considered distinct. What about other circuit elements?  Assume the passives, resistors, capacitors, inductors, are OK, but what about diodes? And what about a multi-emitter/collector transistor or a dual-gate MOSFET?  Is it considered one transistor or multiple transistors?

A single transistor has three basic amplifier configurations; it can also be configured as a diode, and the emitter-base junction also makes a somewhat usable Zener diode.  A JFET makes a good current source (current regulating diode).



Monday, September 23, 2024

Input Impedance of a Bipolar Transistor Bias with Feedback

AoE shows a bipolar transistor bias circuit using feedback from the collector.  AoE2 and AoE3 show the identical circuit, but they differ in the values of the input impedance: AoE2 states 300 Ohms and AoE3 200 Ohms.  We would like to analyze the circuit to see why the value has changed.  Here the base bias is established by a resistor from the collector, which has the effect of negative feedback: a high bias lowers the collector voltage that reduces the base voltage.  


Here we estimate the collector current to be about 1mA.  The input impedance is about 200 Ohms for a beta of 100; it does not exceed 225 Ohms as the beta goes to infinity.  So it seems justified that AoE3 makes the correction.   Even when the temperature varies, the input resistance stays relative constant.  For example, if T = 100C, VT = kT/q = 32mV, but because Vbe decreases with increasing temperature, the emitter current also goes up, Vbe = 0.4V, Ie = 1.34mA, gm is still around 1/25 A/V.


Wednesday, September 18, 2024

N Light Switches

AoE2 has an exercise asking readers to wire up N switches that any one of the switches can turn on or off a light bulb.   It comments that every electrician knows how to do this, but few electronic circuit designers do.  Given the hint that it requires 2 SPDT and N-2 DPDT switches, it is not hard to do.


This exercise is retained in AoE3.

Tuesday, September 17, 2024

A Current Source Circuit from AoE-X

H&H show a clever current source circuit and challenge readers to prove the circuit works especially without using two of the constraints.

It is a circuit of an opamp driving a bipolar transistor.  The base current of the bipolar transistor would normally cause an error.  Here the error is compensated.  The base current is sensed with the base resistor kR1; the emitter voltage is Vin with the differential voltage added using a circuit configuration resembling a difference amplifier.

Note that the current through R1 is the sum of the collector current, the base current and the current through R2, which the last two are the current through kR1.  The derivation makes no use of the constraints on the resistors.  The base current compensation is strictly accurate (assuming ideal opamp).