mailto: blog -at- heyrick -dot- eu

More thoughts on interfacing

The good thing about "thinking aloud" is that it enables you to go through various ideas and get feedback. In the previous post, Zerosquare said:
Hmmm, unless there's something I don't get, isn't there a simpler solution and faster solution? Connect the programmer's bus connector directly to the pins of a 5V-capable Arduino (or similar). No need to add chips to do level-shifting and serial/parallel conversion.

This is a perfectly reasonable question, and the answer is "I didn't think of it".

The longer answer is that I'm sort of vaguely aware of 5V Arduino boards using an ATMega chip, but having fallen into a rabbit hole this morning, it would appear that you can have one of:

  • 5V logic signals
OR
  • A decent amount of memory
But you can't have both.

The Arduino (Dué? Mega?) devices with the ARM processors offer a ton of digital I/O, something like 44 pins, which is far more than necessary to replicate a 34 pin 1MHz bus (where I think only twenty pins are necessary for our purposes - 8×data, 8×address, !PageFC, 1MHz, R/!W, and 0v). However these boards work at 3.3V so would still need level shifting.

The simpler Arduino Uno R3 devices with the Atmel processor offer much less in the way of digital I/O. There is technically the possibility of 19 I/O pins, which with a Ground would be sufficient, but alas also useless. D0/D1 are the serial port, you won't get far without these. Plus three pins are connected to internal LEDs that may be controlled by firmware.
A much bigger concern is that the Atmel chip offers quite a large flash (something like 32K) but a teensy tiny amount of SRAM, only 2K. I don't know how much the runtime libraries require, but the program code shouldn't need a lot. It may be feasible to read/write an EPROM in 1K chunks? At any rate, it makes things a little harder.

But not impossible.

Doing some more digging, it appears as if the PCF8574 needs to have all pins set to high before reading. When high there's a weak pullup so anything driving a pin low will override that and it'll read as a logic low. Well, fine, but how does that look on the far side of a level shifter? If the shifter is driving high whilst the peripheral is driving low... that sort of thing tends to lead to stuff losing the magic smoke that makes them work.

So to revise the plan, an Arduino Uno R3 with an MCP23017 add-on. The Uno is the base machine, and the 23017 is controlled by IIC to give sixteen digital I/O ports, organised as 2×8. Better yet, it is a proper PIA so each port has a data direction register (so can be specifically set to be input and output) and with the ability to weakly pull up and connect to 5V logic, this can directly control the data and address signals without anything getting in the way. The other three signals can come from regular I/O pins on the Arduino board.

How to talk to it from a host? Serial port. I don't yet know how to transfer the binary contents - there's a part of me that would say "just use X-modem and read/write in 256 byte chunks", and it looks like Minicom can handle this.

Well, that's as far as I am looking at the moment, and to my mind it seems more viable than the PCF8574s with level shifters. That's not to say the PCF8574s that I have are useless - they'll work at 5V as well as 3.3V (but not translate from one to the other) and I'm sure I can find something fun to do with them.

 

Messing around with an ESP8266

It is starting to get dark, already. I guess the day goes quickly when you get up at noon. I wasn't sleeping, I was reading datasheets on my phone. Because, yeah, that's a totally cool way to pass the time...

I came across an old ESP8266 module which powered up, sort of, but didn't seem to do anything.

A tiny ESP8266 board connected to a USB serial interface.
An early ESP-01 ESP8266 board.

Well, I wasted an hour until I found out that even though this thing has only eight pins, one of them must be tied to +ve before the thing will even start up. I guess this is so it can be powered down in-circuit or something, but... sheesh.

If your ESP-01 ESP8266 module starts with only the red LED on and appears otherwise dead, you need to tie the 3.3V and the PD_EN pins together. That's the bottom right (3.3V) if the two chips are facing you and the antenna is furthest away, and the 2nd along on the lower row (or next-to-but-one from 3.3V).

The next problem was trying to work out what was actually in this thing. It started up like this:

bprlrl
Ai-Thinker Technology Co. Ltd.

ready
WIFI CONNECTED
WIFI GOT IP

If I typed AT, it would reply with an error.

AT

ERROR

Replying "ERROR" like that felt like it was the AT interpreter, but why the error for everything?

Well, this is part two of the annoyance of this gadget. It insists upon the correct AT parlance of sending a command followed by a CRLF pair. Without that, it'll reply with an error. Problem is, modern stuff tends to just use an LF.

I was able to get further using Minicom, by pressing Enter followed immediately by ^J.
Unless I have missed something, there doesn't appear to be a way to get Minicom to automatically send a CRLF upon pressing Enter, so it has to be done manually.

One of my modems, it might have been the USR Courier, was smart in that you could type AT and then press Enter twice. It would notice what sort of line ending you were using and adapt itself. Really, the ESP-8266 firmware should have done something like this, or maybe a special AT+LFONLY command?

Anyway, once that was sorted, I could play around a little.

bprlrl
Ai-Thinker Technology Co. Ltd.

ready
WIFI CONNECTED
WIFI GOT IP
AT

OK
AT+GMR
AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd.
v1.5.4.1-a Nov 30 2017 15:54:51
OK

It is ancient old firmware so doesn't support a good number of commands. It was probably more or less contemporary with when I got this thing, though, as it has been in a drawer for years. The very restricted I/O made the ESP32 more interesting to play with.

Now let's try something.

AT+CIPMUX=1

OK
AT+CIPSTART=4,"TCP","192.168.1.10",80
4,CONNECT

OK
AT+CIPSEND=4,18

OK
>
Recv 18 bytes

SEND OK

The first line turns on concurrent connections. Then I open a connection to WebJames running on the Pi. I picked this as it's a simple HTTP server (I don't know if my firmware can do TLS) that doesn't need a complicated request.
Then I tell it to expect, and then send, eighteen bytes.
The eighteen bytes in question are GET / HTTP/1.0[CR][LF][CR][LF] which is the minimum request for a basic fetch from a non-shared server.

The device responded with:

+IPD,4,17:HTTP/1.0 200 OK

+IPD,4,161:Content-Length: 5972
Content-Type: text/html
Date: Sun, 14 Dec 2025 17:21:30
X-Server-Info: WebJames on RISC OS on a RaspberryPi 2.
Server: WebJames/0.48

+IPD,4,1460:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Rick's RaspberryPi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

[blah blah, a lot snipped]

</body></html>
4,CLOSED

Notice that it says "+IPD,4,161:". This means there are 161 bytes for connection 4. When those have been received, there will be another. You can see this before the DOCTYPE saying that there are 1,460 bytes to come. This will keep repeating until the end of the data. The most this firmware can handle at one time is 1,460 bytes.

 

Well, that unexpected detour was several hours evaporating like spilt water on a summer's day. Still, it's not as if I had anything planned.

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺
As of February 2025, commenting is no longer available to UK residents, following the implementation of the vague and overly broad Online Safety Act. You must tick the box below to verify that you are not a UK resident, and you expressly agree if you are in fact a UK resident that you will indemnify me (Richard Murray), as well as the person maintaining my site (Rob O'Donnell), the hosting providers, and so on. It's a shitty law, complain to your MP.
It's not that I don't want to hear from my British friends, it's because your country makes stupid laws.

 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

C Ferris, 15th December 2025, 10:47
Interesting - there seems to be some stuff that can be injected you - to liven up your immune system to fight 'C' over 2 Years - Hmm
Zerosquare, 16th December 2025, 00:09
From the "number of pins used" point of view, I2C is unbeatable, but being serial, it's also pretty slow.  
 
If you have enough I/Os for one 8-bit bus (but not two), one trick you can use is to connect it to the data bus directly, and also to address bus thru a 8-bit latch or register (e.g. 74HCT373). Write the address, lock the latch (or send a clock pulse to the register), and then you're free to read/write the data. 
 
I admit I didn't think of the limitation on the I/Os because I don't usually use "standard" Arduino boards. Instead I use ATMEGA328PB Xplained Mini boards directly from Atmel/Microchip. They use the same MCU, and while they're more expensive than the Arduino ones, they're also more versatile: 
- in addition to the standard "Arduino shield" connections, they add extra pads that expose more I/Os,  
spaced to fit nicely into a Veroboard. 
- they can run both in 3.3V mode (at 8 MHz) and 5V mode (at 16 MHz). 
- they include extra hardware that supports both serial-port-over-USB and external programming. So you don't have to use a bootloader if you don't want to, and IIRC you also have access to some debugging features. 
 
Let me know if you need more info, as there are a few non-obvious-at-first quirks (e.g. some features require soldering extra header pins and removing SMD components). There's also the ATmega324 Xplained board, which IIRC has even more I/Os, but is more expensive. I'm not sure how well-supported those boards are under Linux (I only use them with Windows), but at the very least, you should be able to use them as "standard" Arduino boards. 
 
Regarding the RAM size available, I think that's a non-issue in your case. At 16 MHz, the MCU's serial port maximum speed is 2 Mbps ; that should be plenty fast enough to stream the EPROM's contents with very little buffering. And you can reduce the RAM usage and boost the speed a lot by foregoing Arduino's notoriously bloated libraries, and using "bare metal" code instead. (Again, ask if you need some help on that.)
C Ferris, 16th December 2025, 20:02
Rick can you read this file? 
 
https://archive.org/details/tungsten_202506
Rick, 16th December 2025, 20:53
I grabbed a copy of that when it was announced on the forum, but didn't read it in much detail, just for curiosity. 
I clearly missed the part where the expansion card description says "All signalling takes place at 3.3V, with numerous benefits" and neglects to mention the downsides. 
That being said, the interface is clearly 5V tolerant (given all of the older cards work at 5V).  
The same cannot be said for most 3.3V devices. Feeding 5V into a 3.3V microcontroller pin, or pretty much any I/O pin on a Pi, *WILL* cause damage. 
I think I eventually roasted the serial port in one of my ESP32s because my serial dongle was working at USB levels and not stepping down to 3.3V. 
 
The USB serial interface that I'm using with the 8266 (pictured above) has a selection for 3.3V or 5V. Live and learn. 😉
C Ferris, 16th December 2025, 23:52
Hmm - can't seem able to download that file here -
Rick, 17th December 2025, 00:06
Using a real browser or using Netsurf? I think there's some scripting in there that might be the problem? 
 
Try this direct link.
C Ferris, 17th December 2025, 00:21
Chrome - something about it not being a secure connection:-(
C Ferris, 17th December 2025, 01:08
Memory slipping - I got someone else to download Tungsten back in June was big file.

Add a comment (v0.12) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 35873 backwards.
UK resident
Your comment
French flagSpanish flagJapanese flag
Calendar
«   December 2025   »
MonTueWedThuFriSatSun
24
8101112
151617181920
22232527
29    

(Felicity? Marte? Find out!)

Last 5 entries

List all b.log entries

Return to the site index

Geekery
 
Alphabetical:

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Last read at 17:43 on 2026/01/17.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2025 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2025/12/21
Return to top of page