This is only a preview of the March 2024 issue of Silicon Chip. You can view 39 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Laser Communicator":
Items relevant to "Pico Digital Video Terminal":
Items relevant to "‘Nunchuk’ RGB Light Driver":
Items relevant to "Mains Power-Up Sequencer, Pt2":
Items relevant to "Arduino for Arduinians":
Purchase a printed copy of this issue for $12.50. |
The Pico Digital Video Terminal
allows you to communicate
with and control a
Micromite, PicoMite or
WebMite with modern,
easily obtainable
equipment such as USB
keyboards and HDMI
displays.
Raspberry Pi Pico
Digital Video Terminal
Part 1: by Tim Blythman
B
oot-to-BASIC computers like the Micromite and PicoMite are an easy way to
learn about programming, but they can
still leave you tied to a fully-fledged
computer as a way to communicate
with them. Alternatives like the VGA
PicoMite can stand alone but require
legacy gear such as a VGA monitor.
With this project, you no longer need
a PS/2 keyboard or VGA monitor!
Put simply, the Pico Digital Video
Terminal is an updated version of the
ASCII Video Terminal from July 2014
(siliconchip.au/Article/7925). The
ASCII Video Terminal allows a microcontroller with a serial interface to
connect to a PS/2 keyboard and VGA
monitor or composite video display.
The Pico Digital Video Terminal
does much the same, although it provides more modern interfaces. It also
provides a virtual USB-serial port to
allow such a microcontroller to easily
connect to a serial terminal program
such as TeraTerm or minicom.
It is modular, allowing some functions to be left off or customised.
Instead of a PS/2 keyboard, it uses a
USB keyboard. Even wireless USB keyboards are cheap and plentiful these
days, so you can easily go wireless.
The Terminal also delivers digital
siliconchip.com.au
video from its HDMI connector, allowing it to be connected to most modern
TVs and monitors. There are even compact HDMI displays designed for computers like the Raspberry Pi, which
should also work well.
The signal is not strictly HDMI-
compliant but uses a backwards-
compatible Digital Visual Interface
(DVI) set of supported resolutions that
are supposed to work with all HDMI-
compatible displays.
We can’t strictly call it HDMI as
such; licensing restrictions exist on
using the ‘closed’ HDMI standards
and trademarks. Regardless, the Terminal has worked successfully with
all HDMI-equipped displays we have
tried. We considered calling it “I can’t
believe it’s not HDMI!”
We have also implemented a USB
host interface to communicate with
the virtual USB-serial device on boards
like the Micromite and PicoMite. The
Digital Video Terminal features & specifications
»
»
»
»
»
»
»
»
»
»
»
640×240 pixel monochrome (80×30 character) display option
320×240 pixel colour (53×20 character) display option
HDMI socket with DVI-compatible digital video
USB-A socket for keyboard (works with wireless keyboards)
VT100 terminal compatibility
USB-C socket for 5V USB power
Three status LEDs
Fits in a compact enclosure (105 × 80 × 25mm)
Tested with the Micromite, PicoMite and WebMite
Turns a development board into a standalone computer
Works with other USB-serial capable boards, including: Raspberry Pi Pico/Pico
W (including CircuitPython & MicroPython); Arduino Leonardo; CP2102 USBserial converters; and Micromite/Microbridge
» Baseline DVI output over HDMI connector
» USB host for keyboard
» Flexible and modular design
Australia's electronics magazine
March 2024 45
Parts List – Digital Video Terminal
1 double-sided PCB coded 07112231, 98 × 68mm
1 black double-sided PCB coded 07112232, 99 × 22mm
(front panel for H0190 enclosure) OR
1 black double-sided PCB coded 07112233, 99 × 27mm
(front panel for H0191 enclosure)
1 ABS instrument case 105 × 80 × 25mm
[Hammond RM2005STBK; Multicomp MP004813; Altronics H0190] OR
1 ABS instrument case 105 × 80 × 30mm
[Hammond RM2005MTBK; Multicomp MP004811; Altronics H0191]
1 Raspberry Pi Pico programmed with 0711223A.UF2 (MOD1)
1 Raspberry Pi Pico programmed with 0711223B.UF2 (MOD2)
1 Raspberry Pi Pico programmed with 0711223C.UF2 (MOD3)
1 HDMI-compatible socket (CON1) [Stewart SS-53000-001]
2 USB-A through-hole right-angle sockets (CON2, CON3)
1 USB-C power-only SMD socket (CON4) [GCT USB4135 or similar]
3 6mm through-hole tactile switches (S1-S3)
4 2-pin headers (JP1-JP4)
1 4-pin header (LK1)
6 jumper shunts (JP1-JP4, LK1)
6 20-way header pins (optional; for MOD1-MOD3)
6 20-way header sockets (optional; for MOD1-MOD3;
will not fit in H0190 enclosure unless low-profile types are used)
4 self-adhesive feet to suit the enclosure (eg, 8mm round)
Semiconductors
2 2N7002 SMD N-channel Mosfets, SOT-23 (Q1, Q2)
3 green 3mm through-hole LEDs (LED1-LED3)
Resistors (all M2012/0805 size SMD, 1/8W, 1%)
6 10kW
2 5.1kW
3 1kW
8 270W
4 22W
The Terminal is a compact device that fits into a small ABS enclosure. The
three Pico microcontroller boards communicate with a USB keyboard,
provide a virtual USB-serial host interface and deliver a digital video
signal. The Pico or Pico H version will work (both are shown here).
Short-form kit (SC6917, $65): includes everything except the case. Choose which front panel
PCB you want (for Altronics H0190 or H0191). Picos are not supplied pre-programmed.
46
Silicon Chip
Australia's electronics magazine
Terminal also provides an ‘upstream’
USB-serial device interface that is
transparently passed through to the
downstream USB-serial device at
CON2.
This allows these boards to behave
as though they were connected
directly to a computer, even though
the Terminal sits in between. This
arrangement enables data from the
attached keyboard to be sent to the
Micromite or PicoMite. Similarly,
data from the Micromite or PicoMite
can be displayed on the digital video
output, while still being monitored by
the computer.
The Terminal will also work with
many low-cost USB-serial adaptors,
allowing it to communicate with a
computer. We have verified that those
based on the CP2102 chip work.
VGA PicoMite comparison
You might also be wondering what
the Pico Digital Video Terminal offers
that the VGA PicoMite does not.
The VGA PicoMite (July 2022 issue,
siliconchip.au/Article/15382) supports some advanced graphics options
that the Terminal does not. Otherwise,
using a regular PicoMite or WebMite
with this Terminal is similar to working with a VGA PicoMite.
The main differences are that you
need a PS/2 keyboard and VGA monitor or adaptor to use the VGA Pico
Mite, while the Digital Video Terminal lets you use a USB keyboard and
HDMI monitor.
We did recently publish a USB to
PS/2 Keyboard Adaptor (January 2024;
siliconchip.au/Article/16090) that lets
you use a USB keyboard with the VGA
PicoMite, but you’re still stuck with
needing a VGA monitor or a VGA-toHDMI adaptor.
It is possible to combine a VGA
PicoMite with the Digital Video Terminal to get a dual-screen PicoMite
setup, also allowing you to use a USB
keyboard. It could even be a triple
screen if you connect an LCD panel
to the PicoMite!
The Terminal will work with many
types of development boards and not
just the ‘Mites. Some Arduino boards
and even boards that can run versions
of the Python language (like MicroPython and CircuitPython) will work
with the Terminal.
It does not even have to be a separate
development board. You can actually
build the Terminal with a PicoMite
siliconchip.com.au
or WebMite embedded onto the main
PCB and enclosed in the same compact case!
We wouldn’t be surprised if some
readers modified our software to create a complete, standalone device that
doesn’t need an external board to be
connected. We’ll detail some compatible devices later.
A word of warning
The Pico Digital Video Terminal
uses an open-source software library
to generate the digital video signal, and
this library ‘overclocks’ the RP2040
microcontroller on the Pico to achieve
the necessary timings. The original
library by Luke Wren can be found at
https://github.com/Wren6991/PicoDVI
We are using a fork (derivative
work) from Adafruit that interfaces the
library with the Arduino IDE, available from https://github.com/adafruit/
PicoDVI
We are using much the same hardware as Luke used in his prototypes;
many other people have also tried
this library. It’s impressive that it can
generate digital video from a cheap
and readily available microcontroller board.
Luke notes that the signalling generated by our circuit is probably not
wholly compliant with all the DVI and
HDMI specifications. Nonetheless, it
appears to pass all the critical tests.
In the year or so since this library
was released, many projects have
used this software and custom RP2040
boards have been created for generating digital video. We have yet to hear
of anyone who has had problems due
to the overclocking or the signalling
variances.
The RP2040 on our prototype runs
at nearly double its specified 133MHz
and is barely warm. Every HDMI
monitor we have tried has displayed
the video correctly. We haven’t tried
extreme cases like very long HDMI
cables, but we see no reason for that to
cause problems. So, this project does
some things that are not ‘in spec’, but
we and many other people have found
it to work well.
Connections
Fig.1 shows how and where external devices connect to the Terminal
and how it is arranged at a block level.
Assume that we are using the Terminal with a device like a Micromite, it
will connect through USB connector
CON2.
A complete, standalone system can
be made by plugging a USB keyboard
into CON3 and connecting a suitable
display into CON1. 5V power is provided to USB Type-C connector CON4,
feeding all the connected devices.
Keys typed on the keyboard are converted to serial sequences by MOD3
and are transferred over the internal
serial link to MOD2, which passes
them over the CON2 USB connection
to the Micromite (or PicoMite etc). The
Micromite sends data back to MOD2,
from where it is sent to MOD1, which
behaves as a terminal display device
and delivers video via CON1.
With a Micromite, the serial data
(from MOD3 to MOD2 and MOD2 to
MOD1) takes the form of ASCII characters and VT100-compatible Escape
codes.
Thus, you can type on the keyboard,
and the Micromite will respond as per
its programming and display its output
on the monitor connected to CON1.
The output on CON1 is intended to
mimic a terminal program such as
TeraTerm.
If you connect a computer to the
micro-USB socket of MOD2, you can
communicate with the Micromite as
though it were directly connected to
the computer; MOD2 will also transparently pass data between these interfaces. The grey lines show the path of
data to and from the Micromite.
A USB-serial interface is also provided on MOD3 to allow for the configuration of the keyboard interface
properties. Each of MOD1-MOD3 has
one LED that can be used to show the
status of their respective connected
device.
Of course, a Micromite is not the
only device that can be connected to
the Terminal. We will look closer at
what devices are compatible with the
USB-serial host interface of MOD2,
which includes several other development boards.
Fig.1: this block diagram shows how the three Picos (MOD1-MOD3) interact and the external interfaces they provide.
MOD1 delivers a DVI digital video signal to CON1, MOD2 communicates with the target computer via CON2 and
MOD3 interfaces with the USB keyboard at CON3.
siliconchip.com.au
Australia's electronics magazine
March 2024 47
Circuit details
Fig.2 shows the detailed circuit
of the Pico Digital Video Terminal.
MOD1, MOD2 and MOD3 are Raspberry Pi Pico microcontroller boards
loaded with different firmware. They
each perform one of the main functions of the Pico Digital Video Terminal.
We will explain in detail why there
are three separate microcontroller
boards in the Software section and
what the firmware does there, too.
The VBUS pins of MOD1-MOD3
are connected together, along with the
VBUS pins of CON4, a USB-C socket.
The CC1 and CC2 (configuration channel) pins of CON4 are each connected
to ground via 5.1kW resistors, which
presents the Terminal as a power sink
requesting 5V. This is necessary for
compatibility with USB-C.
Any of MOD1-MOD3 and CON4 can
supply 5V to the circuit. Power would
typically come from CON4 if the Terminal is not connected to a computer,
or MOD2 if it is connected to a computer. MOD1-MOD3 might also be
connected to a computer for configuration purposes.
Since each Pico provides a distinct
48
Silicon Chip
function, we will discuss each in
turn before describing how they work
together. Note that each Pico has a corresponding connector, switch and LED
numbered the same. MOD1 connects
to CON1, S1, LED1 and so forth.
MOD1
MOD1 is responsible for generating
a digital video signal to send to CON1.
Its GP12-GP19 (general purpose I/O)
pins are each connected to a pin of
CON1 via 270W resistors.
With the cable impedance of around
50W, each of these pins will sink 10mA
when pulled low by the microcontroller or not sink any current when high.
The pins are arranged in pairs driven
in a complementary fashion, providing the current-mode differential signalling needed.
More detail on the TMDS signalling scheme that encodes the video
data can be found in the panel titled
“DVI-D, HDMI and TMDS standards”.
MOD1’s GP9 pin (pin 12) also connects
to green LED1 via a 1kW resistor, which
is used as a status indicator.
S1 is wired between MOD1’s 3V_
EN pin and GND. When pulled low, it
shuts off the 3.3V regulator that powers
Australia's electronics magazine
the RP2040 microcontroller on MOD1,
effectively resetting the micro.
JP3 and JP4 are wired to GP8 and
GP7 (pins 11 & 10), respectively, with
the other side grounded. The software applies an internal pullup and
can thus check the jumpers’ states by
checking the voltage pin levels. The
software uses these for configuration.
GP10 and GP11 (pins 14 & 15), configured as I2C SDA (data) and SCL
(clock), are wired to a 3.3V-to-5V level
shifter consisting of Mosfets Q1, Q2
and the associated 10kW resistors. We
used a similar scheme in the USB to
PS/2 Keyboard Adaptor project mentioned earlier, to interface the 3.3V
microcontroller to 5V PS/2 keyboard
levels.
The operation of this part of the circuit is explained in that article; the
design is well-suited to open-drain
busses like I2C and PS/2. A low level
on either side is propagated to the
other side; without a low logic level
on either side, the respective pullup
resistors maintain the lines at high
logic levels.
The 5V side of the circuit is connected to the DDC (Display Data Channel) SDA and SCL lines of the CON1
siliconchip.com.au
Fig.2: the full circuit shows the eight 270W resistors that limit the current for the TMDS links of the DVI connection to
the correct level; around 10mA. The two USB host Picos (MOD2 and MOD3) require only a USB-A socket and a pair of
resistors to perform their roles. Most of the remaining circuitry provides communication between the Picos.
HDMI connector. This interface can be
used to interrogate an I2C EPROM on
the display device to check its capabilities.
CON1 also provides 5V to the display via JP2. This can power the
EPROM on the display device, even
when the display is switched off. The
display can also connect the 5V back
to the HPD (hot plug detect) pin on
CON1. The 10kW/10kW divider allows
the Pico to safely detect the presence
of a connected display at its analog-
capable GP27 input pin (pin 32).
MOD2 and MOD3
The circuitry around MOD2 and
MOD3 has been intentionally kept
similar to MOD1 to simplify development. We imagine readers will have
different ideas for things that can be
done with this hardware, in conjunction with different software.
Like MOD1, MOD2 and MOD3
have their switches (S2 and S3) wired
between the 3V_EN pin and GND.
Unlike MOD1, MOD2 and MOD3 have
their respective LEDs connected to
GP14 (pin 19) via 1kW resistors. These
LEDs are otherwise identical status
indicators.
siliconchip.com.au
The remaining circuitry connects
USB-A sockets CON2 and CON3 to
their respective boards via 22W series
resistors. Readers might recognise this
from the USB to PS/2 Keyboard Adaptor, which used a similar arrangement
to interface the regular GPIO pins GP15
and GP16 (pins 20 & 21) to a USB connector.
Jumper JP1 connects MOD3’s GP14
to MOD2’s GP17 pin. This gives MOD2
a second status LED in case MOD3 is
not used. Our original design planned
to use a single Pico for both USB interfaces; we will revisit that in the Software section.
Interconnections
Apart from the VBUS and GND
lines that are interconnected around
the circuit, there are serial data pairs
(RX and TX) between each of MOD1,
MOD2 and MOD3. The RP2040 has
two UART peripherals, so each module has two incoming and two outgoing connections, one to each of the
other modules.
The following explanation expects
two jumper shunts to be fitted to LK1.
One is fitted between pins 1 and 2; the
second is between pins 3 and 4.
Australia's electronics magazine
Both MOD2 and MOD3 communicate with MOD1 using their UART0
peripheral on GP0 (pin 1, TX) and GP1
(pin 2, RX). These are crossed over and
connected to MOD1 at its UART0 for
MOD2 and UART1 for MOD3 (GP4,
pin 6, TX and GP5, pin 7, RX).
MOD2 and MOD3 connect to each
other via their crossed-over UART1
pins; this means that pin 6 (TX) of
MOD2 connects to pin 7 (RX) of MOD3
and vice versa. Note how this continues the theme that MOD2 and MOD3
have much the same external connections.
An alternative configuration of
LK1 involves fitting a single jumper
between pins 2 and 3. In this case,
data from MOD3 comes into MOD2’s
UART0 instead of UART1.
You can probably see the spirit of
how the Terminal achieves its aims,
but of course, the detail is in the software.
Software
The firmware on all three Pico
boards makes good use of the RP2040
PIO (programmable input/output)
peripheral. We discussed the PIO
peripheral in our review of the Pico
March 2024 49
DVI-D, HDMI and TMDS standards
DVI (Digital Visual Interface) was a
standard developed in the late 1990s as
a progression beyond the analog VGA
(Video Graphics Array) interface. Part of
the motivation was to switch to a digital
communication format due to the increasing prevalence of digital displays like LCDs,
removing the need to convert to and from
an analog signal as required by VGA.
Cathode ray tubes are analog in nature,
requiring, for example, a ramped analog
voltage to perform the horizontal and vertical scanning of the display area. Plasma
panels, LCDs and OLEDs are more digital,
having discrete pixels rather than a continuous phosphor surface, hence the preference for a digital interface.
Our series on Display Technologies
(September and October 2022, siliconchip.
au/Series/387) has more background on
those different technologies.
Despite the name, DVI can carry an
analog VGA signal, which made it wellsuited to the transition away from VGA.
In practice, there were DVI-D (digital),
DVI-A (analog) and DVI-I (integrated [digital and analog]) variants of the cables
and connectors.
DVI can only work if the display adaptor,
cable and display all support the same digital or analog variant. For example, a DVI-D
Fig.a: HDMI connectors carry
many of the same signals as a DVI
connectors, although they omit the
analog (VGA-compatible) signals;
HDMI is purely digital. Pins 1-12
carry the TMDS lines and are
sufficient for a working video signal.
50
Silicon Chip
output will only work with a DVI-D or DVI-I
cable and a DVI-D or DVI-I input socket on
the monitor.
It is the digital variant of DVI signalling
that the Terminal implements. However,
the connector itself is HDMI due to the
ubiquity of displays equipped with HDMI
sockets. It is possible to connect a DVI
display to the Terminal using nothing more
than a passive HDMI-DVI cable or adaptor.
HDMI high-definition multimedia interface
Similarly to how DVI was backwards-
compatible with VGA signals, HDMI is
also compatible (by design) with a subset
of DVI-D. One of the main advantages of
HDMI is that the connector can carry digital audio, video, control signals and even
data network traffic.
The overlapping parts of DVI and HDMI
that we are implementing in the Terminal
use TMDS (transition minimised differential signalling). We will explain that below.
Fig.a shows the pinout of the signals
carried by HDMI cables; pins 1-12 have the
TMDS signals and their shields.
Newer versions of HDMI use higher
data rates, compression and encoding
schemes. For example, they can also
implement different colour spaces, including HDR (high dynamic range), while
DVI-compatible signalling uses a straightforward 24-bit RGB colour representation.
HDMI adds other data channels between
the video source and the sink (or display),
and we have added a provision to interface
to one of these, although nothing apart
from TMDS is necessary for the Terminal
to drive a video display.
The DDC (display data channel) allows
the HDMI source to determine what video
formats a sink can accept. Since all HDMI
devices must comply with the baseline DVI
specification, implementing DDC is unnecessary, as we are not producing a signal
beyond the baseline.
The DDC used on HDMI is electrically the
same as I2C. It is implemented (on the display or sink) as an I2C EPROM with a 7-bit
I2C address of 0x50; a host can read this
to find the display’s capabilities.
We have connected these pins to a pair
of I2C pins on MOD1 via a level converter,
allowing it to read the sink’s DDC chip. A 5V
supply is provided by the HDMI source to
power the EPROM, so it can be interrogated
even if the device itself is switched off.
Internally, the source also connects that
5V back to the HDMI HPD (hot plug detect)
Australia's electronics magazine
pin, allowing the source to detect when a
sink is connected. The sink may also be
able to disconnect the HPD pin, for example, when switched on or off.
HDMI implements other communication protocols that we have not provided
connections for. Some of these protocols are not specified in all versions of
the standard, but we’ll note them here for
completeness.
Consumer Electronics Control (CEC) is a
one-wire bidirectional serial bus. It allows
connected CEC-capable devices to control
other devices. This means, for example,
that a single remote control can operate
many devices.
Audio Return Channel (ARC) allows
audio to be sent ‘upstream’. A typical use
for this would be when a TV is showing
a source that does not come from the
receiver (eg, a tuner built into the TV). In
that case, the ARC channel can send the
audio to the AV receiver to route to its
speakers.
HDMI Ethernet Channel (HEC) allows
Ethernet communications over HDMI
cables, but it has been deprecated in the
most recent HDMI versions. WiFi has
mostly taken over its role of providing
internet connectivity.
TMDS transition-minimised differential signaling
The critical part of both DVI and the
baseline HDMI standard is the transition-
minimised differential signalling that
sends the video signal from the source
to the sink. It consists of four shielded,
twisted pairs of wires, each carrying a
differential signal.
Differential signals over twisted pairs
make the receiver somewhat immune to
common-mode noise since a similar signal will be induced in both wires in the
pair from an external source. When the
difference of the signals is calculated at
the sink, the noise effectively cancels out.
Also, the available voltage swing is
double what it would be with a single line,
adding 6dB of headroom to the signals.
Of course, HDMI is not the only technology that uses differential signalling.
Serial standards such as RS-485 also use
differential signalling, as do USB and Ethernet over twisted pairs (eg, 10BASE-T and
100BASE-T).
Electrically, the signalling scheme
requires that one wire of each pair alternately sinks 10mA (from a 3.3V rail in the
video sink by the video source). Which wire
siliconchip.com.au
sinks the current determines if it is a ‘0’ or
‘1’ being sent.
In practice, the Terminal hardware drives
its pins high (to 3.3V) or low, achieving
the same effect. The cable impedance in
series with the 270W resistors allows the
right amount of current to flow.
This is quite a high-speed signal for
a microcontroller to send off-board, and
quite a bit more engineering is involved
than this simple explanation implies. Still,
it should give you an idea of what the Pico
needs to do at the hardware level.
8b/10b encoding
TMDS uses a coding scheme that
reduces the number of transitions that
need to occur over the twisted pair, which
reduces electromagnetic emissions.
The clock differential pair has a 50%
duty cycle and operates at a frequency
equal to the pixel clock, thus giving two
transitions per pixel. PLL (phase-locked
loop) hardware at the sink allows the fullspeed bit clock to be recovered without
having to be transmitted over the HDMI
link.
The three other pairs each carry a series
of eight-bit data bytes encoded into 10
bit-times (hence 8b/10b encoding), meaning that there is one 24-bit pixel transmitted per pixel clock (see Fig.3 overleaf).
Note that other different 8b/10b encoding
schemes also exist.
Of the 1024 combinations possible with
10 bits, 460 are selected to encode eightbit colour values; this means that some
values have more than one encoding. Four
further combinations are used to encode
control data and are chosen to have a relatively high number of transitions to assist
with clock recovery.
The four control combinations encode
two bits of data. On one of the colour
channels (channel 0, blue), these encode
the horizontal sync and vertical sync signals. The sync signals are naturally sent
outside the times that colour information
is transmitted. Channel 1 is allocated to
the green component of the video signal,
while channel 2 carries the red component.
The timing of a baseline (640×480 pixel)
digital DVI signal is practically identical
to the corresponding VGA signal, but with
digital signals instead of analog, so only
the digital encoding and decoding steps
need to be added (to analog VGA), with
no changes in timing.
A frame of 640×480 video actually consists of 800 horizontal and 525 vertical
pixels. 800×525×60Hz (60 FPS) gives the
25.2MHz pixel clock rate. Fig.b shows
how such an analog VGA signal would be
encoded and then recovered.
Another desirable property is for the
running average DC level to be low. The
coding scheme helps with this, as it allows
10-bit symbols with a high DC offset to
be avoided. In this case, a zero DC offset means a long-term equal number of
‘0’ and ‘1’ bits.
The eight-bit values with more than one
encoding have 10-bit values with opposite
DC offsets, so even long runs of the same
eight-bit value can be transmitted with a
combination of symbols that result in a
low combined DC offset.
The remaining codes with only one
encoding and the control codes mostly
have an equal number of ‘0’ and ‘1’ bits, so
they can be transmitted without affecting
the DC offset appreciably.
The Terminal does not transmit audio,
but HDMI allows that to be carried (along
with other data) during the sync periods
by using control codes to signal the presence of audio data.
Fig.b: this shows how the signals found in a VGA analog video signal (on the left) can be encoded to be sent over a fourchannel TMDS link and then back. So, the four-channel TMDS link can be seen as a digitally encoded version of a VGA
signal.
siliconchip.com.au
Australia's electronics magazine
March 2024 51
Fig.3: the four differential pairs of a DVI signal look similar to this if seen
on an oscilloscope. Note the symmetry and DC balance of all the signals.
in December 2021 (siliconchip.au/
Article/15125).
It is a specialised processor that
implements a few instructions focused
on I/O pins. It can easily emulate
serial communication peripherals like
UART and SPI, or produce PWM signals, including those needed to drive
a servo motor.
There are two PIO peripherals and
each has four state machines. The state
machines are the ‘processors’, so up
to eight separate emulated peripherals can be created on the RP2040 chip.
Each PIO has a memory that can
hold 32 instruction words. Each state
machine has a four-word deep input
FIFO (first-in, first-out) buffer and a
similar output FIFO buffer. If only
input or output is needed, the two
FIFO buffers can be combined into
a single eight-word buffer. Being a
32-bit architecture, the words are 32
bits wide.
Each state machine also has an input
shift register and an output shift register. These take in chunks of data and
shift them in or out one or more bits
at a time, as is needed for the serial
protocols noted earlier.
The DVI implementation is a good
example of a simple use of the PIO.
Each pixel in a DVI video stream
consists of 10 bits clocked out very
quickly. The nominal pixel clock of a
typical baseline 640×480 at 60Hz signal is 25.175MHz; the bit clock is thus
10 times that: 251.75MHz.
The PIO operation for DVI video
involves passing 10 bits of data at a
Making an all-in-one computer
Replacing MOD2 with a Pico (or Pico W) programmed with different firmware is
possible. This is the reason for link LK1. A shorting block can be fitted between
pins 2 and 3 of LK1, and the serial data streams from MOD3 and towards MOD1
are now both connected to UART0 on GP0 and GP1. The following PicoMite
BASIC OPTION can be set to use UART0 (on GP0 and GP1) as the console:
OPTION SERIAL CONSOLE 0,1,B
The default baud rate used by MOD2 and MOD3 is 115,200, which should
match the PicoMite’s default. If necessary, it can be changed with another
option.
OPTION BAUDRATE 115200
The PicoMite is now integrated into a computer with a USB keyboard and
digital display interfaces. It’s a bit trickier than usual to access the spare I/O
pins. Still, if you were looking to experiment with the BASIC language or perhaps the WiFi interface of the WebMite, it would make a compact machine
for those purposes.
You could also write your own code to run in place of MOD2, creating a custom computer. There are several projects around that emulate older computer
platforms using the Pico.
52
Silicon Chip
Australia's electronics magazine
time into the PIO’s FIFO, which it
then simply clocks out serially at the
bit clock rate. The RP2040 also has a
direct memory access (DMA) peripheral, which we use to ensure that the
PIO is consistently fed data from RAM
without requiring the main ARM processor’s attention.
The processor simply needs to set
data in RAM and arrange for the DMA
peripheral to move that into the PIO
as needed. The nominal 251.75MHz
figure noted earlier dictates the overclocking needed; the Pico is clocked
at 252MHz, resulting in a signal that
is within VESA tolerances.
The DMA and FIFO actually handle
data in 20-bit blocks, sending two pixels at a time. In theory, the 32-bit ARM
processor could work with blocks of
three pixels (or 30 bits), but three does
not divide into the 800 pixels that
constitute each horizontal scan line
(including sync periods).
A good amount of data still needs
to be generated to feed the PIO. Therefore, one of the two processor cores on
the Pico is dedicated to encoding data
from an RGB or monochrome frame
buffer into the TMDS form that the
PIO requires.
The other core of the MOD1 Pico listens in on its serial ports and behaves
as a VT100 terminal. The VT100
was a ‘dumb terminal’ introduced in
1978. They were standalone hardware
devices that allowed numerous users
to connect to a large mainframe computer over a simple serial interface.
Nowadays, they mainly exist as software emulations by serial terminal
programs such as TeraTerm or minicom that can run on a desktop or laptop computer.
The VT100 standard allows ‘Escape
codes’ to perform functions like moving the cursor around, changing the
text colour and clearing the screen.
They are called that because they
start with the ASCII Escape character (0x1B).
Since the various Micromites and
PicoMites use the VT100 protocol,
this is the most straightforward way to
interface with them. This also means
that MOD1 (and its associated components) behaves effectively like a dumb
display terminal.
MOD1 maintains a buffer of characters and their attributes (such as colour
or underlining) and manipulates the
buffer according to the data that arrives
on its serial port. The buffer is then
siliconchip.com.au
rendered for display and sent to CON1
as a DVI video signal.
LED1 is illuminated whenever
MOD1 detects a voltage from the HPD
pin of CON1, which indicates that a
display device is connected.
MOD2
MOD2 uses the Adafruit TinyUSB
software library to allow it to behave as
a USB host to a USB-serial device. The
library incorporates the Pico-PIO-USB
library, which allows the USB interface to operate on a pair of GPIO pins.
We use the PIO peripheral to
implement a USB port instead of the
RP2040’s dedicated USB peripheral for
two main reasons. Firstly, connecting
to the GPIO pins is much easier since
the internal USB data pins are only
available at the Pico’s onboard USB
socket or two test pads on the Pico’s
underside.
Secondly, it gives us two USB ports,
allowing the Terminal to transparently
connect the Micromite (or whatever is
connected via CON2) to a computer,
both relaying and intercepting data
between the Micromite and the computer.
That is most of what MOD2 does.
It bridges the link between the device
connected at CON2 and a computer
connected at MOD2’s micro-USB
socket. It can also inject data received
from MOD3 as well as exfiltrate data
to MOD1, as shown in Fig.1.
The LED connected to GP14 is
illuminated whenever a compatible
device is connected to CON2 and flickers when data is received from MOD3.
The Pico-PIO-USB library uses
nearly all of the PIO resources, which
is the main reason why we need a dedicated Pico for this role and can’t integrate it with either of the others.
MOD3
Like MOD2, MOD3 also uses the
Adafruit TinyUSB software library to
allow it to behave as a USB host, except
in this case, it expects a keyboard to be
connected. Thus, the circuitry around
MOD3 can be much the same as MOD2,
but the software is different.
The software has much in common
with the USB to PS/2 Keyboard Adaptor; that project translates strokes from
a USB keyboard into PS/2 scancodes,
while MOD3 on the Terminal translates them to serial data and VT100
Escape codes.
It also monitors the Number Lock,
siliconchip.com.au
Silicon Chip
kcBBack
a
Issues
$10.00 + post January 1995 to October 2021
$11.50 + post November 2021 to September 2023
$12.50 + post October 2023 onwards
All back issues after February 2015 are in stock, while most from January 1995 to
December 2014 are available. For a full list of all available issues, visit: siliconchip.com.
au/Shop/2
PDF versions are available for all issues at siliconchip.com.au/Shop/12
We also sell photocopies of individual articles for those who don’t have a computer
Scroll Lock and Caps Lock keys and
changes the state of the keyboard
LEDs to suit. The serial data it delivers depends on the state of the Number Lock and Caps Lock keys.
MOD3 lights up LED3 whenever it
detects a keyboard is connected and
flickers it briefly whenever a key is
pressed or released. You will see different patterns on LED2 and LED3
during regular operation.
Our early prototypes combined
MOD2 and MOD3. The Pico-PIO-USB
library can support a USB hub so multiple devices can be connected, but it
only supports a single hub. Many USB
keyboards incorporate a hub, at least
internally, so we found that many keyboards did not work when connected
through a hub.
Since a Pico is much the same price
as even the cheapest hub we could
find, we opted to simply add another
Pico and USB socket. It is a more elegant solution as everything fits neatly
into a single enclosure.
While MOD2 and MOD3 can only
perform the specific role they have
been programmed for, the symmetrical arrangement of their external connections means that they can be physically transposed on the PCB with only
minor software changes.
Hardware notes
That is all we can fit into this article, so next month’s second part will
describe assembly, testing, configuration and use. We have provided the
parts list this month to allow you to
collect various components needed
for assembly.
The design uses a few SMDs, but
they are primarily passive parts in
M2012 size, so they are not too difficult
to solder. The HDMI socket has pins
at a 0.5mm pitch, so it is probably the
most challenging part to solder. Still,
it is not too difficult if you have good
flux paste on hand, decent lighting and
perhaps a magnifier.
There are two case options. One
option is to use the 25mm-high Altronics H0190 (or equivalent). This has a
corresponding front panel PCB that
is coded 07112232. This case is ideal
if you plan to permanently solder the
Picos to the PCB via pin header strips.
An alternative is the 30mm tall
H0191, which uses a front panel PCB
coded 07112233. This case allows you
to fit MOD1-MOD3 using sockets, so
they are removable. That might be
handy if you are considering using
an alternative firmware for MOD2, as
described in the panel (“Making an
SC
all-in-one computer”).
Other configurations for advanced users
While the Terminal we are describing here is intended to parallel the ASCII
Video Terminal in function, the modular nature of this project means that it
can be altered to work in various ways.
For example, you could build the Terminal with only the parts surrounding
MOD1 and use it to deliver a custom video signal to a modern digital display.
Fitting just MOD2, its USB socket and surrounding components will give you
a USB-serial interceptor device like the one we plan to describe in an upcoming Circuit Notebook.
Fitting just MOD3 and its associated components will give you a device with
similar capabilities to the USB Keyboard Adaptor for Micros (February 2019;
siliconchip.au/Article/11414).
However, all of these options require the Pico to be wired up to another
device via a serial link to be useful.
Australia's electronics magazine
March 2024 53
|