Phoenix Air - WiFi for the H5 Phoenix
Phoenix Air - WiFi for the H5 Phoenix
I have been working on a new board for the H5 Phoenix, and it now has a name, Phoenix Air. It is a WiFi board for the Atari, designed with TLS support from the start, so things like HTTPS and secure mail are possible without a PC doing the hard work in the background.
It plugs into one of the 68k IO sockets on the Phoenix. Those sockets are copies of the 68000 CPU socket, so the board sits right on the full 16-bit bus. It does not use the cartridge port at all, so cartridges can still be plugged in and used at the same time.
The hardware is fairly simple. Two ATF1502 CPLDs handle the address decoding and the data side, and talk to an ESP32-S3 module over SPI. The module is the WROOM-1U version with 16MB of flash and 8MB of PSRAM, which gives TLS enough room to work in. It has a u.FL socket rather than an antenna on the module, so an external antenna on a short lead is needed. All the parts are on the top side, and the whole board fits inside the outline of the 68000 DIP64 footprint, about 81 x 25mm, on a 4 layer PCB.
On the software side, the ESP firmware is my own, and so is the network driver on the Atari. The driver will be STiNG and STiK compatible, the aim being that existing network programs work without any changes. The ESP does all the TCP/IP and TLS work, and the Atari just moves the data in and out, which keeps the load off the 68000.
As for speed, on paper the bus side works out at around 1.1 to 1.3MB/s in each direction on an 8MHz machine, and the limit there is the 68000 copy loop rather than the board itself. That is a calculated figure, not a measured one, so I will post real numbers once the boards are running.
Test boards have been ordered from JLC. The CPLD logic, the ESP firmware and the driver are all still to be written, so there is a fair bit of work to do yet. I will post updates as it comes together.
Re: Phoenix Air - WiFi for the H5 Phoenix
Added to my want list 
If it ain't broke, test it to Destruction.
Re: Phoenix Air - WiFi for the H5 Phoenix
Me too - and I might even get an H4/H5 board to the point where it is ready to use it!

Re: Phoenix Air - WiFi for the H5 Phoenix
I see soldering and firmware in my future...
Re: Phoenix Air - WiFi for the H5 Phoenix
Both ATF1502s showed up on the JTAG chain first time, which is always a relief. Getting the firmware to actually fit was another matter. The address decode chip went in without a fuss, but the data/SPI chip took four attempts before the fitter would place it. The logic was fine, it just ran out of routing inside the chip, so it needed a bit of rearranging until everything had a path. It now fits and passes the full simulation.
I then ran a small test program on the ST to check the CPLD side without any ESP firmware. It checks the control register, switches the ESP chip select on and off, does a load of data reads and writes to make sure every access gets DTACK back, and then times raw transfers.
Everything passes, including from a cold boot. The raw speeds in a tight loop came out at about 1190KB/s for writes and 1365KB/s for reads. That is just the bus side in an unrolled loop, so real copy loops and the network side will be slower, but it shows the hardware interface is doing its job.
Screenshot of the test results and some pictures of the board attached.
Next up is the ESP32 firmware. Of course some dumbass forgot to put a USB socket on the PCB to actually program the WiFi module. There are pads on the bottom to solder to, so I have had to order a USB breakout board to hack it together. Once the first firmware is on it, it should be able to update itself over WiFi, so with any luck that is a one-off.
I have also ordered an antenna, as the module uses an external one on a U.FL connector. Hopefully both turn up tomorrow and I can get some actual WiFi traffic going.
I then ran a small test program on the ST to check the CPLD side without any ESP firmware. It checks the control register, switches the ESP chip select on and off, does a load of data reads and writes to make sure every access gets DTACK back, and then times raw transfers.
Everything passes, including from a cold boot. The raw speeds in a tight loop came out at about 1190KB/s for writes and 1365KB/s for reads. That is just the bus side in an unrolled loop, so real copy loops and the network side will be slower, but it shows the hardware interface is doing its job.
Screenshot of the test results and some pictures of the board attached.
Next up is the ESP32 firmware. Of course some dumbass forgot to put a USB socket on the PCB to actually program the WiFi module. There are pads on the bottom to solder to, so I have had to order a USB breakout board to hack it together. Once the first firmware is on it, it should be able to update itself over WiFi, so with any luck that is a one-off.
I have also ordered an antenna, as the module uses an external one on a U.FL connector. Hopefully both turn up tomorrow and I can get some actual WiFi traffic going.
Re: Phoenix Air - WiFi for the H5 Phoenix
Phoenix Air update, or how a five minute job took all evening.
So the plan was simple. Parts arrive, wire a USB lead to the board, flash the ESP32, done. What could possibly go wrong.
First problem, some genius (me) designed the board with no USB socket on it. There are pads for it on the bottom, so technically it can be programmed, in the same way that technically you can drive to Scotland in first gear. Next board gets a proper socket. While I am at it, the JTAG header is going to move a couple of mm away from the 68K pins as well, because I managed to short both headers while soldering the JTAG header on. Lovely.
So I ordered a little USB breakout board and wired it to the pads on the underside of the PCB.
Then I needed an A to A USB cable to get from that to the PC. Could I find one? Of course not. So two cables got the chop and became one Frankenstein cable, wired straight through.
Plugged it in and Windows actually saw the ESP straight away, so the wiring was right first time. Then Windows 7 decided it had no idea what it was and refused to install any drivers.
Fine, there is a tool called Zadig for exactly this sort of thing. Except you tick "list all devices", pick the ESP interface, the list jumps about, and it very helpfully installed a USB driver on my keyboard instead. Keyboard dead. Excellent.
So then I am poking around Device Manager with a mouse trying to find my keyboard, chasing an "unknown device" which turned out to be nothing to do with it, before finally finding the keyboard hiding under "TOP PROGRAMMER", which is the driver group for my chip programmer. The programmer was not even plugged in.
Uninstalled that, deleted the driver, plugged the keyboard back in and it came back to life. *phew*
Next attempt, Espressif's own driver package. That pops up wanting to install itself as "TOP PROGRAMMER" as well, which after the keyboard incident filled me with confidence.
It only covers half of the ESP's USB port anyway, the JTAG side, and still no COM port. Turns out Windows 7 needs a separate little INF file for the serial side, which finally gave me COM4. Windows 10 apparently just does all of this by itself. Windows 7 does not, and it was not going to let me forget it.
After all that, the actual flashing took about one second. Typical.
The good news is the board then works properly. With test firmware on the ESP, the ST talks to it through the CPLDs and everything passes. Data goes both ways with no errors, a command and its reply takes about 225us, and it is doing about 517KB/s to the ESP and 602KB/s back, with a full 512KB each way. Most of that time is the 68000's copy loop rather than the board, so there should be more speed to come in the proper driver.
Next job is updating the ESP firmware from the ST itself over the same link, so the USB lead should never be needed again (hopefully). Then I can find out if it can even see the WiFi, and more to the point the internet.
All that for a missing USB socket. Lesson learned. Probably.

So the plan was simple. Parts arrive, wire a USB lead to the board, flash the ESP32, done. What could possibly go wrong.
First problem, some genius (me) designed the board with no USB socket on it. There are pads for it on the bottom, so technically it can be programmed, in the same way that technically you can drive to Scotland in first gear. Next board gets a proper socket. While I am at it, the JTAG header is going to move a couple of mm away from the 68K pins as well, because I managed to short both headers while soldering the JTAG header on. Lovely.
So I ordered a little USB breakout board and wired it to the pads on the underside of the PCB.
Then I needed an A to A USB cable to get from that to the PC. Could I find one? Of course not. So two cables got the chop and became one Frankenstein cable, wired straight through.
Plugged it in and Windows actually saw the ESP straight away, so the wiring was right first time. Then Windows 7 decided it had no idea what it was and refused to install any drivers.
Fine, there is a tool called Zadig for exactly this sort of thing. Except you tick "list all devices", pick the ESP interface, the list jumps about, and it very helpfully installed a USB driver on my keyboard instead. Keyboard dead. Excellent.
So then I am poking around Device Manager with a mouse trying to find my keyboard, chasing an "unknown device" which turned out to be nothing to do with it, before finally finding the keyboard hiding under "TOP PROGRAMMER", which is the driver group for my chip programmer. The programmer was not even plugged in.
Uninstalled that, deleted the driver, plugged the keyboard back in and it came back to life. *phew*
Next attempt, Espressif's own driver package. That pops up wanting to install itself as "TOP PROGRAMMER" as well, which after the keyboard incident filled me with confidence.
It only covers half of the ESP's USB port anyway, the JTAG side, and still no COM port. Turns out Windows 7 needs a separate little INF file for the serial side, which finally gave me COM4. Windows 10 apparently just does all of this by itself. Windows 7 does not, and it was not going to let me forget it.
After all that, the actual flashing took about one second. Typical.
The good news is the board then works properly. With test firmware on the ESP, the ST talks to it through the CPLDs and everything passes. Data goes both ways with no errors, a command and its reply takes about 225us, and it is doing about 517KB/s to the ESP and 602KB/s back, with a full 512KB each way. Most of that time is the 68000's copy loop rather than the board, so there should be more speed to come in the proper driver.
Next job is updating the ESP firmware from the ST itself over the same link, so the USB lead should never be needed again (hopefully). Then I can find out if it can even see the WiFi, and more to the point the internet.
All that for a missing USB socket. Lesson learned. Probably.

Re: Phoenix Air - WiFi for the H5 Phoenix
Phoenix Air update, part two. Same evening, fewer casualties.
With the USB lead finally sorted, the plan was to make sure I never need it again. So the ESP firmware can now be updated from the ST itself. You put the new firmware file on the ST, run a little program, and it sends it to the ESP over the same link the ST talks to it on. The ESP writes it into a spare slot, checks it, and only then switches over. If anything goes wrong part way, it just carries on running the old one.
Naturally the first thing I did was run the updater before putting the firmware on that actually understands updates. To be fair to it, it spotted that straight away and refused to do anything, which is exactly what it should do.
So one last flash over the dodgy USB lead, and that is hopefully the last time it gets used.
Then the real test, updating the ESP from the ST. Out it went, the ESP checked it, restarted into the other slot and kept it.
This is how it currently looks, sat in the 5V bus IO port on the H5 Phoenix, with the USB breakout still hanging off it on a bit of wire just in case.
Next up, the bit I was most worried about, can it actually see the WiFi? New firmware went on from the ST, no USB needed, and it found my network straight away along with a couple of the neighbours. Names blacked out, as I would rather not advertise who lives where.
Picked my network, typed in the password, it joined, got an address from the router, and then looked up exxosforum and connected to it. So the ESP is officially on the internet. My password is blacked out in the photo as the first test program showed it on screen in full. The newer one shows stars instead, lesson learned.
Then I wanted proof that real data comes back, not just a connection. So I put a little text page on the forum server and had the ST download it over HTTPS. First attempt got a "301 Moved Permanently" back, because the forum redirects to the www address and the firmware does not follow redirects yet. At least that proved the secure connection to the server was working, which is the hard part.
Pointed it at the www address instead and there it is, the test page on the ST screen, downloaded over WiFi with HTTPS and checked by the ST.
One odd moment along the way where the ESP did not answer after a reset and was fine after another reboot, so that is one to keep an eye on.
So in one evening it has gone from a board that could not be programmed without a hacked up cable, to an ST pulling a web page off the forum over WiFi. Not bad for a board that was ordered without being checked.
Next job is the proper network driver so normal STiNG programs can use it, and teaching the firmware to follow redirects.
With the USB lead finally sorted, the plan was to make sure I never need it again. So the ESP firmware can now be updated from the ST itself. You put the new firmware file on the ST, run a little program, and it sends it to the ESP over the same link the ST talks to it on. The ESP writes it into a spare slot, checks it, and only then switches over. If anything goes wrong part way, it just carries on running the old one.
Naturally the first thing I did was run the updater before putting the firmware on that actually understands updates. To be fair to it, it spotted that straight away and refused to do anything, which is exactly what it should do.
So one last flash over the dodgy USB lead, and that is hopefully the last time it gets used.
Then the real test, updating the ESP from the ST. Out it went, the ESP checked it, restarted into the other slot and kept it.
This is how it currently looks, sat in the 5V bus IO port on the H5 Phoenix, with the USB breakout still hanging off it on a bit of wire just in case.
Next up, the bit I was most worried about, can it actually see the WiFi? New firmware went on from the ST, no USB needed, and it found my network straight away along with a couple of the neighbours. Names blacked out, as I would rather not advertise who lives where.
Picked my network, typed in the password, it joined, got an address from the router, and then looked up exxosforum and connected to it. So the ESP is officially on the internet. My password is blacked out in the photo as the first test program showed it on screen in full. The newer one shows stars instead, lesson learned.
Then I wanted proof that real data comes back, not just a connection. So I put a little text page on the forum server and had the ST download it over HTTPS. First attempt got a "301 Moved Permanently" back, because the forum redirects to the www address and the firmware does not follow redirects yet. At least that proved the secure connection to the server was working, which is the hard part.
Pointed it at the www address instead and there it is, the test page on the ST screen, downloaded over WiFi with HTTPS and checked by the ST.
One odd moment along the way where the ESP did not answer after a reset and was fine after another reboot, so that is one to keep an eye on.
So in one evening it has gone from a board that could not be programmed without a hacked up cable, to an ST pulling a web page off the forum over WiFi. Not bad for a board that was ordered without being checked.
Next job is the proper network driver so normal STiNG programs can use it, and teaching the firmware to follow redirects.

