22 November 2015, 21:15 | #1 |
Posts: n/a
|
Serial programming, hardware handshaking
Hey. Beginner Amiga (and Motorola) coder here.
I have some serial communication going on in assembler on the Amiga, and some send/receive on my PC. It's running in 9600 baud on a 040 accelerated Amiga 1200 with minor problems, but it's without hardware handshaking, checking the register SERDATR for incoming data and resetting INTREQ bit 11. When sending, writing to SERDAT with stop bit and waiting for bit 13 of SERDATR to clear (though I should probably switch those two operations ) The PC side was quite straight forward, but when I turn on hardware handshaking the transfer just hangs. Questions: * Is the Amiga capable of this? * Do I need to do something else than what is described in the hardware manual from page 250 and onward (what I described above). * Any idea why it halts? The Amiga code: http://pastebin.com/1BYjr01P The PC code: http://pastebin.com/yR7isyxv Would be cool with faster baud rates but also to run on slower Amigas... Why? Why not? :-) PS. If somebody has some serial programming reference code I would love to see it! Ds. Last edited by thec; 23 November 2015 at 08:02. |
23 November 2015, 16:08 | #2 | |||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
Quote:
Quote:
Quote:
Quote:
EDIT: Just saw you wrote that you're a beginner, so you're probably not hitting the hardware for fun? I should mention that there is also serial.device, which works fine. Certainly faster than 9600 bps on a 040. Last edited by phx; 23 November 2015 at 16:12. Reason: serial.device |
|||||
23 November 2015, 17:33 | #3 |
Posts: n/a
|
Thanks for your reply!
Messing around with the CIA-B seems to be over my head right now but perhaps writing an interrupt routine would be a good step for me to try. To be honest I haven't tried 38400/57600 but I tried 19200 and got far too many errors even there, but there are some optimizations I could do in the code too I guess, to fine tune the performance. Yeah I'm poking the hardware with my beginner stick, but having lots of fun in the meantime. I do this in pure asm, serial.device is a c library no? Anyhow, it's working, I just want it to perform better for no particular reason, but as you suggested, writing a interrupt might be doable. |
24 November 2015, 04:35 | #4 |
old bearded fool
Join Date: Jan 2010
Location: Bangkok
Age: 56
Posts: 779
|
From my experience with the Amiga serial port...
You get 19200 Baud on an Amiga (A500/A1000/A2000) with 68000 CPU (@ 7MHz) using standard serial device (WB 1.2 or WB 1.3) and decent terminal program (eg. JR-Comm), 38400 Baud can be achieved with faster serial device and tweaking screen mode (number of colours), etc. A plain A1200 gives you 57600 Baud using standard serial device (WB 3.1) and decent terminal program (eg. NComm), with any accelerator (020/030 CPU) over ~30Mhz you can do 115200 Baud. The "hardware" part of RTS/CTS refers to the physical RS-232 pins in the serial port to handle the handshake, as opposed to XON/XOFF handshaking which is "soft" as in characters sent by software in the data flow. I haven't done any serial programming on the Amiga, so can't help much there. |
24 November 2015, 09:14 | #5 |
Posts: n/a
|
Thanks anyway, the performance is interesting information!
Didn't think about switching screenmode to gain a few cycles, good idea. Can't run WB, I run my program on boot, it waits for a package to be received from the PC, unpacks it and runs the executable from it, that way I can set up a programming environment on the PC but run on the real hardware. It works already, just wanna fine tune the transfer... works good on the accelerated 1200, but the stock 1200 doesn't run as smoothly, but I suspect 19200 should be achievable with it from your tests.. I'll optimize the code Like this: https://www.facebook.com/thec77/vide...5/?pnref=story only I wrap my code with Makefiles and send it to the amiga with the install script. |
24 November 2015, 11:11 | #6 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,637
|
Quote:
since you're hitting the hw directly, have you shut the system down properly? otherwise the os may interfere with what you're doing... |
|
24 November 2015, 18:10 | #7 |
Posts: n/a
|
My program is run from startup-sequence and no workbench, is there still a need to shut down stuff? May I have some suggestions on what to shut down and how?
|
24 November 2015, 19:49 | #8 | |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 721
|
Quote:
One obvious speedup would be compression. |
|
24 November 2015, 20:13 | #9 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,872
|
Go for floppy port - HW and faster than UART - 250/500kbps should be supported by most good UART2USB (almost sure it should be supported by FTDI).
btw http://aminet.net/package/comm/misc/easytransfer Last edited by pandy71; 24 November 2015 at 20:22. |
24 November 2015, 21:02 | #10 |
Posts: n/a
|
|
24 November 2015, 21:03 | #11 | |
Posts: n/a
|
Quote:
.. yeah, of course there is similar programs out there now that I spent the whole month for research and coding, but, since coding for the amiga is just for kicks anyway, no problem :-) As a complete n00b (didn't even own one back in the day) these things are not easy to find... |
|
25 November 2015, 10:29 | #12 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,872
|
Floppy is more interesting as HW provide data transfer (critical from Amiga perspective) - CIA GPIO can be used to perform handshake and with block transfer relatively fast bitrate achieved all this with relatively low CPU usage - crucial from plain 68000&7MHz.
In case of Amiga UART, Copper can be used to output data (as such fast Tx rate) but problem is R(x)eception - UART in Paula is not buffered like 16550 on PC (16 byte FIFO) and every byte will create interrupt - this can kill multitasking efficiently - perhaps block oriented transfer may help a bit but still - this is serious limitation for vanilla Amiga. Btw - level (voltage) translator used in Amiga (old 1488/1489) can be serious limitation - it can be desired to replace them with something more modern (faster) for example MAX232 like IC's- when FDD serial is used this not a limitation - just use FTDI232 with TTL level translator. |
25 November 2015, 10:54 | #13 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,637
|
the cia interrupt register (icr) is cleared when read, this means that if the os reads this register, it could clear any pending interrupt requests, and then your code could miss it.. if you bang the hw directly, you should shut down the os (like demos/intros do), or maybe use SetICR of cia.resource to poll for interrupt requests.
|
25 November 2015, 19:12 | #14 | |
Posts: n/a
|
Quote:
Unrelated, I'm having a strange error now in my code, I'll post about it later. |
|
25 November 2015, 19:14 | #15 | |
Posts: n/a
|
Quote:
|
|
26 November 2015, 11:17 | #16 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,637
|
Just ignore my rambling.. somehow I'd forgot that the UART is located in paula, not the cia's (they only take care of CTS,DTR,DTS,etc).
Last edited by hooverphonique; 26 November 2015 at 11:22. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
My Amiga Hardware Programming site is up! | Photon | Coders. Asm / Hardware | 28 | 12 June 2015 14:16 |
Serial programming in ACE basic on A600. | vext01 | Coders. System | 5 | 27 August 2014 23:34 |
Best practices for direct hardware programming ? | weiju | Coders. Asm / Hardware | 27 | 31 October 2011 13:10 |
new hardware suggestion: USB to serial mouse adapter | gizmomelb | support.Hardware | 15 | 22 December 2006 01:24 |
Hardware port programming. CLK on parallel. | redblade | Coders. General | 0 | 29 March 2005 11:19 |
|
|