News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Universal Serial Interface for Amstrad CPC (a.k.a USIfAC)

Started by ikonsgr, 19:20, 05 January 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Colday

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?

ikonsgr

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.


Dandare

Quote from: ikonsgr on 12:20, 01 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.


Quote from: ikonsgr on 12:20, 01 March 19
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.



ikonsgr

Quote from: Dandare on 22:48, 02 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) ...  ::)

GUNHED

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?
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

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, 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

ikonsgr

I've just transfer the dsk image of Double dragon 3 to a 3" disk in....40Seconds!
Coming soon to your near USIfAC!  :D

GUNHED

Quote from: ikonsgr on 23:24, 05 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.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

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:

[attach=1,msg171560]

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 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!

ikonsgr

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!  :)

Dandare

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

@ikonsgr, Adapting your current Disk transfer software to run from a dandanator CPC is something we can look into if you want :D

GUNHED

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.


http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: GUNHED on 14:17, 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...)

Quote from: GUNHED on 14:17, 07 March 19
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... ::)


ikonsgr

Quote from: Dandare on 12: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
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?

Quote from: Dandare on 12:50, 07 March 19
@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!  :)

GUNHED

Quote from: ikonsgr on 14:40, 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.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

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! 

Dandare

Quote from: ikonsgr on 14:52, 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.


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.

ikonsgr

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

Dandare

Quote from: ikonsgr on 15: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!  ;)


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 .


ikonsgr

Quote from: Dandare on 15:15, 07 March 19
BOM for materials is around 8€ without the plastic case. All information is in 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!  ;)
 

Quote from: Dandare on 15:15, 07 March 19
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... ::)

Quote from: Dandare on 15:15, 07 March 19
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.


Quote from: Dandare on 15:15, 07 March 19
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!  ;)

00WReX

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

[attach=1,msg171694]
The CPC in Australia...
Awa - CPCWiki

ComSoft6128

I have exactly the same problem and have tried the interface on two different Windows 8 laptops. A Windows problem? Windows 10 required?

00WReX

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.

The CPC in Australia...
Awa - CPCWiki

00WReX

Sorry...another quick update.

QuoteI 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...
The CPC in Australia...
Awa - CPCWiki

ikonsgr

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 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 (also none of these old ports seem to support speeds greater than 115200)

Powered by SMFPacks Menu Editor Mod