A2I2C - I2C bus for Atari

Moderator: bbiernat

Post Reply
User avatar
pancio
Administrator
Posts: 48
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

A2I2C - I2C bus for Atari

Post by pancio »

Note.
According to found issues please read post 56: viewtopic.php?p=56#p56 to avoid malfunctions with interface...


This article is clue of my topic on Atari.area Forum. Nowadays IoTs are everywhere so why not to use those with Atari? I decided to make interface which can communicate with I2C bus and might be connected with 8 bit parallel 6502 bus.

I found IC which will be very helpfully, his name is PCF8584. This IC might work with two different modes, IMC 6800(0) which should be default and 80XX for others processors. Unfortunately 65C02 is working with little bit difficult time frames so the default mode doesn't work with Atari computer. I decided to build additional decoder for /OE and /WE signals and finally to use the 80XX mode.

It was good decision... it's doesn't matter which method you used. The important is that it's working! :-)

I designed two separately PCB, one for external connection using CART/ECI, second as adapter between CPU and PCF8584. The PCB are very easy to assemble, both are available on http://seeedstudio.com and http://dirtypcbs.com/store/order/204600 ... 6ae6053af1 so if you are interested in to run your own interface please use my project.

Of course I shared the EAGLE files and source code below.

If you have any question, don't be hesitate :-) Just ask.

version 1.1 PCB:
a2i2cv11.png
a2i2cv11.png (46.65 KiB) Viewed 8296 times
version 1.1 PCBpoly:
a2i2cv11-poly.png




version 2.1 (PCB mounted on CPU):
a2i2cv2.1.png
Quick User Guide for version 1.1:
The PCB is prepared with full description so assembly process should be very easy. Just iron required elements on PCB.
a2i2crealpcb.jpg
a2i2c11sch.png
a2i2c11sch.png (33.05 KiB) Viewed 8259 times
Then you must build IDC plugs on strips (one plug per strip) and connect cables to required signals. Most signals you may find directlu on CPU socket on the bottom PCB side.
a2i2c11fullyassembled.jpg
Socket X1:
1 - A0
2 - A4
3 - A5
4 - A6
5 - A7
6 - /D5XX (from cartridge socket or memory decoder)
7 - /RTS
8 - /IRQ
9 - R/W
10 - O2
X1.png
X1.png (19.16 KiB) Viewed 8251 times
Socket X2:
1 - D0
2 - D1
3 - D2
4 - D3
5 - D4
6 - D5
7 - D6
8 - D7
9 - VCC
10 - GND
X2.png
X2.png (18.47 KiB) Viewed 8251 times
JP2 - address selector (1 jumper!)

Socket I2C:
1,3,5,7 - SDA
2,4,6,8 - SCL

JP2 is determining ADDRESS as provided below:
a2i2c11truetable.png
a2i2c11truetable.png (29.12 KiB) Viewed 8259 times
One important note, decoder which I build is not fully decoding, It's mean that you should to expect shadow register. (e.g. $D580, $D582...$D58E are using to address the same PCF register),

If you were avoid any errors you may connect I2C device directly to I2C socket :-)

Update for version 1::

If you are planed to mount any I2C device outside the Atari I would to recommend use little bit modified PCB which contain separately socket in order to power I2c devices:
A2I2C v1.2 schematic
A2I2C v1.2 schematic
a2i2c12sch.png (35.48 KiB) Viewed 8247 times
A2I2C v1.2 PCB
A2I2C v1.2 PCB







Quick User Guide for version 2.1:

All required signals are available on CPU sockets so only one signal (/D5XX) you should wire from CART socket or memory decoder IC.
a2i2c2.1asembled.jpg
Please select address by using 1 jumper (truth table is the same as for version 1.1).

One important note!
There is no possibility to use version 2.1 and close cover for 800XL. If you plan to have closed Atari 800XL - you should to consider to use version 1.1.
I didn't test the interface with XE series, so maybe it's possible for that :-).



That's all, have fun!
Attachments
AN96040.pdf
PCF 8584 - Using the 8584 with non specified timings
and other frequently asked questions
(250.13 KiB) Downloaded 23 times
PCF8584.pdf
PCF 8584 data sheet
(180.27 KiB) Downloaded 22 times
ATARI-PCF8584-LIBRARY.zip
(8.26 KiB) Downloaded 450 times
A2I2Cembedded_v2.1.zip
(49.61 KiB) Downloaded 437 times
A2I2C.zip
(46.03 KiB) Downloaded 443 times

Bertrude
Posts: 5
Joined: 06 March 2021, 03:07 - Sat
Location: Austin, Texas

Re: A2I2C - I2C bus for Atari

Post by Bertrude »

Hi,

I just wanted to say this is a really cool project, and you've implemented it beautifully. I'm working on a similar project right now, using a 6502 computer to talk to a PCF8584P and found your 6502 code very helpful for how to initialize the chip. I saw that you're assigning address $55 to the PCF8584P, but was unsure if the chip is being initialized as a master or slave. I'm still rather new to embedded systems and microcomputers, so any help would be greatly appreciated. Thanks again for putting your code up :D

User avatar
pancio
Administrator
Posts: 48
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

Re: A2I2C - I2C bus for Atari

Post by pancio »

Hi,

My prototype works fine with one condition.. touching I2C bus not so fast :-) So if you planning use full PCF8584 features consider to use external clock (e.g. 12MHz) for it. I'm used PHI2 clock - it was mistake. For more details see page:

http://radio86rk.pbworks.com/w/page/134 ... 6-2018-i2c

In case, 8255 was used as piggy but you may choose CPU or 6520/22 chip as well. I'll planned to change my prototype to use external clock near future... I'm using PCF as a master but it is capable to be slave as well :-)

Bertrude
Posts: 5
Joined: 06 March 2021, 03:07 - Sat
Location: Austin, Texas

Re: A2I2C - I2C bus for Atari

Post by Bertrude »

Sounds great. Thanks for the additional information. I plan on using a 6522 for it. I got it wired up, and am getting ready to power it up to begin testing it :)

I will let you know how it goes!

Bertrude
Posts: 5
Joined: 06 March 2021, 03:07 - Sat
Location: Austin, Texas

Re: A2I2C - I2C bus for Atari

Post by Bertrude »

Hello,

I've gotten my PCF chip all wired up and I've been testing with the assembly code you've included; however I've ran into a couple of problems.

1) I wanted to clarify what assembler you're using for this code? I'm guessing it's Mad-Assembler (MADS), but I'd like to confirm :D

2) In the "pcf8584lib.asm" file there is a line of code that reads

Code: Select all

i2cbuf   equ  *
I'm not familiar with what the "*" means. Is there a technical term for this declaration so I can read up on it more? Most of my experience is using the DASM assembler, and I was unable to find more information on what the * means since google treats it as a "wildcard" search :lol:

I've included a photo of current project in case in your curious. I know it's not an Atari, but it's a 6502 based computer that I've been building. On the breadboard I have a PCF5854, and a couple of 74HC00N chips for handling address decoding and breaking out the R/W signal into discrete signals.

https://imgur.com/C5FFNQe

User avatar
pancio
Administrator
Posts: 48
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

Re: A2I2C - I2C bus for Atari

Post by pancio »

Hi,

I'm using MADS assembler as you guessed. The asterisk (*) with equ directive means that code started from i2cbuf should be placed in memory just here. It's dynamically allocation for i2cbuf. Another words, * is a pointer for memory address in the code stream. In case you have:

Code: Select all

   ...
   215 6115 00			len      dta   $00
   216 6116 00			ctr      dta   $00
   217 6117 00			pos      dta   $00
   218 6118 00			err      dta   $00
   219
   220 = 6119			i2cbuf   equ  *
   221 6119			.array TAB [BUFLEN] .byte = $ff
   222 				.enda
Good work but I can't see details on attached photo, so I can't say more :-). Please show the schematic for better understanding.

Bertrude
Posts: 5
Joined: 06 March 2021, 03:07 - Sat
Location: Austin, Texas

Re: A2I2C - I2C bus for Atari

Post by Bertrude »

Thanks for clarifying my questions about the 6502 code :) I'm hoping this weekend I can make some more progress on it.

Sorry for the messy photo. Last night I created a schematic for it. Currently I have it wired directly to the 6502 and have it accessible on addresses 6000 - 7FFF. I believe this should work.
pcf8584 i2c 6502 board cropped copy.jpg
pcf8584 i2c 6502 board cropped copy.jpg (370.76 KiB) Viewed 828 times

User avatar
pancio
Administrator
Posts: 48
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

Re: A2I2C - I2C bus for Atari

Post by pancio »

Hi,

Generally it's look very good... (KiCAD)?
Actually I see one issue... please clarify if I'm wrong. You are using the same CLK signal for 6502 and PCF? If yes, PCF will not be capable for so quick operations at all. Nice address decoder but in case you have many shadow registers :-). Did you connect input gate e.g. 4A directly to 5V power? Consider to use resistor 1k-5k :-)

Bertrude
Posts: 5
Joined: 06 March 2021, 03:07 - Sat
Location: Austin, Texas

Re: A2I2C - I2C bus for Atari

Post by Bertrude »

Yup, I used KiCAD and then used Photoshop to add some notes to it.

I'm using the same CLK for the 6502 and PCF currently. I don't need to send very much data via the PCF so I thought it should be fine, at least for testing. Would I be able to use another CLK source if i wanted it to be faster?

Haha, yeah, I know, I got a ton of shadow registers. I'll eventually improve on that part of it and shrink it's addressable space down once I get the rest of the circuit working :)

That's a good suggestion about connecting input gate 4A to a resistor. I'll make sure to do that :D

User avatar
pancio
Administrator
Posts: 48
Joined: 18 September 2013, 23:02 - Wed
Location: SILESIA

Re: A2I2C - I2C bus for Atari

Post by pancio »

I analysed my project again according to additional information regarding specific timing (AN96040 - added to first post) and now I'm pretty sure that the interrupt signal may disturb data communication between PCF8584 and microcomputer subsystem. I'll cut /INT line from existing PCB (especially that I'm not serving interrupt request from PCF in existing OS). Another question which I mentioned in viewtopic.php?p=56#p56 post is add external clock e.g. 12MHz to PCF. I suppose that it's not necessary but application note contains information that minimal input clock frequency is 3MHz - my is ~1.7Mhz... :-)

Post Reply