Connect a C64 to a Raspberry PI or a PC to transfers data on-demand

oflor

New Member
Oct 16, 2019
6
0
1
Hi People:
Anyone know how it can be possible to "attach" a Raspberry PI or PC to a C64 to transfer data between them?
My idea is to make a program that input data on a C64 and make it processing on a "bigger machine" and when finish the processing, back data to the C64 to show results.
Is like a "C64 Server" or using the C64 as a thin client.
I know the RS232 way plus the wifi modem using a terminal, but this way I can't use the communication capability from customs programs because the terminal program is a closed package.
Thanks in advance and
Best Regards
 
May 22, 2019
493
255
63
The Raspberry Pi is not a great choice for this, because its GPIO uses 3.3v, and the Commodore 64 User port uses 5v.

A better choice is a classic Arduino with 5V GPIO. Even the original Arduino Uno should be fast enough, or the Mega if you need more speed or pins.

From there, you just need a User port connector. You can wire the PB0-PB8 pins to GPIO pins on the Arduino for data and use the SP1 and SP2 pins for your clock.

1572367355339.png
 
  • Like
Reactions: oflor

bladamson

New Member
Oct 23, 2019
12
1
3
Appalachia
www.mrpolecat.com
The Pi does have a 2-pin serial port, though. But it's TTL-level 3.3v serial (edit: sorry, I misspoke!). Is the user-port serial TTL or RS-232 levels? (Sorry, I'm an Apple 2 guy. ;P )

If the userport serial is RS-232 levels (-12v/+12v), you'd have to use an RS-232 level converter, like this one: https://www.amazon.com/Converter-Connector-3-3V-5-5V-Electronic-Components/dp/B07RGT83HL/ref=sr_1_4?keywords=ttl+to+rs232+converter&qid=1572392939&sr=8-4

If the userport serial is TTL levels (0v/+5v), you'd need a bi-directional logic-level converter, like this one: https://www.sparkfun.com/products/12009 (edit: or you can use a 2-resistor voltage divider on the C= output line to bring it down to 3.3v, and hope that 3.3v is enough to register as high on the C= input line, but those converters are the "proper" way to do it and they're just so inexpensive.)

Then you should be able to hook it up to the userport serial lines, and write your software the same as you'd write any serial port stuff.

Last edit, I promise: Another fun fact, you can power the PI over the GPIO header, by supplying it with 5v on the +5v pin, instead of using a USB cable. So if you wanted to be really snazzy, you could build it all as a pretty little self-contained cartridge, powered entirely by the C64. Assuming the userport can source enough current for it (I don't think I'd try powering a Pi 3 or 4 that way, but a 2 would probably work fine).
 
Last edited:
  • Like
Reactions: oflor
May 22, 2019
493
255
63
The Pi does have a 2-pin serial port, though. But it's TTL-level serial. Is the user-port serial TTL or RS-232 levels? (Sorry, I'm an Apple 2 guy. ;P )

If the userport is RS-232 levels, you'd have to use an RS-232 level converter, like this one: https://www.amazon.com/Converter-Connector-3-3V-5-5V-Electronic-Components/dp/B07RGT83HL/ref=sr_1_4?keywords=ttl+to+rs232+converter&qid=1572392939&sr=8-4

If the userport is TTL levels, you'd need a bi-directional logic-level converter, like this one: https://www.sparkfun.com/products/12009

Then you should be able to hook it up to the userport serial lines, and write your software the same as you'd write any serial port stuff.
The User Port is 5V TTL, as I said above.

If you only need a serial interface, you can just wire a 5V USB UART to a PC. There's no need for a Pi at all. However, the OP specifically said he didn't want serial, so that means some sort of parallel connection to the User port or the expansion port.

@oflor another choice is just to get a network adapter for the C64.

 
  • Like
Reactions: oflor

bladamson

New Member
Oct 23, 2019
12
1
3
Appalachia
www.mrpolecat.com
Ah, I thought he was talking about not being able to the use some kind of wifi-serial thing in particular because it was proprietary, and assumed that you were referring to the parallel interface when mentioning the logic level difference.

But he ought to be able to program the serial port without relying on some kind of proprietary wifi thing.

OP: Can you clarify your problem domain a little? Are you specifically looking for a parallel solution for speed reasons, or can you live with serial if you don't have to go through some kind of proprietary thingy?

My take is, serial would be easier to implement from the software side, because it's as simple as setting the port speed and then opening a character device on the Linux side (I am assuming that this is why you're looking at a Pi, that you need Unix tools for your data processing; if not then yeah some kind of high speed microcontroller might be better). With a parallel interface, you'd have to fool around with kinda writing your own protocol handling daemon, dealing with the hand-shaking on the GPIO lines, all that. And if you wanted to pipe it into Unix tools, you'd have to make it write to one end of a Unix FIFO and then redirect in from the other or something. Headaches. :p
 

oflor

New Member
Oct 16, 2019
6
0
1
I have in mind an ambitious project. A New workbench for c64/c128. I know that the hardware can be limited and for that I want to delegate fault processing/storage/capability to a c64/c128 "expander". And i want to do using the cheapest way possible allowing everyone can do It itself at home. Fortunately i have time to make various prototipes to find "best way". This is intended to be used on Commander x16 too.
 
Last edited:
May 22, 2019
493
255
63
Okay, then I'd suggest working with the expansion port, rather than the user port. If you can get something to work fast enough, you can directly manipulate the system bus, either using an FPGA or using a fast enough microcontroller.

Jim Drew, over at Lemon64, has been working on a replacement CPU using a microcontroller, for example.
 
  • Like
Reactions: oflor

oflor

New Member
Oct 16, 2019
6
0
1
Thanks very much for the data.
I'll don't want to use the expansion port (despite being the best option), because in this way I will close de possibility of using another expansion that could be cool for use with my "workbench", for e.g. a fast loader cartridge, the UII+ or some kind of memory expansion or event the SuperCard project.
I even thought about using the datacassette port, but it have not enough capability i think.
I think I need a simple serial data transfer to start and in a future see other ways.

Thank You very much to all I will start working.....