CPCWiki forum

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

Title: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
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 (or USIfAC (Universal Serial Interface for Amstrad CPC)  naming courtesy of Gunhed  :) )
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:
 
 

* DSCN1147.JPG
(109.95 kB, 605x422 - viewed 2007 times)


- 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 be less than 6euros!).

- SUPER FAST loading of many games/programs, DIRECTLY from the PC!(see "Direct Load" function in User's Guide, and here (https://www.dropbox.com/sh/hzp3a4b7fktcn8c/AAAj2U8otKw26j-chnd8uUxla?dl=0) is a list of games already tested and working)

- Easy and fast transfer of dsk images directly to Amstrad CPC disks!

- Easy and fast individual file transfer (https://www.dropbox.com/s/zzl18w9f5dljj9c/GAMES.zip?dl=0) (check link for 1000's of games extracted from dsk images)directly from/to Amstrad's Disks!

- Equipped with a reset button and a pause switch for Amstrad CPC!


And here is a small demonstration: Playing PONG in network with a Commodore 64! (https://www.youtube.com/watch?v=l9rWsShqKsE)   :D

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 with CPCDISKXP (http://www.cpcmania.com/cpcdiskxp/cpcdiskxp.htm) using an ide or a usb 3.5" floppy Drive),
-The PC utility program,along with CPCLOADER (for easy extracting dsk images) and a folder including the utility disk files,for direct loading from PC using "Direct Load" function,
-The User's Guide.

I have also developed a windowsprogram which you can use it to comunicate with Amstrad:

 

* driect_scr.png
(69.01 kB, 800x553 - viewed 1827 times)


It can be used for terminal file transfer, dsk image transfer, and RUN many games/programs directly from PC!


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)
And here is the assembly code for doing the same thing:

check_BYTE:   
        LD A,&FB
        iN A,(&D1) 
        DEC A
        JR Z,check_BYTE
ld   a ,&FB
in   a,(&D0)

Accumulator A now has the  received byte.

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.


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

- A ready made board for 8euros+shipping (2.5euros for standard, 5euros registered/tracked).

- A Basic DIY kit for 4euros,including postage. You will get the PCB board and PIC 16F1579 (flashed with the program).All other parts can be easily found in any electronic parts shop,check Bill of Materials here (https://www.dropbox.com/s/0z2cpcbxvl95s9v/Amstrad%20CPC%20serial%20interface.zip?dl=0))

- A Complete DIY kit for 6euros,including postage. This DIY kit will have everything:PCB board+PIC 16F1579 (flashed with the program)+4002Logic Chip+DIP sockets+Pause switch+reset button+resistors+caps+bjt+diode

- Extra Edge connector adapter costs +2euros.

- Extra Centronics connector adapter costs +5euros.



 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...  ;)

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!  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: LambdaMikel on 05:52, 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!  :) :) :)
My 2 also arrived, and great quality as well - didn't have a chance to test them yet though.
Thanks @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) !!  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 12:19, 24 February 19
That's great guys, i hope you will be able to make a good use of the serial interface!  ;)

Now,i'm happy to announce a MAJOR update:

- Add a new function for DIRECT load from PC,of many games/programs and with SUPER FAST speeds (~twice the speed of a disk drive or gotek/hxc emulator!)
- As i ordered bigger batches for pcb's and PICs, now i can offer ready made boards and DIY kits even cheaper!
- Update manual, programs etc.


First i want to thank Docent for his help  (http://www.cpcwiki.eu/forum/programming/mc-startboot-program-without-reseting-firmware-jumpblock/msg170920/#msg170920) on developing the code  for the direct load function.
The direct load function is actually a major upgrade of the "Cold start" function i developed earlier. With this, you will be able to load or run a program (either BASIC or  BINARY) and also many games, directly from the PC! The hole Procedure is rather easy and fast: First, run the windows application and set function to “Direct Load” (com speed will be automatically set to 115200). As with the "cold start" function, a small  BASIC program is required to be typed on the CPC, but now it's much smaller:

10 OUT &FBD1,0:OUT &FBD0,0:DI
20 FOR I=0 TO 341
30 POKE &A9B0+I,INP(&FBD0)
40 NEXT i
50 CALL &A9B0
 


Run the program, and after a couple of seconds, you will get the “Ready” prompt.
 From now on, any LOAD” or  RUN” command you will give, it will be  redirected to PC! Using the button “Direct Load Dir”, you can set the loading directory and have a list of all available files in it:

 

* windowsprogram1.jpg
(79.77 kB, 762x530 - viewed 459 times)


By setting loading directory to Amstrad Utility Disk folder, you can direct execute utilities WITHOUT needing first to transfer the utility disk image to a real disk (or to a usb stick if you have a gotek/hxc drive)!For example, you can simply give:

 RUN”Format.BAS” ,  in order to format a CPC disk, or

 RUN”PC2CPC.BAS”, for transferring files from PC to Amstrad disks

  After thorough testing, it is concluded that ~75% of games can be directly executed using this method! You can find many dozens of games that already tested here. (https://www.dropbox.com/sh/hzp3a4b7fktcn8c/AAAj2U8otKw26j-chnd8uUxla?dl=0)
And because this method requires to have files extracted from dsk images, i have also included the “cpc loader” utility, for easily extract multiple dsk images instantly!
For more details you can check User's guide too.

Now, the new function is tested with my CPC 6128, but it would be very interesting to see if it works with the "cassette only" 464, as it would provide a very easy and cheap solution for very fast loading of many games for CPC 464!
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: VincentGR on 13:13, 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!  :) :) :)


Waiting for a video with that  ;D
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 14:42, 24 February 19
This will take some time. Meanwhile let me ask some (stupid) questions, but this may be of common interest. So I prefer to ask here instead of writing tons of PMs.

The manual is great, but I want to be sure not to screw things up. From the old days I'm familiar with RS232 / RS485, but this is modern technology...

First question: To connect two CPCs using wires, what do I need to do?
Just connect Tx from the first card with the Rx from the second. And Rx from the first card with Tx from the second. Right?
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Patrick on 14:45, 24 February 19
It sounds good for me but add also ground.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 15:03, 24 February 19
The manual is great, but I want to be sure not to screw things up. From the old days I'm familiar with RS232 / RS485, but this is modern technology...
I've updated manual with even more details and information. Now there are BASIC and Assembly code examples for send and receive data and a hole new section describing the usage of the direct load function.

First question: To connect two CPCs using wires, what do I need to do?
Just connect Tx from the first card with the Rx from the second. And Rx from the first card with Tx from the second. Right?

 Well,i never tried this, but i believe you will also need the ground pin too (to establish a common ground level for the signals), as in case of direct serial connection of amstrad with CPC using a usb2serial cable adapter. In any case, when you use any kind of direct serial cables, NEVER use the 5v power supply pin, this is only needed for powering the various modules like bluetooth, wifi, usb host etc.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: GUNHED on 15:18, 24 February 19
Well,i never tried this, but i believe you will also need the ground pin too (to establish a common ground level for the signals), as in case of direct serial connection of amstrad with CPC using a usb2serial cable adapter. In any case, when you use any kind of direct serial cables, NEVER use the 5v power supply pin, this is only needed for powering the various modules like bluetooth, wifi, usb host etc.
Ok, so I will try this:

GND --- GND
Tx    --- Rx
Rx    --- Tx

Ordered cables for BT-modules and a BT module, which shall be able to connect to my Laptop which has BT inbuilt. As long I wait for the order to arrive I try that direct connection.  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Patrick on 16:12, 24 February 19
Another thing to consider is the length of the wires. Avoid using too long wires. TTL is not RS232.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Audronic on 01:24, 25 February 19
@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541)


Is there a link to the Support files please.
I have not been able to find them.


Thanks.  Ray
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 01:46, 25 February 19
https://www.dropbox.com/s/0z2cpcbxvl95s9v/Amstrad%20CPC%20serial%20interface.zip?dl=0

You can find it on the first post of this thread too.
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Audronic on 04:16, 25 February 19
@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541)


Thanks.
Would it be possible to add that link into the first Message Please. (Perhaps at the bottom of the Page) ? ?


Thanks  Ray
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 11:09, 25 February 19
The link was  already in the 1st message, but now i also changed the color to red to easily spotted by anyone
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: Audronic on 11:15, 25 February 19
Thanks


Ray
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: JonB on 09:53, 26 February 19
I'm a bit late to the party on this one, but tell me, is this serial interface also supported by CP/M Plus (6128)?
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ComSoft6128 on 10:01, 26 February 19
Good question.


As far as I'm aware it is an Amsdos only program at the moment but @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) will no doubt answer it definitively later.


Cheers,


Peter
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 18:35, 26 February 19
I'm a bit late to the party on this one, but tell me, is this serial interface also supported by CP/M Plus (6128)?

 Unfortunately i don't know much about CP/M so for the moment, there is no CP/M program that supports this interface.
But since usage is pretty easy even with Assembly code, maybe someone might want to develop a utility for CP/M plus too...  :)
Title: Re: Universal Serial Interface for Amstrad CPC
Post by: JonB on 08:22, 27 February 19
It's not in need of a specific CP/M utility program, the question is whether or not CP/M supports it already. I consider that very unlikely (it depends on which I/O addresses your interface uses and the UART it uses) but thought I'd ask anyway. Maybe someone has tried it?
Title: USIfAC: Universal Serial Interface for Amstrad CPC - Support for FutureOS
Post by: GUNHED on 21:17, 27 February 19
With the next update of FutureOS there will be support for the USIfAC board. Software will follow in time.  :) :) :)


EDIT: For the actual version, you can use the ConfigOS utility and activate the USIfAC too, so no need for an update. If I manage to release some software it will be fine too (just adding some automatic detection).

Title: Re: Universal Serial Interface for Amstrad CPC
Post by: ikonsgr on 00:12, 28 February 19
It's not in need of a specific CP/M utility program, the question is whether or not CP/M supports it already. I consider that very unlikely (it depends on which I/O addresses your interface uses and the UART it uses) but thought I'd ask anyway. Maybe someone has tried it?
Well, only 2 addresses used: &FBD0,&FBD1 (although interface answers to the hole range of &FBD0-&FBDF)
This might be useful too: http://www.cpctech.org.uk/docs/iopord.html
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 11:50, 01 March 19
Now I guess I need some help. Since I'm not so familiar with Bluetooth.

- At CPC-side I connected the USIfAC and to this a Bluetooth module (without button). I used the same module before with the Mini-Booster, so I know the module works.
- From the Disc I started the "Terminal" Application.

- At PC side I did start the "AmstradUtility.exe" application.
- I switched to Wi-Fi. Then clicked at connect.
- The PC / Laptop has an internal Bluetooth module

However I could not get any connection (115.000 baud and also tried 9600 baud, at both sides).


Is there a simple step-by-step idot-proof way to go?

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Audronic on 12:45, 01 March 19
@GUNHED (http://www.cpcwiki.eu/forum/index.php?action=profile;u=2029)


? are WI Fi and Bluetooth different devices ?


Ray
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:14, 01 March 19
Now I guess I need some help. Since I'm not so familiar with Bluetooth.

- At CPC-side I connected the USIfAC and to this a Bluetooth module (without button). I used the same module before with the Mini-Booster, so I know the module works.
- From the Disc I started the "Terminal" Application.

- At PC side I did start the "AmstradUtility.exe" application.
- I switched to Wi-Fi. Then clicked at connect.
- The PC / Laptop has an internal Bluetooth module

However I could not get any connection (115.000 baud and also tried 9600 baud, at both sides).


Is there a simple step-by-step idot-proof way to go?

bluetooth modules are actually serial devices, so you use 'Serial connection' not Wifi.
Also, i note on User's guide, the Tx and Rx signals does not need swap (i have swapped labels for easier connection as some people might not know a swap is needed) , so you should  connect pin Tx to Tx and Rx to Rx.  :)
About wifi modules, you should first run setwifi.bas in order to setup you wifi module, check user's guide fore more details! And ofcourse you should set Wifi module's ip on windows program too.
If everything works ok, the connection should be established almost imediately after pressing 'Connect' button. If there is a small delay of a few seconds, it means that connection is established but web server on wifi module is not up and running. If there is a longer delay (~20 secs) it means that wifi module is not connected to access point of your router
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:20, 01 March 19
@GUNHED (http://www.cpcwiki.eu/forum/index.php?action=profile;u=2029)


? are WI Fi and Bluetooth different devices ?

Ray

There is absolutely no relationship between bluetooth and wiFi.
Bluetooth is just a wireless point to point serial protocol just like Uart, rs232 etc, only it's wireless.
WiFi is actually a wireless Ethernet protocol, it's like connecting your device using ethernet cable only it's wireless.

Wifi module is something much more complex and 'heavy' than bluetooth  so IMO , for direct wireless connections, better option should be bluetooth.
 Wifi on the other hand, is useful for other things:
- The abilitiy to create a LAN
- offers a direct connection to internet
Hope this clears things up a bit.

There is also something else about wifi usage,it needs some "packet decoding" at amstrad's side for send or receive, as the data stream is encapsulated with a header, which needs to be removed. For example to send a string using wifi you must first send to serial port the command:
AT+CIPSEND=0,X
where X is the length of the string to be sent. Data string follows imediately after.

serial connections on the other hand, like bluetooth, are straight forward , you just send a byte directly and the other side received it as it is! Thus blutooth is easier to implement and takes less process (and for that it's a bit faster too).


Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:47, 01 March 19
I've just updated the User's guide, i've added detailed sections about sending/receiving bytes using serial/Bluetooth modules AND WiFi module, including an example BASIC routine for sending bytes using WiFi module! Also, added some more details and troubleshooting on the "Configure ESP8266 WiFi Module" section too.
So, GUNHED i believe now you can find everything you might need for writing your own utlities/programs/games  that will exploit all USIfAC possibilities!  ;)

Btw, in the weekend i will start dsk image transfer trials...   ::)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Colday on 21:20, 01 March 19
Hey.


I've built and connected my board to my 6128 (and a 464 but we will come back to that).


When I run the little basic program for direct load connection all it does is resets the Amstrad. (after a couple of seconds)


Anyone any idea what I'm doing wrong?


I've PM'd Ikon with the same question but thought it may be useful here in case anyone is having similar issues.


464 - Well, it basically did exactly the same, just reset the CPC after running the Direct Loader program.


Ideas anyone?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 21:37, 01 March 19
The "problem" about using a serial port with DB9 or DB25 ,like those on older PC motherboards, is a major difference in voltage levels comparing to UART's  TTL level.
Serial interface works at 0-5v, where 0=low and 5v=high, where serial ports goes from negative 3-25volts for High, to +3-25volts for low!
Fortunately there are ready made RS232 to TTL level converters which are very cheap too:
https://www.ebay.ie/itm/RS232-To-TTL-Converter-Module-COM-Serial-Board-MAX232CSE-Transfer-Chip-atmega16/153166180732?hash=item23a96a717c:g:QEgAAOSw3JRbjjpZ:rk:2:pf:0
This is to use it with a classic DB9 serial port, and this:
https://www.ebay.ie/itm/3X-Mini-RS232-to-TTL-Converter-Module-Board-H1V9/283193772210?hash=item41efaa08b2:g:jKYAAOSwRNhbtbLU:rk:1:pf:0
can be used if you only have a serial port pin header on your PC motherboard.
I believe the above adapters would allow an RS232 serial port to work with USIfAC too.

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Dandare on 23:48, 02 March 19
There is absolutely no relationship between bluetooth and wiFi.
I concur... for the most part  :D  Bluetooth uses some of the radio spectrum of WIFI.


Bluetooth is just a wireless point to point serial protocol just like Uart, rs232 etc, only it's wireless.
WiFi is actually a wireless Ethernet protocol, it's like connecting your device using ethernet cable only it's wireless.


While most of the uController friendly Bluetooth modules do implement the serial profile, Bluetooth Stack is not only serial, it has different profiles. In fact, bluetooth allows for several simultaneous connections and allows different profiles to be used concurrently.


Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 01:13, 03 March 19
While most of the uController friendly Bluetooth modules do implement the serial profile, Bluetooth Stack is not only serial, it has different profiles. In fact, bluetooth allows for several simultaneous connections and allows different profiles to be used concurrently.

Indeed, bluetooth ,although it's a serial point to point protocol, it's also based on master/slave model, so a number of bt slave modules can connect simultaneously to a master bt module, thus you might be able to create a CPC LAN even using BT modules!  :)
Still, Bluetooth stack has nothing to do with the much more "heavy" and complicated WiFi's TCP/IP stack (thus WiFi modules use powerful 32bit RISC CPUs) ...  ::)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 20:12, 04 March 19
When switching the serial interface port (COM1...7) then more often (COM 1-4) the PC program tells "Serial interface error!". Then the PC program ends. It's a bit nasty to restart it all the time for every single try.

With the PC program (terminal) I can not enter a single letter, it always makes an acustic warning.

Also with COM 7 at least with the CPC terminal program I can send "Hello" and as response I get "heo" or "elo" back.

The manual ist better, but it lacks step-by-step explanations. Did anybody use a Laptop Bluetooth device for transfer? Or do I need to connect a Bluetooth to the PC via a USB cable?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 21:04, 04 March 19
GUNHED, the problems you describe can be caused:

1) If you switch  serial port while it is CONNECTED, you have to disconnect serial port by pressing the "CONNECTED" button before make any switches!

2) You are trying to use an RS232 serial port (usually on board serial ports on motherboards). As  already mentioned (http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/universal-serial-interface-for-amstrad-cpc/msg171295/#msg171295), the classic RS232 serial ports are NOT combatible as they  use completely different voltage levels for "high" and "low" compared to the TTL levels of PIC's UART interface. But fortunately there are very cheap adapters for this too.

3) Ensure that serial speeds are matching! Default serial speed of the Usifac is 115200, so make sure the other side is set to the same speed, or change to the desired speeds using terminal (for the usifac) and port speed drop box on windows program.

Finally i should note that enumaration of serial ports is done once when program started. If you connect a UB2SERIAL cable adapter (or enable a serial port) AFTER you have run the program, it will not be recognized (i might add a "refresh ports" button for this,in order to avoid need for restart program)!

Hope these will help
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 00:24, 06 March 19
I've just transfer the dsk image of Double dragon 3 to a 3" disk in....40Seconds!
Coming soon to your near USIfAC!  :D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 18:35, 06 March 19
I've just transfer the dsk image of Double dragon 3 to a 3" disk in....40Seconds!
Coming soon to your near USIfAC!  :D


Can you please tell us step by step how you did it? So we can reproduce.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 23:27, 06 March 19
Don't worry, in a few days i'll upload the updated program along with the utility on amstrad cpc and update the manual of course.
But here is a small preview:

 

* new_prg.jpg
(80.14 kB, 766x548 - viewed 460 times)


It's a rather simple procedure, you just  select the "Image Copy to CPC" function, and using "Select Image" button, you choose the dsk image you want to transfer.
 Then, you just run the utility on amstrad CPC, a :"Insert a disk and press any key" message appears,you insert an empty disk, press a key, and after ~40seconds you will have your disk ready!
The program will also notify you what kind of disk format is needed (disks must be either data/system/ibm formatted), you can use the format utility inside Utility disk for this, it's actually  really fast too, formating a disk takes ~15 seconds! 
Of course since i use AMSDOS routines for the transfer, images with more than 40 tracks or strange sectors (e.g. usually copy protected games), might not  be copied to disk correctly. For these, program tries to cut  all the non AMSDOS track/sectors (these cannot be written on disk anyway, you get a "Disk error,Ignore or cancel" message on each attempt of writing a "curious" sector) and writes all other. In a couple of cases, an image with 41-42 tracks, copied succesfully to disk, by just discarding the extra tracks, so although it's a "long shot", i decided not to prohibit the transfer of copy protected images but rather leave this option just in case it might work... Still, i will try to develop a way for copying copy protected images, maybe by utilizing this (http://www.cpcwiki.eu/index.php/Programming:Formatting_a_track_on_a_disc) track format routine by thaker, if it can be used for non standard track/sectors of course. The other "solution" might be to edit directly the extended disk parameter block, EDPB, at &A890 but i might need some help on this  ::)

Also, i've  added a "Rescan" button, for refreshing the available Serial ports without needing to restart the application.

One other thing that worth mentioning, is that the actual transfer speed you get, depends heavily on the layout of sectors in a track.
 After copying a few dozens images to disks, i noticed that most of the standard dsk images, have a sector layout on each track that results in requiring ~double the transfer time to disk (~80 seconds). These images have sector id's in series order e.g.: C1, C2, C3... C9 (these are the most common sector id's for DATA format disks).
 On the othe hand, most of extended dsk images use a different layout (kind of "interleave" order: C1,C6,C2,C7,C3,C8,C4,C9,C5) that allows the admittedly very fast transfer of ~40seconds/dsk image! So, i manage to rearrange "on the fly" the order of the sectors of a "slow" image, to match this of the "fast" image, and so now, all games can be written  fast!  :D

Next thing follows, is adding a patched "READ SECTOR" routine for the direct load function! If all goes well, you'll might be able to run CPM games (that needed |CPM to run) and games that used a small "disc" file header without individual files, which currently not supported by the direct load! And the funny thing is that maybe even  some copy protected games that can't be transferred to disk , might run directly using this method!  :)

Keep in touch!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:11, 07 March 19
After a little talk with my good assistant Docent,  :)  ,he suggests that i could format a track "on the fly" ,before writing sectors, thus enabling an image transfer WITHOUT needing for the disk to be pre-formated! (and hopefully will enable to write copy protected images with "Strange" track/sectors too).
As i believe this would offer much greater convinience, i've decided to postpone a little the presentation of the dsk image transfer, in order to develop this enhancement.

Stay tuned!  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Dandare on 13:50, 07 March 19
As a related USB project, I just uploaded a demo of the upcoming game transfer by USB on a Dandanator CPC. It loads and run a game from the PC to the real CPC in about 6 seconds.


Check the post here: Re: CPC Dandanator Mini 1.3 - WIP (http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/cpc-dandanator-mini-1-0-wip/msg171579/#msg171579)

@ikonsgr, Adapting your current Disk transfer software to run from a dandanator CPC is something we can look into if you want :D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 15:17, 07 March 19
Since I had no luck to connect the USIfAC to a Laptop using Bluetooth my next attempt was to connect the USIfAC to the PC using a cable, which goes into one USB port. The same cable works flawless with the Mini-Booster. The PC software did fix me to COM6, I couldn't change it. The speed was 9600 baud (both of course). I tried the terminal program, no success at all.
The next and last attempt will be to connect two interfaces from CPC to CPC directly. Hopefully it will work, just need to get some appropriate wire.


Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 15:40, 07 March 19
Since I had no luck to connect the USIfAC to a Laptop using Bluetooth ..
On the other hand, i was able to chat with a lenovo tablet and my old LG smartphone using bluetooth...  ;D 
In most cases, if you are unable to connect with a device that has a build in bluetooth, this caused by wrong role setting (master/slave) of the bt module on amstrad. Check the bluetooth section on my user guide, to see how you can change that (it's only a single AT command: AT+ROLE=1 or 0...)

my next attempt was to connect the USIfAC to the PC using a cable, which goes into one USB port. The same cable works flawless with the Mini-Booster. The PC software did fix me to COM6, I couldn't change it. The speed was 9600 baud (both of course). I tried the terminal program, no success at all.
If we are talking about the usual cheap prolific usb2serial adapter cable, then 100% it should work directly! Did you try my terminal program to see if the port is recognized correctly?  In any case this "fix to com6, I couldn't change it"  doesn't sound very good... ::)

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 15:52, 07 March 19
As a related USB project, I just uploaded a demo of the upcoming game transfer by USB on a Dandanator CPC. It loads and run a game from the PC to the real CPC in about 6 seconds.
Check the post here: Re: CPC Dandanator Mini 1.3 - WIP (http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/cpc-dandanator-mini-1-0-wip/msg171579/#msg171579)
Well that is expected, if i'm not mistaken, the "loading" using Dandanator it's merely a direct memory transfer between your device ram and amstrad's ram (or something like that)...  ;D
If i may ask, is dandanator a DIY free project?  And what is the actual cost of making one or having one from you?
I believe these are critical factors for a project to be REALLY useful and widely accepted,don't you think?

@ikonsgr, Adapting your current Disk transfer software to run from a dandanator CPC is something we can look into if you want :D
Well, all source code and binaries are given freely (check 1st post on this thread) for anyone who wants to  modify,edit, change etc, to make their own applications. If there is anything else you might want to know fell free to ask!  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 16:06, 07 March 19
In most cases, if you are unable to connect with a device that has a build in bluetooth, this caused by wrong role setting (master/slave) of the bt module on amstrad. Check the bluetooth section on my user guide, to see how you can change that (it's only a single AT command: AT+ROLE=1 or 0...)


Would be nice if you could put this in your software, I didn't know about it. Also I don't know how to find the CPCs Bluetooth-Module. But I do find the one of the Mini-Booster. I nevertheless take a break, it's quit frustrating.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 16:11, 07 March 19
All the informations one might need to use a BT module with Usifac, can be found in the user's guide bluetooth section (it's only a single page after all...)!
There you can find a recomendation of what BT modules to use, and where to find/buy them ,along wiith photos, and a step by step precedure (like you wanted  :) ),to configure the modules! 
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Dandare on 16:15, 07 March 19
Well that is expected, the "loading" using Dandanator it's merely a direct memory transfer between your device ram and amstrad's ram...  ;D
If i may ask, is dandanator a DIY free project?  And what is the actual cost of making one or having one from you?
I believe these are critical factors for a project to be REALLY useful and widely accepted,don't you think?
Well, all source code and binaries are given freely (check 1st post on this thread) for anyone who wants to  modify,edit, change etc, to make their own applications. If there is anything else you might want to know fell free to ask!  :)


The CPC Dandanator has no ram :) , so what you have seen is quite tricky. The game loads from the PC via USB to the CPC Ram directly by means of hardware hacking an opcode. When activated, LD A,(HL) does not loads a with the content of the address pointed by HL, but returns the bit of the serial port. Then a Z80 asm bitbanging at 115.200bps does the rest. When loading a game you have to restore the registers, CRTC, GA.... so that has to be done as well.


CPC Dandanator is public domain since its first appearance on September last year. It's a brother project of the ZX Dandanator, launched in 2016. There are 382 cartridges on the field right now (ZX Dandanator numbers are way over 2.000 units).


BOM for materials is around 8€ without the plastic case. All information is in www.dandare.es (http://www.dandare.es).


I'd check your code in the first post, thanks.




Edit: I did post the source code for the ZX Dandanator PIC, the VHDL Source Code for the CPC Dandanator CPLD, Z80 source code for ZX (CPC coming when cleaned ;) and all the sources of the Java tool in GitHub. Are you planning to post your source code? Thanks.


For what I've seen there is a list of games you support. Is this a manual process?. I'm approaching this by Snapshots, so any game snapshot, CDT or DSK-"beta" (I have an embedded CPC emulator in the Java Tool) with no modification is supported (I'm quite positive some of them may fail in this v1, though)


Also, you may want to consider integrating the USB to TTL in your pcb as I did with the CPC Dandanator, so you just plug a cable between the PC and the board. I used an external USB-TTL adapter for the ZX Dandanator but, in my opinion, having the USB connector in the cartridge is a much better user experience and cost is not to high.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 16:37, 07 March 19
That sounds really hard thing to do, indeed. It's definetely a good alternative for fast and easy loading on spectrum zx and amstrad cpc 464 users.
But if i may say, Usifac has nothing to do with dandanator, as it's not just a "loading device" for amstrad (this is just one of the possible usages) , but rather it's a very cheap (either to buy or make yourself) serial interface implemented with a PIC mcu,  which means that usage could be VERY versatile, it can be used to connect and communicate with anything with a UART serial interface, from direct serial cables ,bluetooth modules, wifi modules even usb host adapters and who know what else!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Dandare on 16:42, 07 March 19
That sounds really hard thing to do, indeed. It's definetely a good alternative for fast and easy loading on spectrum zx and amstrad cpc 464 users.
But if i may say, Usifac has nothing to do with dandanator, as it's not just a "loading device" for amstrad (this is just one of the possible usages) , but rather it's a very cheap (either to buy or make yourself) serial interface implemented with a PIC mcu,  which means that usage could be VERY versatile, it can be used to connect and communicate with anything with a UART serial interface, from direct serial cables ,bluetooth modules, wifi modules even usb host adapters and who know what else!  ;)


Absolutely, I just linked here the USB load since both projects kind of share that aspect. Dandanator is a game cartridge (both CPC464 and 6128, and the likes.. 664, KC Compact, Plus series..) that happens to have a USB. Yours is a SERIAL interface (and much better at that, of course) for CPC, I get it :D .

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:31, 07 March 19
BOM for materials is around 8€ without the plastic case. All information is in www.dandare.es (http://www.dandare.es).
That's really cheap indeed. Having said that, i'd like to note some things concerning the "DIY aspect" of various hardware projects:

- A major "problem"  is the PCB board, as even if you share the gerber files, i doubt someone would order the minimum of 5pcbs batch to a chinese PCB maker ,to make just one board, unless it can make the pcb by himself, which i believe, it's NOT the case for the vast majority of amstrad users!  :) 

-  Another matter for a potential DIY, is the need for programming/flashing of CPLD's, MCU's, EEPROM's etc which usually require extra hardware/software.

- The level of complexity of the circuit itself might be a major factor, as larger boards with a lot of components  (especially if there are SMD's), might require greater soldering skills and equipment

All the above greatly influence the REAL potential for DIY, regardless of the cost. So, my first priority when i started the design of the serial interface, was to make it as cheap, as simple and as easy to make/use as it can be! That way, the... "hardware aspect" of the project, was minimized to a minature pcb of ~5X3cm with very few components, and all the potential usage is made by software!  ;)
 

Edit: I did post the source code for the ZX Dandanator PIC, the VHDL Source Code for the CPC Dandanator CPLD, Z80 source code for ZX (CPC coming when cleaned ;) and all the sources of the Java tool in GitHub. Are you planning to post your source code? Thanks.
  That's really an admirable job you did, perhaps compared only with "M4", the other "super board" made by duke, really much more adavance projects than my serial interface... ::)

For what I've seen there is a list of games you support. Is this a manual process?. I'm approaching this by Snapshots, so any game snapshot, CDT or DSK-"beta" (I have an embedded CPC emulator in the Java Tool) with no modification is supported (I'm quite positive some of them may fail in this v1, though)

 In 2 words, in my case everything is made by software. I just patched the firmware loading routines thus all "RUN" and "LOAD" commands referred to a directory in your pc.
You can see all the details about the "direct load" project that utlizes the serial interface (along with a lot of Z80 asm code), here (http://www.cpcwiki.eu/forum/programming/mc-startboot-program-without-reseting-firmware-jumpblock/).


Also, you may want to consider integrating the USB to TTL in your pcb as I did with the CPC Dandanator, so you just plug a cable between the PC and the board. I used an external USB-TTL adapter for the ZX Dandanator but, in my opinion, having the USB connector in the cartridge is a much better user experience and cost is not to high.

 Well,as i previously said, i'd like to keep the hardware apsect of the project as cheap and easy to make as it can be, and since usb2serial cable adapters, bluetooth modules and wifi modules are very cheap and easy to obtain,i  considered better let the potential user to choose!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 00WReX on 09:40, 09 March 19
OK,so today I finally got out a CPC464 to have a play with the serial interface (had it for weeks but not touched it).

Anyway, feeling like this would all be very straight forward as I have played around with this type of thing on many occasions...I hit a very unexpected roadblock.

So, my problem is I cannot get the Windows utility to recognise a COM port ???

I have multiple USB to serial devices, with the FTDI chipset being the main ones I use (for re-flashing GOTEK software amongst other things).
I even have one like the one pictured in the user guide, I usually use that on the Atri XL's for a SIO2PC solution, so I know they all work.

I Tried different ports, different USB to serial devices, rebooted the computer...nothing.
I always plug the USB to serial device in before starting the software so that the port gets allocated first...but absolutely no joy.

Attached is a screenshot of my PC (Windows 7).

 

* scrnshot_usb_serial.jpg
(218.53 kB, 1366x768 - viewed 358 times)

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ComSoft6128 on 10:15, 09 March 19
I have exactly the same problem and have tried the interface on two different Windows 8 laptops. A Windows problem? Windows 10 required?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 00WReX on 13:21, 09 March 19
A little update...

I have an old laptop running Windows XP, so with nothing to lose I tried that.
Well, as far as serial port connection goes (via the windows utility program) it connected...
It immediately had the COM port in the 'Port' drop down window and connected as soon as I pressed the 'Disconnected' button.
My Windows 7 laptop never sees a port in the drop down window.

But that is about as much success as I have had.

I thought I would have a go at the direct load function using the simple 'type-in' provided in the manual.
But the CPC just locks up.

I had the USB to Serial adapter going the the CPC adapter in the rx to tx and tx to rx  configuration as you would expect.
If I do reverse these, and run the same 'type-in', then I actually get a 'Serial error' message from the Windows utility...so there is something going on between them.

I'm using a 464, so unsure if things have been tested on this model.

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 00WReX on 14:12, 09 March 19
Sorry...another quick update.

Quote
I had the USB to Serial adapter going the the CPC adapter in the rx to tx and tx to rx  configuration as you would expect.
If I do reverse these, and run the same 'type-in', then I actually get a 'Serial error' message from the Windows utility...so there is something going on between them.

With the connections going from tx to tx and rx to rx the 'Terminal' program works  ???
Typing on the windows PC appears on the CPC and vice versa.

But the 'direct load' function does not work and causes the 'serial error' as previously mentioned.

OK, that's it for tonight...
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 12:00, 12 March 19
All right,i made some more thorough tests, and it seems that there is a problem with the serial port enumaration code under windows 7/32bit versions only (never thought of that, since it worked fine on windows 7/8/64bit, and windows xp/32bit too...  ::)) .This windows version is most likely what the  laptops you've tried had installed, thus the problem occured.
 I've made some changes to the code, and now it should work ok (i already test it on a windows 7/32bit and worked fine, previous version returned no com ports), so  try this (https://www.dropbox.com/s/6oe3yr2g3so7egc/AmstradUtility.zip?dl=0) and tell me if it works.
Btw, this has the dsk transfer function too enabled, it's still in beta testing but i beleive soon it will be available :D


p.s. Onboard serial ports on old laptops does NOT work directly  as explained eralier (http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/universal-serial-interface-for-amstrad-cpc/msg171295/#msg171295) (also none of these old ports seem to support speeds greater than 115200)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ComSoft6128 on 12:22, 12 March 19
Thank you.
I will try it out this weekend.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 17:51, 12 March 19
Connecting a CPC with a CPC using a 3-wire cable works very well. I got my new wires and soldered them together, and the Terminal program works very well. I used:

Tx --- Rx
Rx --- Tx
GND - GND

Next step: Make a CPC network out of them.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 23:22, 12 March 19
GUNHED, you can also use bluetooth modules instead of direct cables, that way, you can have amstrads in a distance up to 10 meters apart!
For Amstrad LAN, you should use wifi modules, and better try it first using  a router as access point (where all wifi modules should connect to), and if all goes well, then you could try to use one of wifi modules as access point to create a completely "Amstrad only" lan network! 
I'm still waiting for a couple of wifi modules i've ordered to make some tests my self...  ::)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 23:47, 12 March 19
Well, I tried it, with two HC-06 modules (without button). But they don't communicate. I'm probably the most inexperienced Bluetooth user ever.

In case I enter in one of the terminal windows: AT+ROLE=1 nothing happens. I do a reset of the CPC and start terminal again. Nothing happens. Sorry, I still seem to forget something.

Maybe it's because they are both HC-06?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 23:55, 12 March 19
BT modules without button, can't enter in administration mode easily, in order to  give AT commands (i think there is a way ,by holding ENABLE pin to ground or something like that) , so you can't change either role or  speed.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 00:00, 13 March 19
Ok then I get one HC-05 for one CPC and can use the other HC-06 for the other CPC, right?

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 00:03, 13 March 19
Yes,i suppose you could do that, but they will only be able to communicate at default speed which is 9600bps.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 00:04, 13 March 19
Ok, I'll get _some_ HC-05.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 17:36, 23 March 19
MAJOR UPDATE!

 

* driect2_scr.png
(69.01 kB, 800x553 - viewed 585 times)


- Finally,a dsk image function is added to the utility program! It supports data/system format images and with quite fast speeds: ~55seconds to write a 180kb dsk image to an unformmated disk, or ~40seconds to an already amstrad formatted disk (@460800bps)!

- MAJOR update of user guide: new sections with detailed instructions and help photos for each function were added, along with an active table of contents for easy guide, as manual has become 20+pages!

- Add an extra button <Caps Lock> on Amstrad CPC2PC program,to select/unselect all the files at once! This is useful, if you want to transfer all files of the disk, or if you want to “invert” the already selected files (e.g. all selected files will be unselected, and all other, will be selected).

- Fix a bug which prevented the enumeration of serial ports in Windows vista/7 32bit

- Added a "rescan" button for rescanning serial ports after application is started (in order to avoid close/reopen of application for serial port acknowledge)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 15:49, 24 March 19
Added ~20 more games in direct load games list (games that are tested and verified that work ok with direct load function):
https://www.dropbox.com/sh/hzp3a4b7fktcn8c/AAAj2U8otKw26j-chnd8uUxla?dl=0
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 18:25, 11 April 19
Just a question for completeness. The USIfAC I guess works with 8N1. Is it possible to change, Parity, Bits/Byte, Stop-Bits ... ?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 17:34, 12 April 19
Good question.

Any somebody please try the MP3 module test with USIfAC as well (if nobody volounteers, I will try at some point). It worked well with LambdaSpeak 3's serial port.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 17:43, 15 April 19
You could connect to LS3 serial port? Did you use 8N1?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 18:55, 15 April 19
You could connect to LS3 serial port? Did you use 8N1?


Yes, 9600 8N1. You can see how to send play / volume / stop  commands in the video I posted.
I can also share the DSK.


ACtually, the latest LS30.DSK should already have "mp3.bas". I guess it should be easy to adjust for USIfAC.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 19:05, 15 April 19
Hmm, does not allow to upload DSK... here are screenshots for the MP3.bas


EDIT: note that you only need to send ONE 255... it just because 255 needs to be escaped in LambdaSpeak serial interface.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:40, 22 April 19
Just a question for completeness. The USIfAC I guess works with 8N1. Is it possible to change, Parity, Bits/Byte, Stop-Bits ... ?
   These are not supported by the hardware serial interface on PIC 16F1579.
 

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 17:17, 22 April 19
   These are not supported by the hardware serial interface on PIC 16F1579.
 
I guess these modi are mostly for exotic and devices of historical interest anyhow... never had anything else than 8N1 anyhow. @GUNHED (http://www.cpcwiki.eu/forum/index.php?action=profile;u=2029) do you know of any devive that's not using 8N1?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Dandare on 02:03, 23 April 19
The PIC EUSART supports 9-bit transmission. This bit could be used for data, parity or serve as a second stop bit, but not any two of them at the same time. Calculation of the parity bit should be sent alongside the data byte, by setting TX9D. In the same way, testing for receiving data parity should be done on the RCIF ISR.


Including a second stop bit or even half a stop bit for 1,5 standard value could potentially be done by a timer or delay after the TXIF is set, using the idle status of the line as a stop bit. This is, however, a bit of a stretch of the EUSART.


So, potentially this is what the PIC could do, Note that sometimes the stop bit is done by the hw peripheral itself and sometimes by means of said delay.


9,N,x
8,(Even/Odd),x


But... at the end of the day, almost everything is 8,N,1.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 02:59, 25 April 19
There _were_ lots of other devices than 8N1 back the day, but today I guess I'm pretty fine with having only functions dealing with 8N1.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 260Z on 13:51, 27 May 19
This project sounds awesome  :D


Will send a PM


Cheers,
Rob
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Fabrizio Radica on 23:10, 10 June 19
Hi :)
I've recently bought this module on ebay :)

Can i connect, and use (fm player?), this FM Module on CPC? i've already use it on C64.
https://www.youtube.com/watch?v=FUan3vibg18  (https://www.youtube.com/watch?v=FUan3vibg18)
Ciao!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 00:10, 11 June 19
Unlikely. That's I2C, not serial / UART.
You could use it with LambdaSpeak 3 instead of RTC board  ;)


This one might do for UART / USIFAC:
https://www.amazon.com/UTP-87-108MHZ-Receiver-Wireless-Microphone/dp/B07FKRML7B/ref=sr_1_6?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-6 (https://www.amazon.com/UTP-87-108MHZ-Receiver-Wireless-Microphone/dp/B07FKRML7B/ref=sr_1_6?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-6)


Or this one:
https://www.amazon.com/UTP-87-108MHz-Wireless-Microphone-Receiver/dp/B07FKR5GYD/ref=sr_1_20?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-20 (https://www.amazon.com/UTP-87-108MHz-Wireless-Microphone-Receiver/dp/B07FKR5GYD/ref=sr_1_20?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-20)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Fabrizio Radica on 14:23, 11 June 19
Unlikely. That's I2C, not serial / UART.
You could use it with LambdaSpeak 3 instead of RTC board  ;)


This one might do for UART / USIFAC:
https://www.amazon.com/UTP-87-108MHZ-Receiver-Wireless-Microphone/dp/B07FKRML7B/ref=sr_1_6?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-6 (https://www.amazon.com/UTP-87-108MHZ-Receiver-Wireless-Microphone/dp/B07FKRML7B/ref=sr_1_6?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-6)


Or this one:
https://www.amazon.com/UTP-87-108MHz-Wireless-Microphone-Receiver/dp/B07FKR5GYD/ref=sr_1_20?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-20 (https://www.amazon.com/UTP-87-108MHz-Wireless-Microphone-Receiver/dp/B07FKR5GYD/ref=sr_1_20?keywords=stereo+radio+module&qid=1560200987&s=toys-and-games&sr=1-20)
oh.. can i use USIFAC + LambdaSpeak 3 + Mp3 module?
if yes.. i would like to buy LS3, now (how much costs?) :)
Sounds great for my LocomotiveBasic Games like this.

https://www.youtube.com/watch?v=qhCgyKwt6JQ (https://www.youtube.com/watch?v=qhCgyKwt6JQ)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 14:51, 11 June 19
oh.. can i use USIFAC + LambdaSpeak 3 + Mp3 module?
if yes.. i would like to buy LS3, now (how much costs?) :)
Well, here I run a CPC 6128 with USIfAC and LambdaSpeak III very well.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 20:29, 11 June 19
@Fabrizio Radica (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1837) if you want to buy LS 3 because of the UART Radio, then let's wait a little bit, I also ordered on of these to check them out, so I can give you better support once I got one running.


The prices for LS 3 vary depending on what you want to get - it is configurable. The prices have been posted in the LS 3 thread, please have a look there.


Cheers
Michael
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 260Z on 13:20, 14 June 19
Howdy @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) and all  :)


Received my Serial Interface today , and I'm absolutely loving it. Fantastic piece of hardware.


Before I discuss a couple of quirks , I'll fully disclose the setup I'm running , just in case it's somehow relevant. Plus anyone else running this setup, or similar, should be confident that this will run on their system.


464 -> MotherX4 Board + @revaldinho (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1776) memory expansion 512kb + USIFAC -> Rombo Redux Deluxe board ( numerous roms ) -> DDi-1 with Parados Rom -> x2 FD-1 Drives


Firstly , Direct Load and PC2CPC works perfectly. But the Dsk2Disk utility , I'm assuming this has been programmed for Basic 1.1??? . As line 1015 CLEAR INPUT , upset my lowly 464...lol.  All good though as I simply deleted this line and it appeared to function perfectly.

Edit : Just realised the impact of removing CLEAR INPUT. Will look into the 1.0 equivalent.

Secondly , but much more sadly :( , the windows application refused to recognise the R-Type 128k DSK , saying it wasn't AMSDOS compatible. This is only an assumption , as I don't know for certain , but I'm assuming that R-Type is designed for Parados Formats ?? . If this is the case , is it possible to have support for Parados Formatted disks included ??


The final point is trivial really , as I could probably program this myself into the BAS flle , but an option to select the destination drive ( A or B ) in DSK2DISK and PC2CPC would be nice :)
 
But otherwise I'm loving what you've done here @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) . I can write files directly to my disk drives from my PC  :D


Between you, @revaldinho (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1776) and @The Equalizor (http://www.cpcwiki.eu/forum/index.php?action=profile;u=2279) its been a good couple of weeks  ;D


Cheers,
Rob
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:43, 21 June 19
Wow, that's fantastic, so direct load is working on 464 after all!  :D
About the "clear input" problem you mentioned, try it to replace it with: CALL &BB03 ,this is the reset keyboard routine that also flushes keybaord buffer (maybe i'll include it in the assembly program so there will be no need for this in BASIC program at all).
About rtype 128, i checked it, and it seems that the 3" version (which contains two dsk images of 180k) contains some tracks with 10sectors which is why you get the "non amsdos" error (normal tracks have 9 sectors).
 BUT, i've already developed a  more versatile version of dsk2disk, which supports many non standard images with variable sectors/track, variable gap#3 length, variable sector sizes, and even more than 40 tracks!. With that, you will be able to write almost all dsk images, except some copy protected games with strange "weak sectors" locks, but fortunately i think all of these games can be found in unprotected dsk versions too! ;) (btw i've just used this new version to transfer the rtype 128 to a 3.5" disk and worked perfect!  ;D )

I'm also in a process of completely redesigning the Wifi functionality in order to avoid the need of giving AT commands all the time, and instead, have a direct WiFi communication like in serial/bluetooth mode (passthrough mode/transparent transmission). Unfortunately this requires a completely different connection model ,where TCP server will be on the PC and wifi module will be connected to it (the opposite of how is currently working), so it might need some time to finish it.

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 260Z on 02:42, 22 June 19
......
 BUT, i've already developed a  more versatile version of dsk2disk, which supports many non standard images with variable sectors/track, variable gap#3 length, variable sector sizes, and even more than 40 tracks!. With that, you will be able to write almost all dsk images, except some copy protected games with strange "weak sectors" locks, but fortunately i think all of these games can be found in unprotected dsk versions too! ;) (btw i've just used this new version to transfer the rtype 128 to a 3.5" disk and worked perfect!  ;D )
....


You're a bloody legend mate....  ;D


Just having my morning coffee, thinking about what I'll be doing with my day..... Giving this a test run is number one on my list now  :D

Edit : I see the new version isn't uploaded yet, all good :)

Cheers,
Rob
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: chrisgreen on 13:15, 29 June 19
Just a quick note to say thanks to @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) - got my serial interfaces today - extremely happy with them.
Looking forward to having a good play with them over the weekend and getting my machines talking to each other, as well as to my PC.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 17:18, 03 July 19
Anybody tried any UART modules with USIFAC by now, such as Catalex MP3 player, or FM Radio module, or MIDI UART board?
I had ordered 2 FM modules a while ago but there are still on the ship from China.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:47, 04 July 19
Finally, a new MAJOR update is available:

- Complete redesign of the WiFi functionality! Now PC program runs the TCP server,enabling a direct passthrough communication which makes Wifi usage much more stable and easy to implement.
- ALL functions (except direct load) can now be used with WiFi modules too! (previous version didn't support dsk image transfer with wifi modules and CPC to PC file transfer was a bit buggy too)
- Image transfer utility now supports many "non standard" images, with variable sectors/tracks, variable gap#3 length, variable sector sizes!
- Add a new small program (setservr) for easily configure WiFi module to act as TCP server, for creating Amstrad CPC WAN/LAN networks!
- Added ~20 new games (115 games in total), in the certified "direct load (https://www.dropbox.com/sh/hzp3a4b7fktcn8c/AAAj2U8otKw26j-chnd8uUxla?dl=0)" game list.
- Update of the user's manual, add much more detail infomration on configure and  usage of WiFi modules!

You can find all updates here (https://www.dropbox.com/s/0z2cpcbxvl95s9v/Amstrad%20CPC%20serial%20interface.zip?dl=0) (or in the same link on the first page)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: 260Z on 03:49, 05 July 19
Great work!!. You've made my year.... Finally, I can run the Batman Demo on my 464  :D


The demo also works flawlessly, on floppy disc, from beginning to end. Very pleased.
EDIT : Excluding that final clown image, that upsets my vga converter.


Keep up the good work  :D


Cheers,
Rob
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Fabrizio Radica on 15:22, 05 July 19
Anybody tried any UART modules with USIFAC by now, such as Catalex MP3 player, or FM Radio module, or MIDI UART board?
I had ordered 2 FM modules a while ago but there are still on the ship from China.
mmh... i'm really interested in MIDI UART Board...
post news when you had received (and use) it :)

I've USIfAC but i don't know how use it pratically.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 19:27, 05 July 19
mmh... i'm really interested in MIDI UART Board...
post news when you had received (and use) it :)

I've USIfAC but i don't know how use it pratically.

I think this (https://www.dropbox.com/s/xg85264klwixksr/Amstrad%20CPC%20Serial%20Interface%20User%20Guide.pdf?dl=0) might help!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 19:51, 05 July 19
I think this (https://www.dropbox.com/s/xg85264klwixksr/Amstrad%20CPC%20Serial%20Interface%20User%20Guide.pdf?dl=0) might help!  ;)


@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) unless you add the MIDI BAUD rate 31250 to the firmware, it won't do MIDI.
I just figured that out with LambdaSpeak 3 Serial Interface - had to change the firmware to support 31250 for that. 
I guess the PIC can do 31250?


THat might be helpful to figure out the settings for UART config registers:
http://www.barrysoft.it/blog/midi-with-pic-ausart.html (http://www.barrysoft.it/blog/midi-with-pic-ausart.html)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 19:55, 05 July 19

@ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541) unless you add the MIDI BAUD rate 31250 to the firmware, it won't do MIDI.
I just figured that out with LambdaSpeak 3 Serial Interface - had to change the firmware to support 31250 for that. 
I guess the PIC can do 31250?

Never tried that specific baud rate, but most probable it can. It's very easy to add this speed to the code and selecting it ,by a simple, let's say: OUT &FBD1,20
Of course, you will need to reflash the pic with the new program.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 19:58, 05 July 19
Never tried that specific baud rate, but most probable it can. It's very easy to add this speed to the code and selecting it ,by a simple, let's say: OUT &FBD1,20
Of course, you will need to reflash the pic with the new program.


That means the MIDI BAUD rate is already supported by USIFAC? Then it should work out of the box!

EDIT: oh, OK, I need to reflash it... I see.

I guess I was suggesting for you to change the firmware such that customers can use MIDI BAUD rate out of the box.  ;)  Just an idea, you are welcome  ;D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:03, 05 July 19

That means the MIDI BAUD rate is already supported by USIFAC? Then it should work out of the box!


EDIT: oh, OK, I need to reflash it... I see.


I guess I was suggesting for you to change the firmware such that customers can use MIDI BAUD rate out of the box.  ;)
Of course i can (i have already 10 different speeds supported, where you can select them "on the fly" by giving simple OUT &FBD1,x commands), but for all of you who have already a usifac, you will need to re-program the pic (or send you another PIC with the new program  ::) )
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 20:04, 05 July 19
Of course i can (i have already 10 different speeds supported, where you can select them "on the fly" by giving simple OUT &FBD1,x commands), but for all of you who have already a usifac, you will need to re-program the pic (or send you another PIC with the new program  ::) )


I understand that. I was just bringing to your attention that you need the baud rate 31250 for MIDI to work; I saw in the  USIFAC manual and  menus that it is not there yet. I didn't know that until I tried that with LS 3 serial interface, so I wanted to share that information with you such that you can provide a more useful product to customers.


AGain, you are welcome!


No need for a new PIC for my 2, I can do it myself. Thanks for offering to send new PICs.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:36, 05 July 19
Done! The speed of 31250 can be selected by giving a simple OUT &FBD1,20
You want me to send you the new hex and give it a try?  ;D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 20:45, 05 July 19
Done! The speed of 31250 can be selected by giving a simple OUT &FBD1,20
You want me to send you the new hex and give it a try?  ;D


Sure! Thank you, super fast service!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 20:57, 05 July 19

Sure! Thank you, super fast service!

Here (https://www.dropbox.com/s/ui9xyd80s8mr4w5/pic16f1579.hex?dl=0) it is.
From now on, i will flash all new boards with this version,  and i'll upload the hex file to the "official" link too!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 21:05, 05 July 19
Btw, anyone with another "special speed" request? I can add as many custom speeds as you like!  :)

Btw,i just noticed that 31250 is a speed that uart interface can match EXACTLY, all other speeds are having some small errors (usually less than 1%)in actual speed, maybe that's why it's selected for the MIDI in order to have absolute synchronization?  ::)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:30, 06 July 19
LambdaMikel,i think you will find this interested:
http://www.hobbytronics.co.uk/usb-host-midi
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 04:55, 08 July 19
Thanks for the link!
USB MIDI is cool, but most of my synths are old style and have MIDI DIN (I have a USB -> DIN MIDI converter box though).

So I like this one, which is as minimal as it gets:
https://ubld.it/products/midi-breakout-board/ (https://ubld.it/products/midi-breakout-board/Unfortunately)
Unfortunately, it is no longer available on Amazon, but you can get it here:
https://www.tindie.com/products/ubldit/midi-breakout-board/?_ga=2.246732166.343271136.1562550881-1119099813.1562130274 (https://www.tindie.com/products/ubldit/midi-breakout-board/?_ga=2.246732166.343271136.1562550881-1119099813.1562130274)

I mean, the Arduino MIDI shields also work, but they are too bulky really. 
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 23:47, 08 July 19
Btw, anyone with another "special speed" request? I can add as many custom speeds as you like!  :)


Great for future developments.  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 10:52, 09 July 19
Thanks for the link!
USB MIDI is cool, but most of my synths are old style and have MIDI DIN (I have a USB -> DIN MIDI converter box though).
So I like this one, which is as minimal as it gets:
https://ubld.it/products/midi-breakout-board/ (https://ubld.it/products/midi-breakout-board/Unfortunately)
Unfortunately, it is no longer available on Amazon, but you can get it here:
https://www.tindie.com/products/ubldit/midi-breakout-board/?_ga=2.246732166.343271136.1562550881-1119099813.1562130274 (https://www.tindie.com/products/ubldit/midi-breakout-board/?_ga=2.246732166.343271136.1562550881-1119099813.1562130274)
I mean, the Arduino MIDI shields also work, but they are too bulky really.

That's very nice! So,by getting this MIdi adapter and connect it to usifac, you will be able to use amstrad with a synthesizer, right?
 Of course you will need some software too for this,in the end everything goes down to send and receive bytes, which can be very easily done (either in BASIC or assembly) with simple inp and out commands, you think you will be able to develop the program for this?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 18:31, 10 July 19
That's exactly right, @ikonsgr (http://www.cpcwiki.eu/forum/index.php?action=profile;u=541)
But I am afraid I'll try it on LambdaSpeak 3 Serial Interface first; when that works well, I'll port the MIDI CPC software to USIfAC, but that is the plan, yes!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 18:58, 13 July 19
Now, Enough of the utilities!   :)

I've just upload a variant of  the classic pong game (along with ~dozen of more games, tested with direct load, 130+ games in total), which utilizes the serial interface!
I've named it "pong-lan" and it's a 2 player game, only that... each player is playing in its own amstrad cpc!
It's a simple basic game which you can find here (https://www.dropbox.com/sh/rdn25eso1inx6i5/AAA1rTMtlXnvTtVuYj5KrDcaa?dl=0), you can run/load it directly using the direct load function. Note that using Wifi modules, it's possible to play it through internet, and with a couple of modifications i even tried it  with... an "old friend", a Commodore 64!!! (https://www.youtube.com/watch?v=l9rWsShqKsE)   :o
Maybe the first network inter-8bit-computer game???  :D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 09:52, 14 July 19
Network PONG LAN PARTY??? Yeah  8)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: biishop on 21:21, 30 July 19
This interface is beautiful, practical, compact and do an absolutely necessary job for all old CPC enthusiasts who absolutely want to continue to use the CPC like 30 years before with original 3 inch discs.

The operation is very simple and very reliable. Replicating DSK files on physical media is pure bliss with the USIfAC.


I sincerely thank Ikonsgr for this achievement and the sharing he makes of this creation and the way to makes it accessible.

It's a MUST HAVE absolutely.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 12:03, 31 July 19
Thanks biishop, frankly, comments like yours give me the greatest joy and satisfaction for my small contribution to Amstrad CPC community!  :)
Btw, today we reached 50 boards sold (42 assembled boards and 8 DIY kits), to ~40 different people!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 15:05, 02 August 19
I've just upload the hole project to my blog (http://retroworkbench.blogspot.com/p/universal-serial-interface-for-amstrad.html) (it also contains many of my designs i made over the years, for Amstrad CPC and other home micros), so, from now on, anyone can easily have access to it!
You can also find a small presentation on youtube here (https://www.youtube.com/watch?v=oImOI_TJhDo)

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 19:36, 03 August 19
I've tested another ~20 games with direct load, we reach 150+ in total!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 20:02, 21 August 19
Here (https://www.dropbox.com/s/ui9xyd80s8mr4w5/pic16f1579.hex?dl=0) it is.
From now on, i will flash all new boards with this version,  and i'll upload the hex file to the "official" link too!  ;)

Thanks for the firmware update! I just reprogrammed my USIfACs with this new firmware. So this should have the 31.250 BAUDs required for MIDI, right?

Finally found the time to do something with USIfAC and successfully transmitted 2 games.  Using a standard USB FTDI cable - it works great!


Now, I am in a position to start working on the MIDI IN experiment. I have the MIDI IN code working with LambdaSpeak 3 Serial Interface (see Polyphonous MIDI IN CPC Synthesizer Video there), and will try to get that code running with USIfAC.


The only concern I have is that the USB port is actually (attempting to) powering the whole CPC... so I need to make sure to first turn on the CPC before plugging in the FTDI USB cable. Of course the USB cannot provide enough power, but it is enough for the Power LED to go on and the CPC trying to boot... 
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 08:24, 22 August 19
Coming soon...
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 08:29, 22 August 19
https://youtu.be/960FIh6B_3g
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 15:34, 23 August 19
So it seems that USIfAC  really works as MIDI "bridge" between a synthesizer and an Amstrad CPC! 
As far as i know, this must be the first  application of the Usifac,apart from the utilites i have made!
And LambdaMikel,i suppose it wasn't hard to make it work with USIfAC right? ;)

Btw, i wonder ,what would be the practical usage of such "marriage"? Writing music using a keyboard synthsizer that could be saved in amstrad and then maybe replayed?



The only concern I have is that the USB port is actually (attempting to) powering the whole CPC... so I need to make sure to first turn on the CPC before plugging in the FTDI USB cable. Of course the USB cannot provide enough power, but it is enough for the Power LED to go on and the CPC trying to boot... 


  Hmmm, maybe if you don't use the 5v pin from Usifac ,the problem will be solved (this is how a usb2serial cable adpater works too,there is no need to connect the 5v pin,i note this in manual too). Unless the small board with the midi connector needs to power from serial interface
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 17:14, 23 August 19
So it seems that USIfAC  really works as MIDI "bridge" between a synthesizer and an Amstrad CPC! 
As far as i know, this must be the first  application of the Usifac,apart from the utilites i have made!
And LambdaMikel,i suppose it wasn't hard to make it work with USIfAC right? ;)

Btw, i wonder ,what would be the practical usage of such "marriage"? Writing music using a keyboard synthsizer that could be saved in amstrad and then maybe replayed?

  Hmmm, maybe if you don't use the 5v pin from Usifac ,the problem will be solved (this is how a usb2serial cable adpater works too,there is no need to connect the 5v pin,i note this in manual too). Unless the small board with the midi connector needs to power from serial interface
Yes, it was very easy to use and "program" USIfAC, thanks tou your excellent manual!
Understanding the MIDI protocol good enough was the most challenging part, but I had already gone through this with the previous version of this project.

Right, the "power problem" does not appear with the MIDI board, only with the USB cable connection to the PC. Providing VCC from another source or may only connecting GND might solve the problem. Will try. It is not a big problem anyhow, just something to remember - turn on the CPC first, then plug in the USB FTDI cable.

Well, "practical and 8bit computers" is a bit of an oxymoron these days anyhown IMHO  ;) , but yes, it could go into that direction. How about adding a CPC to your rack of MIDI synthesizers - imagine something like this + a CPC  :D
https://upload.wikimedia.org/wikipedia/commons/0/0a/Synth_rack_%40_Choking_Sun_Studio.jpg (https://upload.wikimedia.org/wikipedia/commons/0/0a/Synth_rack_%40_Choking_Sun_Studio.jpg)
I mean, there are people using the C64 + DualSid etc. with MIDI IN as a synthesizer... why not do the same with a CPC and maybe PlayCity and LS3. Obviously, a capable MIDI CPC Synthesizer program needs to be written or adapted first. Maybe I'll work a bit on this by extending what I already have.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 17:31, 23 August 19
Well, I'm not a musician, but just imaging to use a keyboard to play on PSG + LambdaSpeak III + PlayCity - just awesome, endless possibilities.  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 22:20, 31 August 19
A few more direct load games added, and reduce price for assembled board to... 8euros
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 12:29, 18 October 19
I think I may have fried my card, but I'm not sure.
As I always do, I plugged everything without reading the manual (because I think I'm sooooo clever), and plugged the 4 pins of the USB adapter, INCLUDING the +5V, which, I learned later, must NOT be plugged.

I first started playing with hardware in Basic, reading the control port and receiving only 255, meaning that a byte was available (and the byte is always 255).
Then I read the manual, disconnected the +5V, but the result was the same.

The reset and pause buttons work fine, so I guess the hardware is not so fried??

Also, Windows 10 recognize the COM port, but names it "PL2303HXA PHASED OUT SINCE 2012, PLEASE CONTACT YOUR SUPPLIER."!
The COM port is in the dropdown box of the Windows software provided with the USIfAC, but when clicking on "connect", a pop-up shown with the message "Serial interface exception".

Am I doomed to order a new hardware?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 12:41, 18 October 19
OK, false alarm!! It **kindof works**.

I switched to another USB port, and it worked right away, W10 detected a "Prolific USB-to-Serial Comm port" and it worked great!
But then, I unplugged the USB port, plugged it on another USB port, and now the driver is always "PL2303HXA PHASED OUT SINCE 2012. PLEASE CONTACT YOU SUPPLIER.", even when I switch to the USB port that was working previously.

I'll try to find a driver somewhere... unless someone here has a solution.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 13:00, 18 October 19
So, the interface seems to work very fine, but I have this driver problem, I have to disable the "PL2303HXA PHASED OUT SINCE 2012, PLEASE CONTACT YOUR SUPPLIER." driver, then enable it again, and *sometimes* if it well recognized as "Prolific USB-to-Serial Comm port".

I made a search and downloaded drivers from here (http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41), but it doesn't change anything. Anyone with the same problem as I?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 13:12, 18 October 19
Ok, it seems to work not so bad. I did exactly what was shown here (https://www.youtube.com/watch?v=aWquKi_e-3A). It works, but when unplugging/plugging, W10 sometimes chooses the wrong driver and I have to go back to Device > Properties and select the right one by myself, like explained in the video. A bit of a pain!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Bryce on 13:24, 18 October 19
Have you tried de-installing the incorrect driver completely and removing it from the registry?

Bryce.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 18:03, 18 October 19
I tried, without real success yet. But there's probably no need because, as always, everything is perfect on Linux :).
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 19:00, 18 October 19
With W10, it really depends on the quality of the FTDI cable... super cheap is usually crap. I have three or four of these, and only two of them really work reliably. The good ones need no driver at all - or for whatever reason, my Windows already knew them   ;D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: pelrun on 03:35, 20 October 19
PL2303 cables work perfectly under W10, but you have to use the driver from 2008. All the later driver versions deliberately broke things  :picard2:
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: HAL 6128 on 10:51, 20 October 19
With W10, it really depends on the quality of the FTDI cable... super cheap is usually crap. I have three or four of these, and only two of them really work reliably. The good ones need no driver at all - or for whatever reason, my Windows already knew them   ;D
...yeah, I had the same experiences...
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 14:44, 20 October 19
The Windows driver now seems recognized well every time. Everything is working very fine. Great interface!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: TotO on 18:46, 05 November 19
Are the ports ($FBDx) compatible with the Amstrad Serial Interface?
No. Sorry.  ;D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: SkulleateR on 02:01, 27 December 19
Anybody tried any UART modules with USIFAC by now, such as Catalex MP3 player, or FM Radio module, or MIDI UART board?
I had ordered 2 FM modules a while ago but there are still on the ship from China.


I just tried to connect the Mini DFPlayer (MP3) to the USIfaC but I'm not quite sure which commands to send to get it played ...  ???
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 21:05, 27 December 19
As far as USIfAC is concerned, you can read the manual. In 2 words, it's reather easy and straight forward to send a byte by just giving: OUT &fbd0,X (X:0-255)
To get a byte, give: 
if INP(&FBD1)=255 then a=INP(&FBD0)
Now variable a has the received byte.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: SkulleateR on 21:13, 27 December 19
As far as USIfAC is concerned, you can read the manual. In 2 words, it's reather easy and straight forward to send a byte by just giving: OUT &fbd0,X (X:0-255)
To get a byte, give: 
if INP(&FBD1)=255 then a=INP(&FBD0)
Now variable a has the received byte.
Yes, I´m aware of that  ;)


Problem is, that the DFPlayer needs to get some initial routine on UART to get a mp3 played, and I don't seem to get that right  :-[
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: LambdaMikel on 17:33, 28 December 19
Have a look at the


https://github.com/lambdamikel/LambdaSpeak3/blob/master/cpc/lambda/LS300.dsk (https://github.com/lambdamikel/LambdaSpeak3/blob/master/cpc/lambda/LS300.dsk)

MP3 basic demo program.

Of course, this doesn't work with USIfAC serial interface (it was written for LambdaSpeak 3), but you can see what bytes to send over the serial port in order to control the MP3 module.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: SkulleateR on 16:07, 29 December 19
Thx  8)  Will give it a try
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: secmast on 15:24, 03 January 20
I have bought a RS232 to TTL Serial Port Converter Module DB9 Connector MAX3232 Serial Module.
Can I power this device from the USIfAC directly or should I power it from an external power supply ?
In the case of external power supply is the ground should be "comon" ????


Thanks
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 11:49, 04 January 20
Any device connected to Usifac that needs 5v power supply, can be powered using the '+' pin of the 4pin uart port. This actually uses amstrad's 5v supply.
BUT, when you use a direct usb2serial adapter (which takes power from usb port), you must NOT connect 5v supply pin, ONLY tx,rx and ground is needed.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: secmast on 12:17, 04 January 20
Ok thanks

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: secmast on 11:40, 16 January 20
Hi,


I've done a small RS232 terminal program in assembly supporting extended ASCII characters in Latin-1252.
This is very simple to use it, launch the program, choose the desire speed and you ready to go.
There is no Log/Buffer in place yet, but at least you can connect to any RS232 device up to 115200bps.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: TotO on 10:23, 26 February 20
The best standard serial communication interface for CPC !  8)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 18:32, 18 April 20
[UPDATE]
- Bug fix: Amstrad resetting when trying to copy ASCII files from CPC to PC.
- Add Star Sabre (https://www.youtube.com/watch?v=ymj19YHyC-A) to "direct load" (https://www.dropbox.com/sh/hzp3a4b7fktcn8c/AAAj2U8otKw26j-chnd8uUxla?dl=0) game list. This is one of the best horizontal scrolling shootem up games, so i thought it desreved a special notice  :)

 You can downalod and try the new version from the usual place (https://www.dropbox.com/s/0z2cpcbxvl95s9v/Amstrad%20CPC%20serial%20interface.zip?dl=0)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 23:24, 26 May 20
Hi

I just received my USIfAC and (thanks ikonsgr!) - trying to run the terminal.bas program on my 464 to do some experimenting, but I'm running into a problem as its failing on line 500 with the 'CLEAR INPUT' command - I have tried the program on Winape emulating a 6128 and it seems to work fine. I'm guessing this is a command from BASIC 1.1??? Is there something I can change it to to get it to work or another fix?
Cheers!Nic
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: pelrun on 05:09, 27 May 20
According to https://www.sean.co.uk/books/amstrad/amstrad2.shtm#CLEARINPUT (https://www.sean.co.uk/books/amstrad/amstrad2.shtm#CLEARINPUT) you can try CALL &BB03 in it's place.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 08:59, 27 May 20
Thanks pelrun that’s a really handy link, I’ll give that a go  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 11:19, 27 May 20
Hi,


I've done a small RS232 terminal program in assembly supporting extended ASCII characters in Latin-1252.
This is very simple to use it, launch the program, choose the desire speed and you ready to go.
There is no Log/Buffer in place yet, but at least you can connect to any RS232 device up to 115200bps.
secmast your terminal program is brilliant, it worked perfectly to communicate with minicom on linux!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 12:16, 09 June 20
Is there any software available that will allow me to connect using the USIfAC + ESP01 to a telnet BBS? Or a combination of utilities? Not sure what the best compatible VT100 terminal would be to run on 464 either?
Cheers!Nic
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 18:35, 18 June 20
Hi


So I found the 'ewen-term' program hosted on the CPCWiki software page with source code, and have managed to (eventually) modify it to work with the USIfAC! I had to figure out how to build it but turns out that it needs MAXAM 1.5 and Protext which I installed as ROMs on WinApe - I really need to get my M4 card to be able to use the ROMs on the CPC and do my development on there but there is a long waiting list.


I presume ewen-term it was originally written for the Pace interface? It'll now connect to a linux box and work as a terminal emulator. I also had to add some code to handle the cursor keys correctly but seems to be working ok now. I can even use telnet on the linux box to connect to a BBS on the old 464.


I think the next thing to do on the project will be to make it so that the terminal software can use a combo of the USIfAC and an esp8266 to connect directly to a BBS.







Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 19:08, 18 June 20
Nice!  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 00:43, 22 June 20
I think the next thing to do on the project will be to make it so that the terminal software can use a combo of the USIfAC and an esp8266 to connect directly to a BBS.

Esp8266 is a very powerful tool, you can do a lot of things using plain AT commands, from connecting to access points, routers or tcp servers up to create access points or tcp servers and have other Amstrads or pc's connect to! You can check usifac's user manual for more details.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: shifters74 on 11:05, 22 June 20
Hi all,
i followed this project for a BBC but can be used with any serial capable machine: https://stardot.org.uk/forums/viewtopic.php?f=3&t=15076

i modified the code and interfaced an lcd screen and a rotary encoder to allow me to set and select sites, baud rate etc etc on the device itself.

I have it working with a BBC B/Master, Amiga and Atari ST but see no reason why it will not work with other machines with a serial interface and suitable software on the host site.


I have not got around to test with the USIfAC yet but it will probably work fine (both with the unmodified code from the above link and my own custom code).


cheers
shifters
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: genesis8 on 16:52, 22 June 20
I seem to remember the question was asked for the interest of MIDI out, I am.


Is it already possible ? Or does it need hardware/software done before ?


As I have since some months ago a Roland expander SC-55st which I use either with an Amstrad PPC640 (via serial port, tested on youtube) or my current PC (via USB to midi interface), it would be nice to be able to use it with a CPC.


I know I dream too much, but a game using MIDI would have nice sound and I suppose/hope less time machine needed if it can be buffered by the interface ?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 20:51, 22 June 20
Hi all,
i followed this project for a BBC but can be used with any serial capable machine: https://stardot.org.uk/forums/viewtopic.php?f=3&t=15076 (https://stardot.org.uk/forums/viewtopic.php?f=3&t=15076)


Thanks for pointing that project out Shifters, that looks like it will make my life a lot easier as the standard AT commands on the ESP8266 are a little bit more cumbersome than that looks. I cant seem to find a way to get it into a mode that is just a simple tx/rx to the telnet server. By default you need to prefix transmissions with a header containing number of bytes to send and it likes to reply with a header displaying the number of bytes to receive, which is just not something I need for this application. I can understand for a transactional protocol like HTTP but as this is just a telnet connection this will be a much better fit.
Now to figure out how to program the think with Arduino IDE...

Cheers!

Nic
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 21:26, 22 June 20
I seem to remember the question was asked for the interest of MIDI out, I am.


Is it already possible ? Or does it need hardware/software done before ?
Both done. MIDI out and in with USIfAC.

 https://www.youtube.com/results?search_query=usifac+midi

https://youtu.be/960FIh6B_3g

https://youtu.be/MVEXi7fGHyc?list=TLPQMjIwNjIwMjA9NKLRSPF-uA



Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 21:33, 22 June 20
ESP8266
Honestly, if you have / add an ESP 8266 to the mix, then there is no need for USIfAC any more... the ESP8266 can do all of this on its own. The USIfAC PIC is more of a burden than a help to the ESP  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 23:07, 22 June 20
Honestly, if you have / add an ESP 8266 to the mix, then there is no need for USIfAC any more... the ESP8266 can do all of this on its own. The USIfAC PIC is more of a burden than a help to the ESP  ;)

That is interesting! Do you know where i can find an example of how to hook up an ESP8266 directly to the CPC? I guess I'd need to learn how the IN/OUT addressing works on the CPC bus and also have some custom firmware on the 8266 for it to work. The ESP8266s I have are tiny things on a board with 4 pins exposed as VCC/GND/TC/RX but I do have a couple of ESP32 breakout boards which might be better for that.

Cheers!

Nic
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 23:18, 22 June 20
The ESP8266s I have are tiny things on a board with 4 pins exposed as VCC/GND/TC/RX but I do have a couple of ESP32 breakout boards which might be better for that.
Sorry I meant the bigger brother, the ESP32. Indeed, just a ESP8266 will not have enough GPIO to do address decoding.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 11:05, 23 June 20
Thanks for pointing that project out Shifters, that looks like it will make my life a lot easier as the standard AT commands on the ESP8266 are a little bit more cumbersome than that looks. I cant seem to find a way to get it into a mode that is just a simple tx/rx to the telnet server. By default you need to prefix transmissions with a header containing number of bytes to send and it likes to reply with a header displaying the number of bytes to receive, which is just not something I need for this application. I can understand for a transactional protocol like HTTP but as this is just a telnet connection this will be a much better fit.
Now to figure out how to program the think with Arduino IDE...
Cheers!
Nic
I had exactly the same problem when i first involved with esp8266, it seems there was a need to encapsulate each data packet in order to send and "peel off" the encapsulation to get data.  But after a bit of study, it seems there is a way you can send/receive bytes directly without needing "encapsualtion" (quoting from Usifac manual):
AT+CIPMODE= 0 or 1 Sets Transmission Mode
0: normal transmission mode (must be used when WiFi acts as a TCP server)
1: UART-Wi-Fi passthrough mode (transparent transmission), this mode is used for communication with the PC utility program. It can only be enabled in TCP
single connection mode Notes:
• The configuration changes will NOT be saved in flash.
• During the UART-Wi-Fi passthrough transmission, if the TCP connection breaks, ESP8266 will keep trying to reconnect until “+++” is input to exit the transmission. If it is a normal TCP transmission and the TCP connection breaks, ESP8266 will give a prompt and will not attempt to reconnect.
AT+CIPSEND Start sending data in transparent transmission mode.
Data must be sent with a 20-ms interval between each packet, and a maximum of
2048 bytes per packet.
To disable transparent transmission mode, a single packet containing „+++‟ must be received, (in practice, you must give: out &fbd0,43:out &fbd0,43:out &fbd0,43) ESP8266 returns to normal AT command mode.Wait for at least one second before sending the next AT command.
This command can only be used in transparent transmission mode which requires single
connection. Note also that, you CANT give AT commands when transparent transmission mode is activated.


For more details you can look at the complete esp8266 manual (https://www.dropbox.com/s/wetg5asxy6nynst/4a-esp8266_at_instruction_set_en.pdf?dl=0)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 11:11, 23 June 20
Honestly, if you have / add an ESP 8266 to the mix, then there is no need for USIfAC any more... the ESP8266 can do all of this on its own. The USIfAC PIC is more of a burden than a help to the ESP  ;)

Well, what about this then: https://www.dropbox.com/s/jaxq36tblkrnavz/DSCN1284.AVI?dl=0
Load ~70kb game in 3.7seconds e.g. ~20kb/sec transfer rate :o  (and NO, it's not loading  from EEPROM  ;D )
A small teaser of the new Usifac i'm working on....  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: nicf82 on 13:07, 23 June 20
I had exactly the same problem when i first involved with esp8266, it seems there was a need to encapsulate each data packet in order to send and "peel off" the encapsulation to get data.  But after a bit of study, it seems there is a way you can send/receive bytes directly without needing "encapsualtion" (quoting from Usifac manual):
Thanks for that ikonsgr, thats really very helpful. Also the link to the proper docs will help!

Cheers
Nic
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 03:09, 24 June 20
Load ~70kb game in 3.7seconds e.g. ~20kb/sec transfer rate :o
Turbo!  8)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 16:37, 27 July 20
And another small "teaser" (https://www.dropbox.com/s/y950cxqtjxiwyjd/usb_demo.AVI?dl=0) of the the upcoming USIfAC II!
I've developed extra code to utilize this very cheap Usb storage device host module (https://www.ebay.ie/itm/1PCS-U-Disk-Read-Write-Module-ICSJ021A-Supply-SPI-host-interface-6MHz-CH376S/191765663573?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649), and now, you can load programs and games from usb sticks too! And as you can see in the video, still with SUPER fast speeds!  :D ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 17:22, 27 July 20
Great! Is there such a ROM for the regular USIfAC?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 17:45, 27 July 20
Unfortunately there is not. You see, the new USIfAC II, is actually a "from the scratch" project, based on a much more adavanced (but still 8bit) 18F47Q10 PIC MCU, (https://www.microchip.com/wwwproducts/en/PIC18F47Q10) although the schematic of the board is simpler than the previous:
 

* usifacii.jpg
(275.64 kB, 1330x1051 - viewed 264 times)


As you can see, there is only a  (much larger) 40pin Chip, which provides access to  full 16bit address bus and other CPU signals too. Also, this PIC is equipped with 8 Configurable Logic Cells, small  programmable logic modules which can be very useful in address and signal decoding, so no need for extra logic chips!  ;)
I don't want to... "spoil the surprise" but the new USIfAC II will provide so much more functionality that maybe the name can't reveal:
-Dozens new RSX commands (yes, EVERYTHING is now executed directly, no need to write any code for direct function any more,also all previous functions for file rtansfer, format, dsk image copy and many more are converted to RSX commands executed directly from basic prompt...  :) ),
- Full  ROM and 765 FDC emulation,
- 1kb eeprom for saving  your own code,
- A new "direct function" that practically converts the HDD of your PC to an Amstrad HDD, providing a small group of RSX commands for changing directories, catalogue dirs, load/run/save programs/games (at incredible speeds of ~18-20kb/sec e.g. 4-5times of actual disk drive/gotek drive speed),even delete files, directly from Amstrad!
- Full read/write access to dsk images that can be also selected directly from amstrad!  ;)
And ,finally, there will be a special "mode", which practically converts a CPC 464 to a "CPC 664", providing full Amsdos & 765FDC emulation simultaneously, thus giving the 464 full access to any dsk image (apart from the super fast direct file loading of course)!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 18:26, 27 July 20
Impressive!

Especially if the DSK and 765 FDC emulation works out perfectly. Gotek and HxC feel a bit slow and dated these days on the CPC.And M4 has many issues with DSK images since it does not emulate the FDC on a low-level AFAIK (but goes over firmware functions). I must say I don't care much for "serial DSK loading over Serial / Wifi" loading, or having your PC act as a file server or that stuff, I just prefer to have all the DSK images on a USB drive.

Great job! There may be a market for that device, even if most folks will already have a Gotek / HxC / M4 / Dandinator...
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 19:18, 27 July 20
Impressive!
Especially if the DSK and 765 FDC emulation works out perfectly.
Well, from the numerous tests i have made so far, it seems that it can read data format and system format images, with more than 9 sectors/track or more/less than 512bytes per sector. The emulation is done in low level, of getting and responding directly to 765 FDC commands through the controller's I/O ports, so amstrad "thinks" it communicates with a dsik drive!  ;)  Also, i've included more advanced dual head image support and multi sector reads, which are supported with parados. I've tested them using  400kb and 800kb parados images and seem to work ok (both read and write). The only images i couldn't load so far, was the "sinlge disk" dual side/80tracks Batman forever demo & orionprime images (they give an incompatible system error or something), and a couple of game images with weird copy protections, but fortunately you can find everything in "cracked" or normal 180kb dsk image versions, so this really wouldn't be a problem.
For the moment, this advance FDC emulation is only available for direct connection to PC (although i intend to make it work with Wifi modules too, so no need to have a pc or laptop near amstrad  ;) ), and i may expanded to work with the usb storage device host module too (although it will probably support only usual 180kb dsk images)

Quote
Gotek and HxC feel a bit slow and dated these days on the CPC.
Tell me about it. After months of testing and loading 100's of games,i've been "Addicted" to the super fast loading of ~20kb/sec ,so now, even the turbo track loaders of some games (that can ~double the speed of a disk/gotek drive from 4-5kb/sec to ~8-9kb/sec) seem veeeeery slow!  :)  It's really an amazing thing to have a full 42kb game load on a CPC 464 in a couple of seconds!  :P  I guess this kind of speed can only be beatten by a Rom board  :D
 Of course the super fast speed is acheived only with direct loading of files and not through FDC emulation (meaning you need to have the actaul game files expanded from  dsk containers, fortunately there is a batch function  inside CPCLOAD  utility which can do exactly that, expanding 1000's of games in separate folders in less than a minute ;)  ), which practically, is a bit faster than an actual disk drive on CPC 6128 and slower on a CPC 464 (obviously because with a cpc464 the MCU must emulate both Amsdos and FDC controller at the same time!). :D

Quote
There may be a market for that device, even if most folks will already have a Gotek / HxC / M4 / Dandinator...
  Well, i'm afraid that (and despite that USIfAC II would be MUCH cheaper than the M4 board, selling price will  be ~15euros+shipping), Duke has already "catch" almost all the... "available market" , so, i don't expect much... "commercial success"!  ::) 
BUT,  as i've already noted about the previous USIfAC in the past (and despite the fact that i literrally spent 1000's of hours for more than a year developing this board), i made this  project MOSTLY as a hobby, a fun of making something creative & useful for the community, so i really don't care about "commercial success"  :D  (although i confess i wished USIfAC to be a bit more succesfull, just for giving a motive to the software community, to develop new LAN/WAN games for amstrad... ;) )
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: VintageAdvantage on 19:30, 27 July 20
This is great! Of course, "commercial success" is almost impossible with CPC projects. That's not why we are doing it for. But, even it is not a "commercial success", it is nice to at least have some recognition and users. After all, it's a labor of love and it hurts if, after hundreds of hours of work and love put into such projects, if a project is being ignored by the community for reasons such as "not inventend {here, in <country xyz>, by <scene member xzy>}" or the like.

I'll buy one for sure! Hope others will too. Great job!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Skunkfish on 23:08, 27 July 20
USIfAC 2 sounds very interesting, at that price I'll definitely be grabbing one when it's released.
I take a look at the first USIfAC in the new issue of my fanzine, I had no idea that a follow-up was in the works!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Liartes on 10:51, 28 July 20
Really interesting project, I have not much usage for serial/networking (yet) and prefer USB solution. Loading games from expansion slot would be less messy than using an external gotek.
Count me in for the release batch !
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 14:55, 28 July 20
WoW! Very impressive!!!


As far as I understand (at lunch break now) it can emulate the FDC 765. That would be something awesome! Especially if there could be a version with different I/O addresses. This way the Vortex FDC765 could be emulated.


Would it be possible to emualate the FDC765 using the I/O addressed from the Vortex disc-interface?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 10:51, 29 July 20
Does Vortex use the same 765 floppy Controller? And what port is using?
The emulation was based on this (http://cpctech.cpc-live.com/docs/upd765a/necfdc.htm) document, and it was REALLY hard and time consuming to make it work even in the first place! The "problem" is that 765 FDC does not simply  receive a command byte sequence and gives an "answer", but CONSTANTLY writes to two differents ports (main status register port AND  data register port) for EVERY SINGLE byte that it receives!  And in all this complicated "dicussion" the mcu (which emulates FDC) must give the expected  responces to amstrad for EACH and EVERY different situation! Even one wrong responce byte and everything is crashed!  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 11:19, 29 July 20
Tell me about it. After months of testing and loading 100's of games,i've been "Addicted" to the super fast loading of ~20kb/sec ,so now, even the turbo track loaders of some games (that can ~double the speed of a disk/gotek drive from 4-5kb/sec to ~8-9kb/sec) seem veeeeery slow!  :)  It's really an amazing thing to have a full 42kb game load on a CPC 464 in a couple of seconds!  :P  I guess this kind of speed can only be beatten by a Rom board  :D
And by FutureOS which transfers 20KB/second (in real live). For example read an complete 180 KB Data disc in 9 seconds.  :)

...(although i confess i wished USIfAC to be a bit more succesfull, just for giving a motive to the software community, to develop new LAN/WAN games for amstrad... ;)  )
Regarding available hardware: The USIfAC is at present day the best (and maybe only) solution for serial communication. How much have been sold? I took some by myself and they are awesome!

Of course I'm also very interested in the USIfAC II - especially for this awesome cheap price. It may be even better of make a CPC network (I started doing that with the USIfAC first, but then I hat too much to do at work - now I got more time again). Awesome to see such a big jump in evolution from U1 to U2 :-)

Does Vortex use the same 765 floppy Controller? And what port is using?
The emulation was based on this document, and it was REALLY hard and time consuming to make it work even in the first place! The "problem" is that 765 FDC does not simply  receive a command byte sequence and gives an "answer", but CONSTANTLY writes to two differents ports (main status register port AND  data register port) for EVERY SINGLE byte that it receives!  And in all this complicated "dicussion" the mcu (which emulates FDC) must give the expected  responces to amstrad for EACH and EVERY different situation! Even one wrong responce byte and everything is crashed!  :)
Thank for responding!  :) :) :)  I'm very well aware of FDC programming. So now to the great thing about the Vortex controller. Everything is the same like with the CPCs FDC765, the only differences are the addresses and the fact that the Vortex FDC765 can physically connect four drives - and that's awesome, that way one can use 3", 3.5" and 5,25" at the same time.

Now the FDC status for Amstrad is &FB7E, and for Vortex it is &FBF6
The FDC data port for Amstrad is &FB7F, and for Vortex it is &FBF7

If the USIfAC II would be able to "switch" these I/O addresses or maybe support both sets / both FDCs - that would be great.

The great thing is also that we have the VDOS ROM the use the additional FDC from Vortex, and it's also supported by FutureOS. There is even CP/M for it.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 11:25, 29 July 20
And by FutureOS which transfers 20KB/second (in real live). For example read an complete 180 KB Data disc in 9 seconds.  :)

I don't think i get this. Future os is software not hardware, and also,i suppose you mean transfer from somewhere else than a real floppy disk ,because transfer data from a real disk can be maximum ~8-9kb/sec (and this ONLY with custom fast track loaders, usally speed is ~half of that).

Regarding available hardware: The USIfAC is at present day the best (and maybe only) solution for serial communication. How much have been sold? I took some by myself and they are awesome!

 So far (that is, for the last ~1,5years USIfAC is available), i've sold ~120 ready boards and ~dozen as DIY. Duke i think mentioned some time ago that M4 board had  ~800 boards sold, so i suppose now it  must exceed 1000+, which, for the size of active amstrad community, is almost.... "a M4 for every Amstrad user"   :laugh:
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 11:39, 29 July 20
I don't think i get this. Future os is software not hardware, and also,i suppose you mean transfer from somewhere else than a real floppy disk ,because transfer data from a real disk can be maximum ~8-9kb/sec (and this ONLY with custom fast track loaders, usally speed is ~half of that).
Yes, FutureOS is software. It's aim was (and is) to get the maximum power out of the CPC. To test this do the following: Connect two drives to your CPC (f.e. two 3" drives or 3,5" or 5,25") and then put in two data formatted discs (or system or ibm), then copy it. It does copy it in about 18 seconds.

If you copy with a single internal 3" drive it will take you about 9 seconds to read that 180 kb and also about 9 seconds to write a disc of 180 KB.

That makes 20 KB / second. The FDC can do a little more, but you need to take in account that with 512 bytes sectors there's a lot of header and gap bytes. With 1K sectors speed can be improved a bit.

And since I like perfect software I like to use the USIfAC, because it's perfect hardware.  :)



So there about 150 USIfAC out there, that's great. I'm sure people are really using them.  :)  (And not only buy them to have it and put in a box).  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 11:51, 29 July 20
If you copy with a single internal 3" drive it will take you about 9 seconds to read that 180 kb and also about 9 seconds to write a disc of 180 KB.
Woooo! That's REALLY impressive! I couldn't imagine that it was possible to get such throughouput from the good old 765FDC, especially when we are talking for a single head/ single density disk (which actual reading is ~4 times less than with a 3.5" dual head, DD disk). Judging from my recent experience with 765, i say you must have eliminated every delay in 765 function in order to achieve this impressive speed!
  But, may i ask,is it reliable at such speeds?  Does it transfer data from disks correctly every time, and for any disk? Also from my experience with 3.5" floppy drives,i know that  there are minor differences in various disk drives, some support more "advance" commands, some only the basic, and i have also confirmed that some drives (usally old branded ones, from NEC or Samsung) have faster responce, hence greater actual transfer speed than others!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 11:59, 29 July 20
Woooo! That's REALLY impressive! I couldn't imagine that it was possible to get such throughouput from the good old 765FDC, especially when we are talking for a single head/ single density disk (which actual reading is ~4 times less than with a 3.5" dual head, DD disk). Judging from my recent experience with 765, i say you must have eliminated every delay in 765 function in order to achieve this impressive speed!
  But, may i ask,is it reliable at such speeds?  Does it transfer data from disks correctly every time, and for any disk? Also from my experience with 3.5" floppy drives,i know that  there are minor differences in various disk drives, some support more "advance" commands, some only the basic, and i have also confirmed that some drives (usally old branded ones, from NEC or Samsung) have faster responce, hence greater actual transfer speed than others!
How to do it?
- Sense where the head is actually (read an ID)
- Read all subsequent sectors in the way they appear (do not read 1,2,3,...9 - do read 1,5,2,6...)
- Couple other smaller things


But back to USIfAC which is still a bit more quick than 20 KB  :) :) :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 12:19, 29 July 20
How to do it?
- Read all subsequent sectors in the way they appear (do not read 1,2,3,...9 - do read 1,5,2,6...)
- Couple other smaller things

 Well,i think that, this exactly what fast track loaders do in some games! Instead of reading one sector/time, they give a single command to read a whole track of all sectors in one command (and yes, interleave reading of C1, C6,C2,C7 is MUCH faster than serial, but you need to have the disk written that way, otherwise, if sectors are writtem sequnetially C1,C2,C3... on disk, you can't read them so fast) , but still, they can only ~double loading speed (at around 8-9kb/sec), that is ~half the speed of yours! Maybe the... "couple other things" is the secret to double the actual speed, or maybe game loaders do other things too, and can't get such incredible loading speeds...  ::)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 12:30, 29 July 20
All the discs are written with an interleave.  :-X
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 12:54, 29 July 20
Quote
Well,i think that, this exactly what fast track loaders do in some games! Instead of reading one sector/time, they give a single command to read a whole track of all sectors in one command (and yes, interleave reading of C1, C6,C2,C7 is MUCH faster than serial, but you need to have the disk written that way, otherwise, if sectors are writtem sequnetially C1,C2,C3... on disk, you can't read them so fast)

Actually,  reading with one instruction or several does not change the speed. For Orion Prime, I read the sectors one by one.

Amsdos have the sectors interleaved because by the time it reads #C1 and processes it, another sector is already below the drive head. So by the time the OS is ready, it has missed it. Hence the interleave. But if you're doing your own loader without the user of a buffer (copy the read sector from a buffer to the data final destination), having linearly stored sectors is the way to go.

Quote
All the discs are written with an interleave.

Most yes, but not all. Some DSKs were transferred with linear sectors, making them reeeeally slower to read.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:34, 29 July 20
But if you're doing your own loader without the user of a buffer (copy the read sector from a buffer to the data final destination), having linearly stored sectors is the way to go.
Hmmm, maybe that's how you can increase speed. If you are using a buffer for sector read (like for example, amsdos does), bytes readed from disk, are first placed to buffer and then loader puts them to their right place in ram. But, if you are NOT using buffer, and instead, each byte received from FDC is putted DIRECTLY to it's actual place, you can practically double the loading speed! Still, future os does this in ~4times the usual loading speed from disk, and AFAIK no game loader can achieve such incredible loading speed...  ::)

Actually,  reading with one instruction or several does not change the speed. For Orion Prime, I read the sectors one by one.
Hmm, maybe then, you can give me a hint of why i get a: "interleaved sectors,check your disk" error message when i'm trying to use the 800k single disk image of orion prime with my 765FDC emulation...  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 14:31, 29 July 20
Most yes, but not all. Some DSKs were transferred with linear sectors, making them reeeeally slower to read.
Very true, and making hfe's from DSKs introduces some additional errors I guess.
Best thing is always to make DSKs / hfe's from real discs (if possible).
Since we have all that non-real-drive devices it's getting more diverse anyway.
And yes, using one routines for a floppy, you can omit interleaves.  :)


I'm really curious to use the U2 with FDC emulation the first time.


For me this is super awesome, because FutureOS already support the Vortex FDC765 (just other I/O addresses). Because it does support four floppies.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 14:33, 29 July 20
>AFAIK no game loader can achieve such incredible loading speed
Orion Prime does, plus it reads 10 sectors per side. This is no black magic.

Quote
>Hmm, maybe then, you can give me a hint of why i get a: "interleaved sectors,check your disk" error message when i'm trying to use the 800k single disk image of orion prime with my 765FDC emulation...
Because you're doing something wrong :).
Orion Prime uses linear sectors, BUT also shifts the sectors every track, for even more speed.
Track 1:  C1 C2 ... CA
Track 2: CA C1 C2 ... C9
Track 3: C9 CA C1 C2 ... C8
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 16:58, 29 July 20
>AFAIK no game loader can achieve such incredible loading speed
Orion Prime does, plus it reads 10 sectors per side. This is no black magic.
Because you're doing something wrong :).
Orion Prime uses linear sectors, BUT also shifts the sectors every track, for even more speed.
Track 1:  C1 C2 ... CA
Track 2: CA C1 C2 ... C9
Track 3: C9 CA C1 C2 ... C8

Actually the image i got, have a bit different structure: first track 0, head 0 (and also next, track 0/head 1) are normal data format  tracks, with interleaved sectors C1,C6,C2,C7 etc.
All following tracks are PARADOS40 tracks with 10 sectors and interleaved sector ids 'A1' through 'AA', which are indeed, in "shift" interleaved order (a pair of tracks -head 0 & head 1- starts with A1 next pair of tracks starts with &AA e.t.c).
Now, to be more specific about the problem i have, after initial loading of first track (sequential read of track 0/head 0 sectors C1 to C8), program gives a "Seek command" to track 1 head 0, and then two read_id requests (where my emulation returns the 1st sector_id of track 1 head 0 ,which is "&A1"), after that, i got a message on amstrad screen " Interleaved Sectors. Check your disc.", and freezes there.
 Let me also note that ,when i got a "read data" command from amstrad, my emulation returns the next sector id of the one requested (or if it's a multiple sector, next of last sector requested), or, if this was the last sector on the track, it returns the 1st sector id of next track (which is the same track number/head 1, if track requested was on head 0, or next track no./head 0 if track requested was head1) . You think this might be wrong for some special situations and i have to return something else?
 Btw, note that my emulation, is tested and works perfectly with numerous formats, even with a ROMDOS D10 (10sectros/track, 80tracks, 2 heads) which gives a maximum of 796kb/disk! The only images that i couldn't load, was orion's prime and Batman forever having this irregular "mix" formats, first few tracks are normal "data format tracks" and rest, special PARADOS/ROMDOS tracks...  ???


Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 20:01, 29 July 20
Yes, track 0 is a conventional Amsdos track, else it wouldn't work when doing CAT and RUN from the Amsdos.

The double ReadSectors of the track 1 should be A1/A2. My code receives something else, so consider this is wrong. Can you trace what your read sector returns?
Returning the next sector seems fine, provided you get it right, but on that part, I don't know what you are doing wrong. Also, watch out for the end of track! On single sided-drive, there is no reason the next sector after the last sector will be in Head 1!
Maybe your tests works because the Read Sector instruction is not often used and is not actually correctly implemented? Run Discology and run the "scan floppy" option to check if it looks good.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 01:18, 30 July 20
The double ReadSectors of the track 1 should be A1/A2. My code receives something else, so consider this is wrong. Can you trace what your read sector returns?
YES! You are right! My code returned in both read_id requests the same "A1" sector_id, because from what i've read in the 765FDC manual noted before, read_id returns H,C,R,N of the 1st valid sector of current track so, i always returned the 1st sector of current track. So,i revised the code, to respond with next sector_id each time a read_id is requested, and now, it responded with A1 and then with A2 as expected,thus it FINALLY  worked! Thank you VERY MUCH for the hint, as it helped me to make the emulation a bit more accurate!

p.s. Loading is indeed VERY fast even with the emulation, at least 2 or maybe 3 tracks/sec, and as each track has 10 sectors, it surely loads up to ~15kb/sec, you really "bit bang' the "Granny" 765FDC!  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 13:39, 30 July 20
READ ID read the first valid ID, that's right. But not from the tracks beginning. It read the very next valid ID. And since the drive is spinning this can be any ID of any sector. Which does it read? It only depends on the position of the head over the track, and the track is constantly moving.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 15:19, 30 July 20
In order to be sure to read the first sector of a track, a trick consists in reading a non-present sector, then perform the Read ID.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 17:26, 30 July 20
And the only situation I an imagine to do that is to scan the array of sectors on a track.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Targhan on 00:31, 31 July 20
Or reading/writing a tricky format where all the sectors have the same ids in a stable order. Not something you do every day :).
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: CraigsBar on 22:21, 31 July 20
I am just learning of this interface today. Is the Serial port side of things compatible with the MiniBooster standard?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: TotO on 22:44, 31 July 20
Sorry, I misunderstood the question (edited). You can plug any TTL things on it too.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 10:13, 01 August 20
So now to the great thing about the Vortex controller. Everything is the same like with the CPCs FDC765, the only differences are the addresses and the fact that the Vortex FDC765 can physically connect four drives - and that's awesome, that way one can use 3", 3.5" and 5,25" at the same time.
Now the FDC status for Amstrad is &FB7E, and for Vortex it is &FBF6
The FDC data port for Amstrad is &FB7F, and for Vortex it is &FBF7

Well,in that case, i think that board will work with Vortex without needing any modifications at all!  :o
You see, the address decoding i'm using (at least for serial port & FDC emulation), is based in checking ONLY specific address bits, and NOT the hole 16bit address (the hole address is needed only for the ROM emulation, which is activated by a different logic: check"ROMenable"=rom read signal, along with address bit 14)!
I'm doing this, mainly to maximize speed and efficiency,as the execution of an Address bit check in PIC's MCU code, is made  in ~0,12uS, whereas, checking specific full address it would need ~1uS! Moreover,Address bit check, defines address ranges and NOT specific addresses, which makes finding of the device (for which the I/O request occures), MUCH easier and faster!
 To be more specific,according to this (http://www.cpctech.org.uk/docs/iopord.html), whenever an I/O request occures, i only need to check Address bit10 (=&FBxx), in order to define if the request is intended for Expansion Peripherals (which, fortunately includes BOTH serial interfaces AND FDC controller!  ;) ) .
After that, i check A5 (Address bit5) to determine if the request is intended for the 765 FDC (&FBFx=> A5='1') or the serial port (&FBDx=>A5='0') , and if I/O request is for 765FDC, i finally check A0 ,to see if its status register port (&FB7E=>A0='0') or data register port (&FB7F=>A0='1'). Note also that all the above bit checks, are executed in ONLY ~1/3 of a microsecond!
 And now, here is the "MAGIC":
 If you check the address ports of the vortex, you will see that EXACTLY the SAME logic can be applied for Vortex too:
Vortex FDC status register port= &FBF6 => A10='0', A5='1', A0='0' EXACLTY like with 765 FDC!
Vortex FDC data register  port= &FBF7  => A10='0', A5='1', A0='1' EXACLTY like with 765 FDC!
So, most probable USIfAC II will emulate Vortex floppy controller too!  :D ;)


[UPDATE] I 've modified the circuit to include A5 bit in address decoding logic, so now, only one bit check is required in the code ,and Amstrad doesn't pause at all when FDC emulation is disabled! With previous code+circuit there was a minor delay ~0,5-1%, in Disk drive function, because of the 3bit checks made in software, which cause ~0.5us delay for every FDC I/O request, also some copy protected game had dfficulties loading from gotek/floppy drive (for example, original dragon ninja image nedded ~33sec to load instead of normal ~23secs needed)  ,obviously because of this minor delay, but now everything is fixed + overall performance was slightly increased too!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 16:44, 03 August 20
Thanks for the detailed information.  :)  As I did read too, you can switch on/off your FDC emulation. That's great so we can work with read FDC and FDC emulation at the same time.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 19:37, 03 August 20
Actually ,there are 3 modes of operation:
- Direct mode, for run/load/save files directly from PC
- Floppy disk controller emulation, for accessing dsk images
- Usb device mode which is for enabling the use of  CH376 usb storage deivce host module (instead of a direct link to PC).
All these are enabled/disabled through simple BASIC RSX commands, but also by giving simple "out &FBD1,x" requests, for use in basic or assembly programs! ;-)
And all the above modes can function in various combinations:
- Direct mode ON, FDC & USB OFF, access files to a connected PC hard drive (through, direct USB2TTL cable, bluetooth module or Wifi module)
- FDC ON, Direct mode & USB OFF, access  dsk images to to a connected PC hard drive
- USB & Direct mode ON, access files in usb storage device (through CH376 host module shown before)
- USB & FDC ON,Direct mode OFF, access dsk images in usb device (not finished yet, but i think i'll manage to make it work at least for most dsk images :-) )
Finally, if all modes are OFF, you can access disk/gotek drive, BUT at the same time, using RSX commands: |CAT, |CD and |DEL you can catalogue,navigate and  delete  files from a connected device to USIfAC II! For example:
- If you give "CAT" ,you will get the contents of a floppy drive disk or gotek drive image,but...
- If you give "|CAT" you will get the contents of the selected PC directory (all modes OFF) or even usb device(USB ON, others OFF)! ;)

In reality, there are two separate ROMS for file/disk access, one is the AMSDOS ROM, and the other is the virtual ROM on USIfAC II. In normal operation, all AMSDOS commands directed to AMSDOS ROM, and extra RSX commands are used to access USIfAC Rom. But, when you enable direct mode, AMSDOS is practically replaced by USIfAC II ROM. And  because only a few routines (for load/save/cat) are actually implemented by USIfAC ROM, a copy of the entire AMSDOS IMAGE ROM is placed in PIC's flash memory, in order to service all other AMSDOS routines too! ;-)
 So now, practically, more than 90% of all file games can run directly at super fast loading speeds, and only games using sector loaders, need access to dsk images (in much slower... "drive speeds")!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 18:01, 11 August 20
This is just awesome!


Maybe somebody should split the topic now?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 22:54, 14 August 20
When i will have it ready for presentation i'll make a new topic for it  :)
And for a small update,i've finished dsk image loading from usb device, most of images seem to work ok, also i've added PARADOS image to pic's flash memory too, and with a simple RSX command you can select if you want to use AMSDOS or parados! Thus, you will be able to use parados functionality (for accessing large dsk images) not only on cpc6128/664 but even with a cpc464!  ;)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: CraigsBar on 23:12, 14 August 20
Sorry, I misunderstood the question (edited). You can plug any TTL things on it too.


I was meaning can the Arkos Rom SUite be used with this new Serial device like they can with the Minibooster.

Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: TotO on 09:15, 15 August 20
Oups.. So, I understood well the first time. :-\ 

The Mini Booster is based around the CPC Booster custom ports while the USIfAC use the standard Amstrad ports, so the softwares are not compatibles without patching them.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Skunkfish on 11:27, 17 August 20
The Mini Booster is based around the CPC Booster custom ports while the USIfAC use the standard Amstrad ports, so the softwares are not compatibles without patching them.
Sounds like a challenge for you there Craig!  ;D
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 02:35, 18 August 20
When i will have it ready for presentation i'll make a new topic for it  :)
And for a small update,i've finished dsk image loading from usb device, most of images seem to work ok, also i've added PARADOS image to pic's flash memory too, and with a simple RSX command you can select if you want to use AMSDOS or parados! Thus, you will be able to use parados functionality (for accessing large dsk images) not only on cpc6128/664 but even with a cpc464!  ;)


To have Parados too is great. Could it be possible to add a "switch" of one byte in the Parados ROM to activate the Vortex format? That would be awesome. Around here Vortex is the standard for 0,7 MB formats. Parados can do this but needs to be put in Vortex-mode (format menu). There is a Varados ROM out there which has Vortex format enabled by default. It would be great to have this too! Varados and Parados are different only in few bits.  :)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:28, 05 September 20
To have Parados too is great. Could it be possible to add a "switch" of one byte in the Parados ROM to activate the Vortex format?

 I believe this is not needed. As i explained in previous msg, UsiFAC II Floppy controller emulation, should be able to respond in BOTH vortex and 765 ports in EXACTLY the same way, thus most probable it should work directly with any program uses Vortex instead of 765!
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 15:16, 07 September 20
I believe this is not needed. As i explained in previous msg, UsiFAC II Floppy controller emulation, should be able to respond in BOTH vortex and 765 ports in EXACTLY the same way, thus most probable it should work directly with any program uses Vortex instead of 765!
The case with Parados is the following. It supports lot of formats. And one need to set up the format selection. It either works with Vortex format or a Romdos format. This can be changed in the format setup. Or a byte in the ROM can be changed to select either the one or the other format.From Parados ROM the Varados ROM was made, the only difference is one byte. Parados has ROMDOS format enabled and VaraDOS has the Vortex format enabled.
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 17:50, 07 September 20
Well, if thst's the case,i could place varados instead of parados as the 2nd ROM DOS (both ROMS will be embedded into PIC's flash memory), and choose between Amsdos or Varados with a simple RSX command! ;-)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 18:13, 08 September 20
Well, if thst's the case,i could place varados instead of parados as the 2nd ROM DOS (both ROMS will be embedded into PIC's flash memory), and choose between Amsdos or Varados with a simple RSX command! ;-)
To offer an option for the customer to decide between ParaDOS or VaraDOS would be great indeed.  :) :) :) :) :)

For the Plus computers you need to either install Amsdos 0.7 (intead of 0.5 from CPC range). Or a patched 0.5 Amsdos which ist 6128 Plus compatible.

Also I remember there were Parados/Varados for 6128 Plus and CPC6128 in different versions.

Maybe it would be possible to update the ROM slots from the CPC side, but this can be too much effort?
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: ikonsgr on 13:40, 10 September 20
I'm afraid my knowledge about 6128plus is rather limited (i don't even now if Usifac ,older or new one, even works on 6128+, unfortunately i dont have a plus model to make any tests...). 
Do you know the differences  between 0.5 and 0.7 Amsdos?  Is there any new to offer or just some bug fixing? And what about compatibility?
In any case, in theory i could place 2,3 or even more Roms in PIC's flash memory, the only limitation is the size of flash (128kb in total) .
 More than half is the actual code for all supported functions (Serial I/O, Rom Emulation, FDC emulation & Usb device utilization) plus ~15kb is Usifac's II virtual ROM (including mainly code for all the RSX commands supported). I've also included 2 small games (pacman and Galachip) you can load driectly using RSX commands, which also take ~20-22kb of flash mem. This left around ~45-50kb of free space to add various ROMS e.g. 2-3 extra roms (excluding the default Amsdos rom) . My thought was to add  at least Parados, but most probable i could add 1 or 2 more roms, if it's worth it!  ;)

Btw, i've finished code for Dsk image read/write from usb device, which seems to function much better than initially expected, almost all images i've tried, can now be loaded  from usb stick too! I've even tried loading the 800kb dsk image of orion prime from usb stick, and worked fine, along with the ability to save the game too!
Also, file support is now fully functioning, e.g. read/write/delete BAS, BIN and ASCII files either from PC or usb stick!
Coming next, copying files between 3"/3.5" disk drive and usb device (e.g. like the previous PC2CPC and CPC2PC functions) ,and maybe an upgrade of the current Amsdos based DSK image transfer function ,using a custom "low level" code that would surely improve speed and ability to write much more disk formats! ;-)
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: Skunkfish on 15:19, 10 September 20
I can confirm that the older Usifac does indeed work with the 6128+ as is what I use it on. I'm using a C4CPC rather than the original Burning Rubber/AMSDOS cartridge, not sure if that makes a difference......
Title: Re: Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)
Post by: GUNHED on 16:32, 10 September 20
Yes, the USIfAK does work with all CPCs and Plus.

The Amsdos 0.7 compared to 0.5 only has some additional commands like !JUEGO to start the Burnin Rubber game on the cartridge. It's no advantage over regular 0.5 Amsdos.
The problem is that the CPC464-6128 Amsdos will crash the Plus computer. However there is a patch for the old Amsdos from the Inicrons to run with the 6128 Plus (and of course the CPCs).

Congratulations to be able to load Orion Prime and all other DSKs - that's really amazing!!!  :) :) :)

Well, if the PIC has more space... then... what's about offering a small ROM box? In this case you don't have to care about the ROMs and everybody can add the own desired DOS versions. On the other hand this may be way too much effort.

Great to see USIfAK II advancing!!!  :D :D :D