CPCWiki forum

General Category => Amstrad CPC hardware => Topic started by: ikonsgr on 20:20, 05 January 19

Title: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 20:20, 05 January 19
Hello everyone,

What i'm going to present you here,is a "Universal" serial interface for Amstrad CPC.
Although i know that other serial interfaces for amstrad cpc already exist, this one offer many innovations that makes it a rather modern, cheap and useful solution:

 
- It's a completely "from the scratch" project, based on a modern 8bit PIC 16F1579@32Mhz MicroController! (all other serial interface projects, use the rather old, expensive and bulky 40pin 16C550 UART chip)
- Very easy to use by only two BASIC commands, INP() and OUT!
- Completely free DIY project ,rather easy and cheap to make (total cost for the DIY kit +all extra parts, would would be less than 7euros!).
-  Easy and fast transfer individual (https://www.dropbox.com/s/zzl18w9f5dljj9c/GAMES.zip?dl=0) files (check link for 1000's of games extracted from dsk images)directly from/to Amstrad Disks (dsk image transfer will also implemented in the future)
- Run games and programs, using only an Amstrad CPC with good old 3" disks! (see "Cold Start" function in User's Guide)
- Equipped with a reset button and a pause switch for Amstrad CPC   
   
     
Serial  Interface is equipped with a big receive buffer of 920 bytes (more than 3.5X the buffer of the classic 16C550 UART chip, or booster/booster+ adapters), and can achieve speeds up to 576000bps, using a direct usb2serial cable adapter, or 460800bps using a Bluetooth or Wifi Module.
Serial interface can be used with a  USB2serial cable adapter (https://www.ebay.ie/itm/USB-To-RS232-TTL-USB-To-COM-Serial-Adapter-Cable-Module-PL2303HX/181921199283?hash=item2a5b5934b3:g:xL0AAOSwo0JWOFVL:rk:1:pf:0)
(PL2303HX), an HC-05 Bluetooth module (https://www.ebay.ie/itm/1-2-5-10PCS-HC-05-6-Pin-Wireless-Bluetooth-RF-Transceiver-Module-Serial/302097888911?var=600910990260), a WiFi module (an ESP-07 (https://www.ebay.ie/itm/ESP-07-ESP8266-Remote-Serial-Port-WIFI-Module-V1-0-ESP-Adapter-Plate-Expansion/282765960472?ssPageName=STRK%3AMEBIDX%3AIT&var=582047875339&_trksid=p2057872.m2749.l2649) or an ESP-01 (https://www.ebay.ie/itm/ESP8266-ESP-01S-Serial-WIFI-Wireless-Transceiver-Module-Send-Receive-AP-STA/302181509741) along with a 5V adapter (https://www.ebay.ie/itm/ESP8266-ESP-01-01S-02-03-04-05-06-07-08-09-10-11-12-12E-12F-13-14-WIFI-Module/262852020763?ssPageName=STRK%3AMEBIDX%3AIT&var=561850933808&_trksid=p2057872.m2749.l2649)) or even
this (http://www.hobbytronics.co.uk/usb-host-mini) Usb host board which, depending on loaded software, can host many different USB devices, like USB modems, flash drives, keyboard,mouses, joysticks, Midi interfaces etc. So, if you connect this usb host module to the serial inerface ,ALL of these devices can potentially communicate with amstrad cpc!
In practice, any device with a UART interface can be connected!


So, first let's take a look at the circuit (https://www.dropbox.com/s/sxj0objy1xctg0l/schematic.jpg?dl=0). And this is the pcb board (https://www.dropbox.com/s/31z65d5t8i7u8tb/DSCN1147.JPG?dl=0).
(https://www.dropbox.com/s/31z65d5t8i7u8tb/DSCN1147.JPG?dl=0)
You can connect it to an external port raiser adapter like MX4 board, or directly to Amstrad’s Expansion port using this (https://www.dropbox.com/s/ka6m4fyqangan30/DSCN1148.JPG?dl=0) adapter.
Interface usage, is pretty simple and straight forward. Communication with the device is accomplished using only two ports:
&FBD1: The control port
&FBD0: the data port

And the two BASIC commands INP() for receive and OUT for send.
To send a byte, just give the BASIC command:
OUT &FBD0,x (x:0-255)
Or on assembler, the instructions:
LD A,x (x:0-255)
LD BC,&FBD0
OUT (C),A


To receive a byte, you must first check if there is any byte available at the buffer, by reading the control port.
Use the BASIC command: INP(&FBD1). If it returns ‘255’, there is a byte available, if not, it returns ‘1’.
So, in order to receive a byte from serial port, you just give the BASIC command:

IF INP(&FBD1)=255 THEN A=INP(&FBD0) (variable A contains the received byte)

And if you want to wait until a byte is available, you can use a small loop like:

WHILE INP(&FBD1)=1:WEND:A=INP(&FBD0)

You can also give various commands to the interface (OUT &FBD1,x), using the control port, like reset interface, change serial port speed, clear receive buffer and some other.
I have written a small manual that explains usage in more details and also provide instructions for setting bluetooth and WiFi modules!
I have also developed a PC windows program (https://www.dropbox.com/s/1mx579oh1wv20dw/windowsprogram.jpg?dl=0) which you can use it to comunicate with Amstrad. For the moment can be used for terminal and a file transfer, but i intend to add  a dsk image transfer too, sometime in the future.Of course, a terminal program along with other utilities are also developed for Amstrad CPC.
You can find everything you will need here (https://www.dropbox.com/s/0z2cpcbxvl95s9v/Amstrad%20CPC%20serial%20interface.zip?dl=0), it contains the circuit diagram, the gerber files for the pcb, the bill of materials,the Pic 16F1579 microcontroller Hex file (you will need a pickit2/3 (https://www.ebay.ie/sch/i.html?_from=R40&_trksid=p3984.m570.l1313.TR7.TRC1.A0.H0.XPickit.TRS0&_nkw=Pickit&_sacat=0) in order to flash it into PIC 16F1579), Amstrad’s utility dsk image disk (you can transfer it to a real disk using CPCDISKXP (http://www.cpcmania.com/cpcdiskxp/cpcdiskxp.htm) using an ide or a usb 3.5" floppy Drive), the PC utility program, and of course, the User's Guide.
Although i have developed some basic utilities (like teminal and direct file transfer), having a cheap, easy to make and easy to use Serial port, and considering the strong and vivid program community for Amstrad CPC, it could open many prospects for future developments, like LAN or WAN games, Apps for communicating with smart phones and tablets, even a basic Web client...  ;) 

If anyone wants a ready made Serial interface, i can offer:

- A ready made board for 10euros+shipping (2.5euros for standard, 5euros registered/tracked).
- Extra Edge connector adapter costs +2euros.
- Extra Centronics connector adapter costs +5euros.

Finally, because the PCB board is the most "difficult" part to make, and PIC needs a PICKIT programmer to flash the program , i thought to also offer:

- A DIY kit including Plain PCB board + PIC 16F1579 (flashed with the program) for 6euros (including postage)!

With that, anyone with a soldering iron can make the board, as all other parts can be easily purchased from any electronics store! ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 22:57, 05 January 19
Very nice project indeed. However that's the same we already have with MiniBooster and CPC-Booster+. But cheaper and probably more easy though.  :)

What I would love to see are:
- A way bigger buffer, because with that high transfer rates 1 KB buffer is filled up literally in no time. So a buffer of at least 16 KB would be helpful.
- Either a 2nd port or a RS4xx, to enable a network of a ring of CPC computers. Great fun on meetings.

That's just my 3 Pfennige, since I'm more a software person I don't know if this is doable.  :)

Good luck with it anyway, look great!  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 01:52, 06 January 19
Well, i don't think that  MiniBooster and CPC-Booster+ are "competitive" to this project. For one thing, they offer much more than a serial port (A/D converters, PWM channels etc pretty much like MULTI purpose I/O device), and for that, are surely much more complicated and expensive to make. Moreover,they are pretty old projects, so i really don't know if they are available any more...  ::)
My intention was to design a small, cheap and easy to make (and use) serial port, that everyone with a soldering iron and a few euros, could make it by himself!  ;)


As for your requests,at one thing, it's difficult to find 8bit Microcontroller with 16+KB of ram, and they would be rather expensive too.But i think that a nearly 1Kb receive buffer, is already pretty much (16C550 UART and booster boards have much smaller buffers of ~250bytes), and believe me, if you use assembly code, it's easy to empty the buffer really fast too! :-) In anycase, you will always need to have some transfer control for fast speeds ,regardless of the buffer size you have. One good solution for example,is, for the sender to transmit a packet of bytes at the size of buffer at once, and then wait for acknowledge, to send the next. As for the networks, it's easy to make one ,using the WiFi modules! These WiFi ESP8266 modules can either connect or create TCP servers! So, you can have one Amstrad with a serial interface and a WiFi module running a TCP server, all other amstrads can connect to this server as TCP clients,and here is your Amstrad CPC network! ;-)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ComSoft6128 on 11:27, 06 January 19
Individual/batch file transfer from/to the 3" drive interests me, transfer from the 3.5" B drive is what I'm really looking for but that might came at a later date.
I'd like to buy one for a 6128 Plus.

Cheers,

Peter
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 13:18, 06 January 19

Ok, peter, send me your address with a pm or to my email ikonsgr745@hotmail.com to arrange it then.
Now,i think you're gonna love this, INDIVIDUAL file transfers from/to 3" disks was the reason i design this interface at the first place!  :)
I have dozens of 3" disks ,from the good old era, with many programs and listings me and friends had made, but the procedure to transfer them to a pc for safe keeping was somewhat combersome and timeconsuming, as all existed transfer methods are for copying hole disks or dsk images at once! So, i had to copy 3"disks to 3.5" disks using discology, and then (using an old pc that has an ide floppy drive), transfer the 3.5" disk to a dsk image using cpcdiskxp...
Now,i can just select individual files from a 3" disk and with a press of a button, transfer them directly to my pc! And, after a lot of study and work (http://www.cpcwiki.eu/index.php/Programming:Read/Write_a_file_quickly_byte-by-byte),i've managed to do it rather fast too, it takes less than 15seconds to transfer a hole 42kb game from 3"disk to pc, and about 20seconds for writing it back to a disk from pc!
In 2 words, having this interface, allows you to use your amstrad without needing ANYTHING extra, either a 3.5" drive, or a gotek emulator drive, just a good old 6128 with a bunch of 3" disks ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ComSoft6128 on 13:30, 06 January 19
This sounds ideal ;D
Will PM to organise.

Thanks,

Peter
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 15:41, 06 January 19
Ah, so if I do understand that right, we can have a few CPCs with your card and the WiFi-modules and they all can talk to each other, right?

Since I'm not familiar with WiFi at all: Do we need a WiFi router unit for this, or do we just need some CPCs with your card + Wifi module?

Also: How would this look like from the software side?

This would be really a great thing, to have a network based on CPCs (without PCs).  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 18:22, 06 January 19
Exactly! Esp8266 it's really a marvel-chip, apart from creating a tcp server or connecting to another, it can be also used as an access point!
So, if you have a bunch of amstrad cpc's with serial interfaces and wifi modules installed, you can set the tcp server and the access point at one of them, and then, all the others can  connect to this access point, get ip's, and then connect to the tcp server, and thus create an Amstrad CPC-only wireless LAN,without even needing a router!It might sound complicated, but it's really a matter of a few AT commands to do all this!
I already have a small section in my user guide, that has a small list of the most useful AT commands, although the complete AT user manual (https://www.dropbox.com/s/wetg5asxy6nynst/4a-esp8266_at_instruction_set_en.pdf?dl=0) for the wifi module supports 100's of commands!
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 19:13, 06 January 19
That really sounds awesome! Now we need somebody who can use AT commands and tell us how to make such a CPC LAN.  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 11:19, 07 January 19
That really sounds awesome! Now we need somebody who can use AT commands and tell us how to make such a CPC LAN.  :) :) :)


Well,it's so easy to do it, that i'm pretty sure ,if you take a look at the user's guide and the BASIC terminal program, that "somebody" may well be... you!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ComSoft6128 on 17:09, 07 January 19
And this is one D20 disk - have a look at the number of files for transfer :o
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 17:32, 07 January 19
Exactly! Esp8266 it's really a marvel-chip, apart from creating a tcp server or connecting to another, it can be also used as an access point!
Isn't that chip also on the M4 board?
(well or related, it has the ESP12F)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 15:54, 08 January 19
Isn't that chip also on the M4 board?
(well or related, it has the ESP12F)
I suppose so, the chip is actually called ESP8266, and comes either as plain chip on a board or on board various pcbs for easier communication with existing hardware like ESP-01, ESP-07 which only need  Tx, Rx and power supply connections.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 23:13, 08 January 19
One more question: Is the port of this nice device compatible to the Mini-Booster Pins? Sorry, for that question.  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 00:59, 09 January 19
The serial port consists of only 4 pins, Tx, Rx, 5V and ground, so in practice any device with a UART interface can be connected!
Apart from the bluetooth and WiFi modules mentioned, there is also this (http://www.hobbytronics.co.uk/usb-host-mini) Usb host board which can be connected directly to the serial interface,and depending on loaded software, can host many different USB devices, like USB modems, flash drives, keyboard,mouses, joysticks, Midi interfaces... 
So if you connect this usb host module to the serial inerface ALL of these devices can potentially communicate with amstrad cpc!
Hmmm, read/write files to usb flash drives? That sounds nice... 

or maybe, sending SMS messages with your CPC? That sounds fun too...
And what someone could possibly do with a Synthesizer connected to an Amstrad CPC through midi?....    Infinite prospectives! :D

It  would be only a matter of developing the software on amstrad cpc  to do this! And considering the simplicity and ease of use of the serial interface, it would be rather easy to develop such programs even using locomotive BASIC!    ;)


Title: Re: Universal Serial Interface for Amstrad CPC
Post by: rpalmer on 05:31, 09 January 19
to connect any modern device such as USB the CPC would need a driver of significant code in order to get it to work at all.

rpalmer
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 07:32, 09 January 19
I could certainly use an RS232... don't have one yet.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 07:35, 09 January 19
to connect any modern device such as USB the CPC would need a driver of significant code in order to get it to work at all.

rpalmer
depends. there are certainly also rs232 / serial devices which have the controller and driver "on board" and don't need complicated drivers.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 10:54, 09 January 19
to connect any modern device such as USB the CPC would need a driver of significant code in order to get it to work at all.
rpalmer

Fortunately for us, the "driver" needed for a usb device, is already implemented in the usb host module firmware mentioned! Take a look here (http://www.hobbytronics.co.uk/usb-host-mini) and select "related products" tab.
All the "dirty" work needed for identify,nagotiate and establish connection with a usb device, is done from host module!
After that, you can perfectly communicate directly with the device through serial port simply by sending/receiving bytes/characters using simple inp() and out commands, even using BASIC! ;)


Title: Re: Universal Serial Interface for Amstrad CPC
Post by: rpalmer on 14:20, 09 January 19

Fortunately for us, the "driver" needed for a usb device, is already implemented in the usb host module firmware mentioned! Take a look here (http://www.hobbytronics.co.uk/usb-host-mini) and select "related products" tab.
All the "dirty" work needed for identify,nagotiate and establish connection with a usb device, is done from host module!
After that, you can perfectly communicate directly with the device through serial port simply by sending/receiving bytes/characters using simple inp() and out commands, even using BASIC! ;)
Well yes you are correct that this device appears to have done all of the work to convert the "serial" to "USB".

There is still the matter of a driver to handle such things as protocols like USB packets from Wifi, keyboard, mass media and so on. This i feel is where the majority of the work will be for a CPC to use such a device. Also dont forget a USB device is not one in which it provides an interrupt to the host meaning the CPC would constantly be polling it for status if done entirely in S/W and would need to handle what ever packet sizes the USB could issue (not impossible, but can be very difficult to handle and by all means give it a go).

I could easily imagine though a H/W device much along the line of a CPC I/O port to a simple PIC chip which then interacts with the above attached USB device. The pic chip would then interrupt the CPC following the Z80 protocols.
rpalmer
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 15:34, 09 January 19
First update: "Cold Start" having ONLY an Amstrad CPC!  :)

Ok, you have the serial interface, but in order to use it, you need to have some utlitites on your amstrad.
Of course i give you a utility disk image, but the "problem" is that you need first to transfer it to a disk (or to a usb stick if you have a gotek/hxc drive), in order to use it...
How nice would it be, if you didn't need to do that, and be able to use the serial interface t
o transfer programs, games,utilities,DIRECTLY, having ONLY a  plain Amstrad CPC...

Well, now you can do that! ;)

The "trick" to accomplish this, is by using a small BASIC program loader, that initally copies the assembly routine for file transfers from PC to CPC, DIRECTLY to Amstrad's memory, and then it's executed, in order to transfer files to a floppy disk!
Procedure is very simple and fast:
First, type and save this small BASIC listing to your Amstrad CPC:

10 MODE 2:MEMORY &7FFF   
20 OUT &FBD1,0:OUT &FBD1,1   
30 FOR I=0 TO 127
40 WHILE INP(&FBD1)=1:WEND
50 POKE &8000+I,INP(&FBD0)     
60 NEXT I
70 OUT &FBD1,0:OUT &FBD1,1   
80 PRINT"waiting for file..."
90 WHILE INP(&FBD1)=1:WEND
100 OUT &FBD0,9:OUT &FBD1,2:CALL &8000       
120 PRINT"file copied":OUT &FBD1,3:GOTO 70


Run the program, and open the Communication Utility on your PC, press 'Connect button' to establish a serial connection,and then press “Cold Start” Button. (function selection must be set to ‘Terminal’ and serial Speed to ‘115200’)
After a few seconds,you should get a “waiting for file…” message on your Amstrad screen. Now select “File copy to CPC” from Function selection list, press ‘select files’ button,and select the files “PC2CPC.BAS” and “PC2CPC.BIN” inside "Amstrad Utility disk files" subfolder in program’s folder. After a few seconds the 2 files should be transferred to your 3” disk.
Now, you can reset your Amstrad and run the “PC2CPC” utility, in order to transfer any other program, utility or game you want from PC!

I have updated the PC utility program and add the procedure to the User's guide, along with some extra Wifi AT commands (useful for making a wireless "Amstrad cpc only" network!)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 16:44, 10 January 19
Hi Ikonsgr,
Well, I would like to order 5 of these boards (or DIY kits). Please PM me the details. It's a great device for a great price and it has the potential to become a new network / communication standard.  :)
EDIT: MX4 version please.  ;) :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: asertus on 17:32, 10 January 19
Hi,


I am interested in 2 of them, with adapters.


THanks.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 19:04, 10 January 19
It's a great device for a great price and it has the potential to become a new network / communication standard.  :)


Well, that exactly was my intention! It surely has all the "requirements" for that: DIY,Cheap,easy to make and use.
If it get's enough acceptance from the community, it can surely become a standard. ;)




Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 19:15, 10 January 19
NEW UPDATE!


I've uploaded a new utility disk image, i add a small FORMAT utility (i compiled this (http://www.cpcwiki.eu/index.php/Programming:A_simple_disc_formatter_using_BDOS_functions) assembly code from CPCWIKI with maxam, hope there is no problem wtih that), and revised the User's Guide with some extra info.Also i upload a big collection of many games extracted from disk images ,(you can find them in the 1st post), in order to easy transfer them to disks using the PC to CPC function.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Etegar on 19:46, 12 January 19
Hi Ikonsgr,


Very interesting project. I would like to order 1 board if it's available with the edge connector adapter.

Thanks
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Dandare on 18:16, 13 January 19

Nice project,

I'm curious: at 32Mhz, a pic16 runs one instruction each 125ns.
Given that you need to identify the port, whether it's read or write, and either capture the bus or put the right response back in the bus (and take it out before the next instruction), I would say the timing is almost impossible to get right, considering you have less than 1us (8 pic asm instructions) to do it all.


Congratulations on the achievement. I can't imagine how you do it unless you are inserting wait states like there's no tomorrow  :)
(Does that pause switch gives a hint about this?)

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 23:50, 13 January 19

Nice project,
I'm curious: at 32Mhz, a pic16 runs one instruction each 125ns.
Given that you need to identify the port, whether it's read or write, and either capture the bus or put the right response back in the bus (and take it out before the next instruction), I would say the timing is almost impossible to get right, considering you have less than 1us (8 pic asm instructions) to do it all.
Congratulations on the achievement. I can't imagine how you do it unless you are inserting wait states like there's no tomorrow  :)
(Does that pause switch gives a hint about this?)


You are right, there is NO way all these to be done in less than 1uS, unless you have a PIC running at 200Mhz... :D 

So, of course amstrad need to be paused when circuit is activated (you just force "READY" signal to low and Amstrad can freeze.... for ever!),although the hole code execution for each sent/received byte is done in a few microseconds!
Now, apart from the need of instant activation of the curcuit and pausing of amstrad (which in the end ,was done using a logic gate chip, it was really impossible to do it using the pic and software routine, as they were too slow even @32Mhz),the most difficult part, was the correct reading of a  byte from serial port! The precise latch/unlatch of PIC's data port to amstrad's data bus, seemed to be impossible to achieve!
At some stage of development,i was so frustrated of not being able to sync everything right, that i thought the only way to do it, was using an extra octal 3state buffer chip (which is as big as the PIC itself ::)  ), between cpc's 8bit data bus and pic's data port, and enable it by IORQ signal (so the buffer would "automatically" make the correct "latch/unlatch" of pic's port to cpc's data port).
But then suddenly...an idea "hits me": studying in detail how Z80's is reading a byte from a port and combining this knowledge with the way Amstrad allows access of I/O buses to Z80, i managed to resolve this, by using only a small rudimentary "sample & hold" circuit (just a small diode and a capacitor) of the READY signal that fed a pic's input pin! You see,i discover that in the proccess of reading a byte from a port, i can ensure that the byte was "downloaded" correctly to accumulator when the 1st high pulse of ready signal occured AFTER unpausing amstrad. So what i did, was, unpause amstrad for 0.25uS (e.g. 1cycle @4mhz, exactly the clock of Z80 ;) ) and then repause it again. If in this time, the "sample & hold" pin was High, it means that byte was taken, and i could proceed to unlatching Pic's data port from amstrad's data bus and unpause amstrad completely! If not, then i issue again a 0.25uS cycle of "unpause/pause"  and do the same check! That way, i managed to "bit bang"  pic's port at exactly the correct time and with the minimum ovehead ,the hole check of "sample & hold" code, each time amstrad is paused, executes in only 0.5us!

I began to deal with this project since summer of 2017, and have spent literally many 100's of hours on this! In the process, i got involved with assembly programming (i even developed a code (http://www.cpcwiki.eu/forum/programming/how-to-readwrite-a-file-'byte-by-byte'-using-firmware-but-much-faster!/msg162099/#msg162099)
for fast read/write files byte by byte using firmware, because of this project!), DELPHI programming on the PC, PIC programming, basic programming on CPC, learn to configure and use bluetooth modules, wifi modules, usb to serial interfaces,and ofcourse  design the schematics and the pcb board for the circuit...

To get an idea, i began with this:
https://www.dropbox.com/s/g1zvz97hb67oql6/DSCN0752.JPG?dl=0 (https://www.dropbox.com/s/g1zvz97hb67oql6/DSCN0752.JPG?dl=0)
Which is evolved to this :
https://www.dropbox.com/s/dv9fo1zi7k6cpij/PROTOTYPE2.JPG?dl=0\ (https://www.dropbox.com/s/dv9fo1zi7k6cpij/PROTOTYPE2.JPG?dl=0\)
And finally end up to the pcb board shown in the 1st post...


Surely, it was a lot of trouble but, i did it  *mostly* as a hobby, a fun of making something creative,  and in the end,  sharing any knowledge and achievement with the community!


Long live Amstrad CPC! :)  
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Dandare on 11:00, 14 January 19
Very nice,
just a hint for future projects you may get yourself involved with: (Maybe you already know about it)
PICs with a Parallel Slave Port (http://ww1.microchip.com/downloads/en/DeviceDoc/31010a.pdf) will save you a lot of trouble and will let you interface with the CPC without wait states.


Downside is you'll have to go to a 40pin package at least to get that peripheral.

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 21:24, 14 January 19
That's really very nice feature! Sadly, microchip doesn't provide this feature to the parametric search list ,so it's difficult to find what models have this feature.
Anyway, if the "smallest" pic with such feature is with 40pins, i'm afraid it's way too large, bulky and with "overkill" pincount  (and probably much more expensive at least newer models with internal 32Mhz clock) for this project.
My first priority when i was looking for a suitable PIC, was to be able to operate at least @32Mhz (with internal osc), have 1Kb RAM, Hardware Uart, and have the minimum pin count for my needs (20 or 28 at most). Besides 16F1579, there is another  "pin compatible" and with similar features PIC ,16F1459 which operates at 48Mhz. I haven't tested yet, but i believe it can work directly (just with a different Hex file ofcourse) on the same board, and so you can have a "Turbo" version of the serial interface ,+50% faster!

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 10:42, 17 January 19
I just add a new "half price" purchase option (pcb board+PIC flashed with program).
With this, anyone can easily build the board by himslef, needing only a soldering iron!   ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 17:14, 17 January 19
Hi John,
I'd like to order 2 - assembled, if possible  :) Please send me PM for payment instructions.
CheersMichael
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: krusty_benediction on 10:05, 18 January 19
Nice project@Duke: do you think it can be used in association with the M4 in order to debug a CPC runing application from the PC ?. The M4 read memory from the CPC and send it to the PC through this interface
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Duke on 15:19, 18 January 19
Nice project@Duke: do you think it can be used in association with the M4 in order to debug a CPC runing application from the PC ?. The M4 read memory from the CPC and send it to the PC through this interface
Actually the M4 board already has a serial port exposed, its labelled (TX,RX,GND) on the top header, I can enable access to it, if anyone wants to use it.
 Could it or @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) serial port be used as link for debugging,  probably yes :)

@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) , nice project!
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: remax on 20:24, 18 January 19
Actually the M4 board already has a serial port exposed, its labelled (TX,RX,GND) on the top header, I can enable access to it, if anyone wants to use it.
 Could it or @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) serial port be used as link for debugging,  probably yes :)

@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) , nice project!


On which one would it be the easiest to have an RS232 port ? I'd love to test one of the wifi modems available (Retro Wifi SI (https://www.simulant.uk/shop/retro-computers-games-consoles/amstrad-cpc/retro-vintage-computer-wifi-modem-rs232-serial-hayes-compatible) or Wifi232 (http://biosrhythm.com/?page_id=1453))

(or perhaps one or both make those wifi modems not necessary ?)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 22:22, 18 January 19


On which one would it be the easiest to have an RS232 port ? I'd love to test one of the wifi modems available (Retro Wifi SI (https://www.simulant.uk/shop/retro-computers-games-consoles/amstrad-cpc/retro-vintage-computer-wifi-modem-rs232-serial-hayes-compatible) or Wifi232 (http://biosrhythm.com/?page_id=1453))
(or perhaps one or both make those wifi modems not necessary ?)

Well, as far as my serial interface is concerned, legacy devices that require "full feature" RS232 port with all extra signals like DTR, DSR, RTS etc are not supported.
But as you already said, you don't actually need any kind of these modems anymore,since you can connect directly to internet using the Wifi module, either with M4 board or serial interface!
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 01:03, 19 January 19
Actually the M4 board already has a serial port exposed, its labelled (TX,RX,GND) on the top header, I can enable access to it, if anyone wants to use it.
Yes, please, so we can connect.  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: VincentGR on 01:59, 19 January 19
What gunhed said  ;D
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Audronic on 02:18, 19 January 19
@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541)



Please see a PM from me


thanks Ray
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Etegar on 14:37, 27 January 19
Hi,


Thanks John, board received and tested this weekend with my usb2serial cable.  All your aplications are working fine  !!!!
I,m surprised especially with the transfer speed time (set at 115200 for default). It takes really few seconds in transferring a file from PC to CPC (directly to the 3” Disk). I supose that wifi conected modules will do the same quickly job as the usb2serial cable.
When the dsk transfer utility will be finished this really will save time and inconveniences with another  hardware solutions.
You have done a great job and this board. Please go on with this project.


Eduard

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 02:18, 28 January 19
Thanks Eduard, and if you set speed, up to 576000 using a usb2 serial cable, it's even faster!  :)
I will surely add dsk image transfer support in the future, but currently i'm  working on,IMO, an even more interesting project:
 direct load and run of programs from PC, with blazing fast speeds of ~twice the actual disk loading speed! (for example, load and run of a single 42kb binary game takes  ~4seconds!!!)
I use a similar procedure with the "Cold start" function, you only need to type a small basic program (to enable the transfer of the assembly routine from PC to Amstrad), and then using redirections of firmware's loading routines (e.g. some pokes), you can use the very same BASIC  commands, RUN"" and LOAD"", to directly load and execute programs from PC!  :)

I've already manage to use it for load and execute of BASIC programs and single Binary files, and now i'm working the direct execution of games with multiple files (which proved much more difficult thing to do...) . I believe i'll have it ready soon for anyone to use it. And it would be very interesting to see if it will work on a CPC 464 too, thus, providing a cheap,easy and super fast solution of loading games and programs on the "Cassette only" 464!
It would be the revenge of the CPC 464, loading games, twice as fast as a CPC 6128 with disks!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: HAL 6128 on 08:52, 28 January 19
... you only need to type a small basic program (to enable the transfer of the assembly routine from PC to Amstrad), and then using redirections of firmware's loading routines (e.g. some pokes), you can use the very same BASIC  commands, RUN"" and LOAD"", to directly load and execute programs from PC...
...how about creating a ROM which brings the CPC after booting in some kind of "listening" mode? Maybe also interesting for cross-compiling?
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 15:41, 28 January 19
Well, that would require to replace the hole Amsdos ROM with a custom one (like duke have done), which probably is something very hard and time consuming thing to do.
Also, in order to use a ROM for amstrad to read from it, the circuit  must implement full 16bit address decoding and most probable "on the fly" reading! That would require a much bigger PIC (possibly with 40pins) and far more complicated circuit...  ::)


Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 18:40, 31 January 19
What do you mean with 16 Bit address? Doesn't it decode the 16 bit I/O completely? If yes, which are the shaddow ports?

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 18:54, 31 January 19
...for example, load and run of a single 42 kb binary game takes  ~4 seconds!!!
Using FutureOS it takes about 2,7 seconds  ;D  But I'm sure the serial interface can do even better!  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 17:32, 01 February 19
Damn! Can't wait to get my serial board....  :D
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 19:51, 01 February 19
What do you mean with 16 Bit address? Doesn't it decode the 16 bit I/O completely? If yes, which are the shaddow ports?

Nope, just 2 address bit needed A5 and A10 (and the A0 which used for having data & control port). Of course the address bit selection was not random,but it's based on Amstrad's I/O port allocation:
http://www.cpctech.org.uk/docs/iopord.html
If you take a look there, you will see that, A10=0 defines I/O peripherals, and A5=0 a serial port. These 2 address bits, are combined with M1 and I/O request signals (when IORQ=0 and M1=1 means exclusively Input/Output request) to enable interface exclusively on ports &FBD0-FBDF! ;-)  And that way, i was able to implement address decoding using a small and cheap logic gate chip!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 14:17, 03 February 19
Then ports &FBDE and &FBDF should be used (instead of &FBD0/1)  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 10:35, 05 February 19
I suppose so, but this is true for any device. The CPC IN/OUT design uses 16 bits address instead of the "traditional" 8 bits. These I/O addresses,according to port allocation document,  are not fully decoded, thus a hardware device can be accessed through, with more than one address!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 21:32, 06 February 19
Exactly!  :)  Therefore the more bits we set to "1", the less interference we have. Actually some other expansions I have to check, if the I/O port can in a more "compatible" way can be addressed. Because nowadays lots of users have lot's of stuff on their CPCs / Plus.  :)


But back to the USIfAC (Universal Serial Interface for Amstrad CPC): I'm looking forward to work with it. In two weeks I start to have more time for computers again and the handling of the USIfAC can't be more easy.  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 04:06, 24 February 19
Received my five cards, now it's time to get some CPCs networked!  ;D ;D ;D


Thank you very much, the quality is great too!  :) :) :)