RS232 at 57600 bps via joystick port

Page 1/2
| 2

Par RvS

Resident (46)

Portrait de RvS

12-05-2020, 21:24

The last months I have been trying to get a stable serial connection between a FT232 module and my MSX (NMS8245).
I believe it is working now. It is still a very basic driver: just sending and receiving bytes at 57600 bps. Pin1 is RX (input) and pin6 is TX (output).
The code is avialable here: link
It should work on a 'normal' MSX with a 3.58 MHz Z80.
The key trick was fast polling for the start bit followed by a strict 62 cycles loop to read all data bits.
The Z80+M1 table from Grauw was extremely useful here!
The next step in this mini-project is creating file I/O routines.

!login ou Inscrivez-vous pour poster

Par kaizen4871

Supporter (5)

Portrait de kaizen4871

12-05-2020, 23:00

awesome! thanks a lot. looking forward to hear about the mini project.

Par ocitygate

Expert (67)

Portrait de ocitygate

07-02-2021, 03:17

Hey RvS, I came across your projects on GitHub.
Can the RS232 driver be used as a standalone?
How do I send and receive data?

Par xavirompe

Resident (49)

Portrait de xavirompe

25-02-2021, 11:17

Great Work RVS,

I am just testing your routines and they work very well.
CTS/RTS implementation will be very useful to detect if the remote computer is ready, that will be great to exit the routine when the remote is not ready for interaction.

Using your routines with a disk kernel work nice, now I am using a USB-TTL to connect to he PC, but I plant to test it with a Bluetooth module.

An if you want a beta tester, just let me know!

Par ericb59

Paragon (1046)

Portrait de ericb59

25-02-2021, 15:47

Nice.
Could your driver be adapted to other speed ? (9600)

Par RvS

Resident (46)

Portrait de RvS

25-02-2021, 17:28

9600 would be not so difficult because it is rather slow. The higher the bitrate, the more difficult it becomes. I have some free time next week, I will see if I can make versions with different rates.

Par ericb59

Paragon (1046)

Portrait de ericb59

26-02-2021, 17:55

Thanks... 9600 bauds is often used to communicate with some hardware.
If you can make a 9600 bauds version it will be wonderfull for my upcoming projects. Smile

Par Wlcracks

Champion (434)

Portrait de Wlcracks

27-02-2021, 12:39

I guess joe mean UART protocol
RS232 is higher level then TTL and could easy blow up you MSX engine.
I would not recommend connecting anything other then a "floating" device on your MSX joystick port, if a ground problem occurs or long cables you blow up your MSX engine very easy. because its not by any means protected other then a pull-up or a simple diode. A buffer logic ic power supplied by the MSX or a real MAX-232 ic is highly recommended.

Par ericb59

Paragon (1046)

Portrait de ericb59

12-03-2021, 07:31

@RVS did you try to adapt your code to 9600 bauds ?

Par RvS

Resident (46)

Portrait de RvS

13-03-2021, 11:49

Still working on it, should be finished on Wednesday. I still need to run some tests.

Par RvS

Resident (46)

Portrait de RvS

17-03-2021, 14:19

I have the first 'beta' ready for 9600 bps.
The source code is available here
I did a few tests on 9600bps, but I need to run a lot more tests, so use with care.
I added a few features:
-The serial read now has a time-out of ~4-5 seconds to avoid a system hang if no data comes in.
-The stopbit is now checked properly and a value error for the stopbit results in an error (3)
-Bitrate can be changed to 2400,4800,9600 and 19200 bps. Default is 9600 bps

Page 1/2
| 2