wAxfer

Modding and Technical Issues

Moderator: Moderators

User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

As you suggest, I might be able to stretch it further. Maybe the bottleneck is the Arduino (but probably not). I'd rather spend my time on Bluetooth next, after the MIDI project is done. If I can sling files from Mac to VIC without even needing to physically hook them up...? That's the stuff!
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

cobracon
Vic 20 Dabbler
Posts: 74
Joined: Thu Nov 11, 2010 5:46 pm

Re: wAxfer

Post by cobracon »

Looks really fast. Once you get bluetooth running it will be really easy to send files. Great work!
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: wAxfer

Post by tlr »

chysn wrote: Wed Sep 15, 2021 11:05 am As you suggest, I might be able to stretch it further. Maybe the bottleneck is the Arduino (but probably not). I'd rather spend my time on Bluetooth next, after the MIDI project is done. If I can sling files from Mac to VIC without even needing to physically hook them up...? That's the stuff!
Bluetooth would be a cool feature of course.

There is some point in optimizing the parallel protocol anyway, especially as I assume you will need simultaneous read and write capability. This doesn't necessarily mean faster, but rather control to avoid driving the ports against each other, still maintaining decent throughput.
What you are doing is in some ways similar to IEEE-488 so maybe things like bus turn-around may be borrowed from there?
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

tlr wrote: Thu Sep 16, 2021 3:29 am What you are doing is in some ways similar to IEEE-488 so maybe things like bus turn-around may be borrowed from there?
Sure. I just learned how the pins were mapped to the User Port, and how the control lines work, and then made something up. I'm still pretty new at it, and could definitely benefit from looking at other communications code. It hasn't been easy to find.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: wAxfer

Post by tlr »

chysn wrote: Thu Sep 16, 2021 7:56 am
tlr wrote: Thu Sep 16, 2021 3:29 am What you are doing is in some ways similar to IEEE-488 so maybe things like bus turn-around may be borrowed from there?
Sure. I just learned how the pins were mapped to the User Port, and how the control lines work, and then made something up. I'm still pretty new at it, and could definitely benefit from looking at other communications code. It hasn't been easy to find.
I guess it's in the application rom for those interfaces, the kernal of the PET and in the roms of the older IEEE-488 drives. Many of the older drives use the 6520 PIA, but I think the SFD-1001 uses a 6522. I looked briefly at it, and IEEE-488 uses a lot of other signalling so maybe it's just going to be confusing.

But as far as handshaking goes it's described in the rockwell 6522 data sheet. Basically you can get it to latch the input bits on a pulse on CA1 and generate an automatic "ack" on CA2 when you read the userport.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

tlr wrote: Thu Sep 16, 2021 10:36 am But as far as handshaking goes it's described in the rockwell 6522 data sheet. Basically you can get it to latch the input bits on a pulse on CA1 and generate an automatic "ack" on CA2 when you read the userport.
The VIC-20 User Port is connected to Port B, whose control lines, CB1 and CB2, lack the latching feature (they make up for it by being able to control the shift register instead). When I send data out, I use the Handshake Output Mode, which sets CB2 low on a write to the port. This is how my Arduino sketch knows that it should read the pins. The Arduino can send acknowledgement back on CB1, which sets a VIA interrupt flag that lets me know everything's groovy.

For input, I don't think I have access to any latching behavior. Fortunately, the NMI is triggered and I can read the port straight away. Errors could potentially be introduced if the port changes between the time the CB2 goes low and the time the NMI is handled. I suspect that's at least one factors that limits baud rate on the User Port.

As I get more and more interested in the 6522, I start to appreciate some of the design subtleties. Instead of providing two things that are exactly alike, they provide things are mostly alike, but have slightly different capabilities. The differences between Ports A and B are an example of this, as are the differences between Timers 1 and 2. It's a fascinating device. I think I'm going to buy a couple extras to play around with on a breadboard.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: wAxfer

Post by tlr »

chysn wrote: Thu Sep 16, 2021 11:20 am The VIC-20 User Port is connected to Port B, whose control lines, CB1 and CB2, lack the latching feature (they make up for it by being able to control the shift register instead). When I send data out, I use the Handshake Output Mode, which sets CB2 low on a write to the port. This is how my Arduino sketch knows that it should read the pins. The Arduino can send acknowledgement back on CB1, which sets a VIA interrupt flag that lets me know everything's groovy.
Good point about the user port being port B. I misremembered it as port A. Port B does indeed not seem to have a handshaking feature for input.
chysn wrote: Thu Sep 16, 2021 11:20 amFor input, I don't think I have access to any latching behavior. Fortunately, the NMI is triggered and I can read the port straight away. Errors could potentially be introduced if the port changes between the time the CB2 goes low and the time the NMI is handled. I suspect that's at least one factors that limits baud rate on the User Port.
So, you could always generate the CB2 ack manually. If you make sure the Arduino keeps the data valid until it sees that ack it should be glitch free. Generating an ack (pulse?) takes a few cycles, but not that many.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

tlr wrote: Thu Sep 16, 2021 12:25 pm So, you could always generate the CB2 ack manually. If you make sure the Arduino keeps the data valid until it sees that ack it should be glitch free. Generating an ack (pulse?) takes a few cycles, but not that many.
Yeah, I think you're right. If I change to Input Mode, the interrupt will be triggered on a low-to-high transition from the Arduino. Then I set the CB2 pin on the Arduino to INPUT. On the VIC-20, I change to Pulse Output mode and write to Port B to set CB2 low for one cycle. It's a bit convoluted, but it seems like it should work.
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

wAxfer is now Bluetooth-enabled! It's still possible to do transfers via USB by flipping a switch on the interface but why?? Bluetooth transfers work from every room in my house.



Note: I'm using an HM-10 Bluetooth module with the Arduino Nano. Power consumption is way, way, way under the VIC-20's +5V 100mA limit. Power consumption makes the Nano very suitable for VIC-20 peripheral projects. I originally planned to use ESP-32s, but its 600mA draw is a real budget buster for the VIC.
User avatar
mathom
Vic 20 Dabbler
Posts: 80
Joined: Wed Aug 07, 2019 11:37 am
Location: Centennial, Colorado
Occupation: Software Engineer

Re: wAxfer

Post by mathom »

Are there any instructions on how to build the interface for this? I think I have all the pieces laying around. I just need to know how to hook them up and how to program the Arduino.
...mathom...
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: wAxfer

Post by chysn »

mathom wrote: Mon Aug 01, 2022 5:04 pm Are there any instructions on how to build the interface for this? I think I have all the pieces laying around. I just need to know how to hook them up and how to program the Arduino.
I'm a bit behind in making that available, sorry. I'm out of town for a few days, but I'll make it a priority to get that on GitHub next week.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
Post Reply