6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat May 11, 2024 5:20 pm

All times are UTC




Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Sat Jan 28, 2023 9:31 pm 
Offline

Joined: Wed Jan 01, 2003 6:32 pm
Posts: 32
Has anybody ever succeed to transfer data streams (xmodem or other) over a bitbanging solution at 1 MHz? The most, I can manage ist 38400 Baud send & receive. And there i have error rates of approx. 100 ppm mainly due to phase jitter cause by the ‚no character received‘ logic.

Dietrich

_________________
My system: Elektor Junior Computer, GitHub https://github.com/Dietrich-L


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 12, 2023 11:53 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 672
I haven't read through all the details in the preceding 4 pages of posts, but yes, in the early 2000s.

I had to do it within a packetized protocol, and 2 stop bits to get the timing to work with inter-byte processing. For the incoming case, the PC would signal the C64 (in my case), wait for the C64 to ACK, then stream up to a 256 byte packet. The first signal would NMI the 6502, which then put it in a tight timing loop for receiving the packet bytes. This way, the 6502 could be doing other things, be interrupted by the incoming burst RS232 activity, and resume. Initiating from the 6502 directly doesn't need that NMI since it can immediately go into its tight loop.

This packetization is basically "cheating" stability-wise vs just a plain RS232 stream, but certainly was appropriate for transfer use, versus something like interactive BBS typing/display.

I distributed the sub-cycle timing error between the 8 bits, and sought to sample received bits in the middle of the pulse based on offsetting from where I noticed the start bit. I think these have been done in the thread already.

I used it primarily for receiving (eg PC->C64 transfers) instead of bulk sending, and transferred lots of files and disk images. Of course, sending was implemented in order to handle the ACK/NAKs and such. There were basically no errors to speak of, and the protocol did packet checksums & automatic retries anyway, yelling loudly if it encountered any. Also, my wiring was really jank going through multiple decades-old adapters to a USB/RS232 interface on the PC, and still didn't have any problem.

Code:
.if PAL > 0

;PAL timing: 985250 / 57600 = 17.105
; 0  17  34  51  68  86 103 120 137 154 171 188
; s17 b17 b17 b17 b18 b17 b17 b17 b17 s17 s17

recvCycleFlags = %00001000

.elseif NTSC > 0

;NTSC timing: 1022727 / 57600 = 17.755677083
; 0  18  36  53  71  89 107 124 142 160 178 195
; s18 b18 b17 b18 b18 b18 b17 b18 b18 s18 s17

recvCycleFlags = %11011101

.else
.error "Neither NTSC nor PAL defined"
.endif

.macro receiveByte_macro
 lda #recvCycleFlags  ; timing error bitmask from above
 ldx #$06
  lsr $dd01 ;6 cycles
  ror       ;2    ; data bit into top of .A, timing bit out of bottom of .A
  bcs *+2   ;2+1  ; timing fixup
  nop       ;2
  dex       ;2
 bpl *-8    ;3
 lsr $dd01
 ror
.endmacro

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 12, 2023 6:59 pm 
Offline

Joined: Wed Jan 01, 2003 6:32 pm
Posts: 32
Very Smart Concept
Gives me a lot to think about

Dietrich

_________________
My system: Elektor Junior Computer, GitHub https://github.com/Dietrich-L


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: