Adding wireless to the C64 via esp8266-01

Disk drives, Monitors, SuperCPU etc.
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

I'm starting this thread to document my attempt to interface the esp8266-01 module to the Commodore 64 for use at 2400baud (possibly 9600baud) for use in Commodore Telnet BBS systems without the additional requirement of another PC to facilitate the connection. I'll try to post as many links and information as I can for the items and software I'm using, but be warned, I'm not an Electronics Engineer. What works find for me, may/may not work for you and I certainly won't be responsible if you fry your C64 or electrocute your family pet in the process of replicating what I'm doing. I'm comfortable with the risks, but your mileage may vary.

Hardware Parts list so far

1 - ESP8622-01 (black edition) purchased from Ebay for about $4+ each in a set of three from an American reseller
1 - Solderless breadboard with hookup wire
1 - 10K and 20k resistors (or three 10k resistors)
1 - Solderless breadboard power supply (to provide 3v to the ESP8266 as the C64 userport is only rated at 100ma) Ebay $2
1 - CH341/CH340 USB to serial TTL adapter (switchable between 3v and 5v on the pins)
1 - Userport connector


Software:

1- CCGMS 17 (http://csdb.dk/release/?id=150993)
1- TerraTerm (https://ttssh2.osdn.jp/index.html.en)
1 - ESP8266 reprogramming howto & links. (http://www.allaboutcircuits.com/project ... fi-module/)


ESP8266 Commands which you need to become comfortable with:


AT+UART_DEF=2400,8,1,0,0 (Do NOT use AT+IRP=2400, see below)
Change Baud Rate

Update: 11/14/16

It appears that using the command AT+IPR=2400 has the tendency to lock up the module causing you to need to re-program it. The command AT+CIOBAUD=2400 works until you power cycle the module. AT+UART_DEF=2400,8,1,0,0 will save the setting permanently until you change it again.


AT+CWMODE=1
Puts the thing in client or 'station' mode, instead of access point mode.

AT+CWJAP="myssid","mypassword"
join an access point. Use AT+CWJAP_DEF="myssid","mypassword" to store it for default power state.

AT+CIPMODE=1
sets up transparent mode, otherwise everything comming back gets prefixed with +IPD

AT+CIPMUX=0
turns off multiplexing. required for transparent mode.

AT+CIPSTART="TCP","bbs.com",9640
opens the connection, and stuff you receive starts to show up.

AT+CIPSEND
Opens up your outgoing communication so you can interact with the BBS.





Some information to get you started:
Image
Last edited by eightbitswide on Tue Nov 15, 2016 4:50 am, edited 4 times in total.


eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

First day of testing complete! Good results.. First a few notes..

1) Using the 10k/20k resistor voltage drop was actually causing some issues with character transmission. I'll probably replace the interconnection with a proper 5v-3v Logic Level Converter (a couple bucks on Ebay) but for now I've actually connected the RX/TX lines of the Commodore userport directly to the RX/TX lines of the ESP8266 without issues. Worse case I shorten the lifetime of a $3 part.

2) Don't even bother testing at 1200 baud! The result will be a data overrun from the BBS which will cause the ESP8266 to reset. Run the module at 2400 baud (the top speed of the userport settings) and you will be fine. I'll be looking at some ways to handle 9600 baud flow control in the future.

3) Alwyz's CCGMS 2017 is a lifesaver. There isn't a compatible dial routine *yet* so you either have to type all the commands by hand or you can add the three most common commands to the MACROS: CTRL-F1 & CTRL-F3

4) +++ Doesn't seem to get the connection of the device to disconnect. Fortunately, I have a nice little power switch on my breadboard supply so it's easy to power cycle.

5) Things to do: Try file transfers! Xmodem works fine

6) Things to do: Test commodoreserver


Hardware Hook Up:
  • Connect 3v to ESP8266 VCC & CH_PD Pins
    Connect GND to GND
    Connect TXD to Userport B & C
    Connect TXD to Userport M
    Connect GND to Userport N
    Connect GND to Userport A

ESP8266 Setup: (Prep the ESP8266 for use)

Change the baud rate to 2400 baud. I used TeraTerm & a USB serial adapter to connect to the EPS8266 the first time so that I could do this. The default baud rate is usually either 9600 or 115200 baud. (Don't forget to set TeraTerm to send CR+LF for transmit {see Setup/Terminal/NewLine| otherwise the module will ignore your typed commands) This is not an issue with CCGMS thankfully)

AT+UART_DEF=2400,8,1,0,0


Change the adapter to Station Mode, Transparent Mode, and Turn off Multiplexing with the following three commands.

AT+CWMODE=1
AT+CIPMODE=1
AT+CIPMUX=0



Teach the module to connect to your wireless connection with the following command.

AT+CWJAP="myssid","mypassword"


Once you've done all this you should be able to see your connected IP & MAC Address with..

AT+CIFSR



At this point, you are ready to move the ESP8266 from your USB serial connection and connect it to the Commodore userport. Make sure you DO NOT attempt to power the ESP8266 from the userport as it simply does NOT have the required current to do this. I used a breadboard power adapter to supply the 3v required by the ESP8266.

Load CCGMS and configure it for 2400 Baud & userport settings. The module works fine getting it commands while the terminal is in Petscii C/G mode. Hit F7 and E to edit the two macros, you'll need them!

Edit the CTRL-F1 macro with the following:
at+cipmode=1
at+cipstart="tcp","afterlife.dynu.com",6400


Edit the CTRL-F3 macro with the following:
at+cipsend

Make sure you have a final "carriage return" at the end of the last commands.


Now you are ready to dial Afterlife BBS.
Type AT and carriage return to see if everything is communicating. If you get OK then.

Hit CTRL-F1
This will set the proper mode and dial the BBS.

Once you've made a successful connection and you see data coming through, quickly hit CTRL-F3 to open up your outgoing connection.
Last edited by eightbitswide on Wed Nov 16, 2016 4:40 am, edited 3 times in total.
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

Here's a quick shot of my over-wired C64 to ESP8266 setup. :)

I'm sure I could eliminate about half of the jumper wires, but I wanted to have plenty of room to experiment with various configurations if I needed to.


Image
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

Doing some more research this morning.

It appears that using the command AT+IPR=2400 has the tendency to lock up the module causing you to need to re-program it. (I did)

The command AT+UART_DEF=2400,8,1,0,0 appears to be the replacement command.
xxValiumxx
Member
Member
Posts: 1
Joined: Wed Nov 16, 2016 3:47 am
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by xxValiumxx »

Hi eightbitswide, are you aware that there has been firmware developed for this exact purpose?

Don't let me discourage you from going it on your own, just curious if you knew.

https://github.com/RolandJuno/esp8266_m ... _modem.ino
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

Ok.. So tonight I took the dive all the way down the rabbit hole..

I don't have access to my real Commodore 64 during the week, and I wanted to continue to continue this experiment in the evenings..

Monday night I tried to use the VICE emulator with TCPCOM to redirect the data from VICE's Userport to the ESP8266. It worked, some, except for some reason VICE doesn't translate the CR to CR+LF required by the ESP8266. Monday night failed.

Tonight I added a microcontroller to the experiment.....

Using a Micromite (Think of it as a PIC32 running an onboard editor and BASIC language) I transferred the data coming from TCPCOM/VICE into one of the serial ports on the Micromite, then using the Micromite's BASIC I converted all CR's to CR+LF on the fly then shuttled the data stream back off the Micromite onto another of it's serial ports where the ESP8266 is attached.

The setup looks something like this:
VICE64 -->TCPCOM --> USBSerial --> Micromite --> ESP8266

After making a connection, I thought I'd try a Download. I successfully transferred the latest version of CCGMS2017-beta6 using Xmodem, then rebooted VICE and tried the transfer two more times using Punter protocol. Each time the Punter protocol failed in a different spot, but it was able to achieve 90% of the program each time. I have reason to think this may work perfectly with a real Commodore 64 where VICE fails. (I'll try the Punter protocol again this weekend from a C64)


Image


Image


Image


All in all a successful evening..

Next I'll test Commodore Server and perhaps even add some Hayes style commands into the Micromite to control the ESP8266 stuff.
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

xxValiumxx wrote:Hi eightbitswide, are you aware that there has been firmware developed for this exact purpose?

Don't let me discourage you from going it on your own, just curious if you knew.

https://github.com/RolandJuno/esp8266_m ... _modem.ino

Figures that someone else has been working on this as well.. :) I'll check it out, but honestly going it from scratch has been a pretty rewarding project.
eightbitswide
Member
Member
Posts: 12
Joined: Sun Nov 13, 2016 5:35 pm
Contact:

Re: Adding wireless to the C64 via esp8266-01

Post by eightbitswide »

Tonight's update..

Following the link that xxValiumxx posted, I compiled the .ino tonight, then uploaded it to a fresh module...
The compile took what seemed to be forever, so if someone would like a shortcut to programming your own,
use this programming tool and included .bin firmware.

http://www.filedropper.com/esp8266c64modem

You should wind up with a Commodore compatible wireless modem for less than $5 in less time that it takes to wire things up.
Tested tonight with WinVICE using COMbyTCP with both CCGMS2017 as well as V1541 Commodoreserver.com -- works perfectly.
Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 8 guests