I finally have an M4, but I completely forgot that I don't have any way to get mouse input on my Plus other than via my RSF3 (which is great, but makes it a bit pointless to use the M4, and I expect will conflict with the Gemini memory expansion once that comes about). This gets me to thinking, what's the best way to get a mouse working on the Plus?
There's always PS2Mouse https://www.cpcwiki.eu/index.php/PS2Mouse - but with the split joystick ports on the Plus and the power socket not being particularly close to them, it's a bit of a fiddly mess, especially if you want mouse-wheel support.
There's the new Albireo board https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/albireo-usbsd-interface-for-cpc-new-version-without-serial/ - very feasible, but maybe a bit overkill if all you want is mouse support? No idea if it conflicts with the M4 or other expansions either...
It got me to thinking - could you use the light-pen connector on the Plus to provide mouse input without having to mess with Y cables? You have +5V and GND from it, though I don't know how the LPEN signal is encoded to know if it would be enough to communicate mouse coordinates... Presumably you'd also still lose the mouse-wheel... What about the analogue joystick port, have there been any mouse interfaces that have endeavored to use that?
I'd be interested in prototyping something if I could get some help on some of the details :)
If I don't have a SF2/SF3/RSF3 connected, I am always using the Albireo (USB) or the MultiPlay (Amiga) for having a mouse on my CPC.
But yes, I am curious as well, if the analog joystick port could be used for this with a special interface?
Hi,
there's lots of space inside the Plus. You could wire a PS2 to Joystick interface inside the case and create a PS2 port.
Bryce.
Quote from: Bryce on 14:54, 11 November 22Hi,
there's lots of space inside the Plus. You could wire a PS2 to Joystick interface inside the case and create a PS2 port.
Bryce.
Actually, I love this idea... A PS/2 port to go with my tape port - I guess time to get the components then :)
Still interested in discussing an analogue joystick or light-pen port mouse adapter though, seems a shame to have those ports practically defunct.
@Bryce is there any danger in having the mouse permanently wired to the joystick port without any kind of switch? I assume if both a joystick and the mouse are plugged in at the same time, they would just both work without causing any damage to anything, but I don't fully understand the circuit yet and adding current to something that doesn't normally have it scares me :)
I think when I did it I added a switch to switch off the mouse port if needed (It just disconnected the ground). Not because it could damage anything, but because you could mess up in a game if you knocked against the mouse as these would be seen as joystick inputs.
Bryce.
There is a mot to add an AtariST mouse to the CPC6128.
Without the diodes (the 6128plus contains the diodes already on the pcb) this simple adaptor should work with 6128plus too (I should try, but don't have time now).
The adapter can be found in cpcwiki itself. (It's proportional!)
About Analogue port, it's proportional too. How proportional?
Have a look at the first couple of seconds: arrow moving
https://www.youtube.com/watch?v=_OnEdP0DK5w
The problem with all proportional HID is that they are not joystick compatible. Well, being proportional is the advantage itself. ;)
I contacted Duke on the chance that I could circumvent doing some work and just use an Imperium Solo (and get the added benefit of joystick support too!), but unfortunately, like most things, it's affected by the parts shortage.
So I'm going ahead and designing a board for my use that replicates Bryce's circuit that I'll layout in a convenient way to embed somewhere in my Plus. The attached is Bryce's circuit from the wiki, but modified to always auto-detect, ignoring pin 8 on the joystick port (which is disconnected on the Plus) and using a USB connector. Does this look correct? Something I notice is that there's no filter cap for the LS240 VCC, but perhaps that's unnecessary? And I'm not sure what's going on with the 10K resistor to GND on the USB VCC? It'll be a while before I have all the parts anyway, just thought I'd get a bit of a head-start.
That won't work, you would end up with a screen full of unwanted characters. Pin 8 isn't an Autodetect, it's ensuring that the mouse circuit ONLY sends data when the AY is scanning the joystick port and NOT when the AY is scanning the keyboard. However, you have made a further mistake: You haven't connected the OE pins to GND, just to VCC via a resistor, so the mouse circuit will actually do nothing at all at the moment.
Bryce.
Quote from: Bryce on 13:57, 14 November 22That won't work, you would end up with a screen full of unwanted characters. Pin 8 isn't an Autodetect, it's ensuring that the mouse circuit ONLY sends data when the AY is scanning the joystick port and NOT when the AY is scanning the keyboard. However, you have made a further mistake: You haven't connected the OE pins to GND, just to VCC via a resistor, so the mouse circuit will actually do nothing at all at the moment.
Bryce.
Oh balls, I mixed up pin 8 with pin 5! Pin 5 I suppose will need to be connected to somewhere near the keyboard connector given it has no connection with the joystick port on the Plus - thanks for looking this over, I'd like to think I would've noticed this eventually, but probably not before an extended period of tearing my hair out :)
Regarding the 10K to GND on the USB VCC, can that be ommitted? My best guess is that it makes more sense with PS/2, but I don't really see what it's doing in this case (sorry if this is obvious, my electronics knowledge is extremely limited...)
I have no idea why you added the 10K between USB VCC and ground. My circuit doesn't have that. As for pin 5, this is the undocumented "Fire 3" button on the classic CPC. It won't do anything on a Plus, but I would leave it connected so that your circuit has this feature if used on a classic CPC.
Bryce.
Spotted a silly mistake connecting VDD on the PIC, but that was pretty obvious. Corrected the previous defects that Bryce spotted and did an initial layout, but it's way more convoluted than it should be (especially given Bryce's excellent layout on the wiki), so I'll probably give that another shot at some point before ordering a batch.
I've laid out the DB9 connections in the same order as the last 8 pins of the internal joypad header so that should make connecting them nice and easy (and reversible). Pin 5 is on pin 1 and I should be able to connect that to X7 on the keyboard connector (or NR02 if I want a slightly lower risk place to connect to, I suppose).
I plan on mounting the board just behind the keyboard between that and the disk drive - I figure I'll get ground and power by running wires underneath the motherboard from either IC7 or the floppy power connector. I suppose the latter would be more in keeping, though the route would be slightly longer... The USB port itself I plan on putting just to the right of the floppy disk slot as I'm already using the other obvious space for a tape port. Now it's just a case of waiting for components... I have a spare 464+ with a dodgy ASIC that I can test this on before committing to the changes in my working 6128+ when the time comes, so this ought to be pretty low risk.
Hi. I use à PS/2 mouse connected to the joystick port. It works fine but its not very beautiful ;D
With the CPC+ I use a hardware sprite to manage the mouse cursor. For exemple a video capture of my CM14 screen :
It's in French but the machine translation in English is not too bad.
Quote from: GUNHED on 13:45, 12 November 22There is a mot to add an AtariST mouse to the CPC6128.
Without the diodes (the 6128plus contains the diodes already on the pcb) this simple adaptor should work with 6128plus too (I should try, but don't have time now).
The adapter can be found in cpcwiki itself. (It's proportional!)
About Analogue port, it's proportional too. How proportional?
Have a look at the first couple of seconds: arrow moving
https://www.youtube.com/watch?v=_OnEdP0DK5w
The problem with all proportional HID is that they are not joystick compatible. Well, being proportional is the advantage itself. ;)
Pretty awesome video. Is there a document how to built such a mouse adapter?
So I had some PCBs made up and I'm testing it at the moment - the mouse seems to initialise correctly, but I'm not getting any joystick input on the Amstrad and the LED stays dark. I can see that power is at least going to both ICs correctly and I've verified the PIC is programmed correctly (when the mouse I'm testing with initialises, I get a little haptic click, but perhaps that only signifies power rather than initialisation?)
Given the LED is hooked up directly to a PIC pin, I assume it should either be on when a mouse is connected or when data is transmitted? So I guess either the PIC firmware doesn't like this mouse or something is wired wrong... I programmed the PIC using a PicKit3 and MPLAB IPE - I wasn't certain whether it should hold in reset or release, but neither seem to work.
Anyway, ongoing, tips appreciated!
If you ever make an external interface for sale, I'll buy (assuming its cheap enough) one for testing with the Advanced Art Studio, MicroDesign & the Desktop Environment System. I was seriously unimpressed with mice available "back in the day" and it would be marvellous to have one that works OK :)
Unfortunately, most of the mice available for the CPC just converted the mouse movements to joystick inputs, just like this device does too. So you may be equally unimpressed by the performance.
Bryce.
Pity :(
@Bryce could you confirm what the behaviour of the LED should be? My current thinking is that I've not programmed the PIC correctly, the circuit is pretty simple and I can generate key input by shorting relevant pins to ground, but it seems like the PIC is doing nothing... I've tested the LS chip too, it's working fine. I note you specify oscillator and fuse settings, I assume these are embedded in the hex file? There doesn't seem to be another way to change them in MPLAB IPE, so perhaps that could also be a cause of issues if they aren't?
PIC's are a bit different to AVR. The HEX file should be all you need, there are no additional fuse settings. As for the LED: If it recognises the mouse as compatible (it has to be a mouse that support PS/2 mode, ie: not some really modern 16 button mouse) it will turn on for 1 second and then turn off. After that it will quickly flash every time it receives valid data from the mouse. If it flashes (one second intervals) continuously, then the mouse doesn't support PS/2 mode.
Bryce.
Quote from: Bryce on 16:19, 28 November 22Unfortunately, most of the mice available for the CPC just converted the mouse movements to joystick inputs, just like this device does too. So you may be equally unimpressed by the performance.
True, it's not possible to emulate a real proportional mouse with a Joystick compatible device. A joystick can move 50 pixels in a second, while a real mouse can move over the whole screen multiple times in a second. But IMHO for a GUI it's still better to use a joystick compatible mouse which tries to emulate a mouse than just using a joystick.
Quote from: Bryce on 20:17, 28 November 22PIC's are a bit different to AVR. The HEX file should be all you need, there are no additional fuse settings. As for the LED: If it recognises the mouse as compatible (it has to be a mouse that support PS/2 mode, ie: not some really modern 16 button mouse) it will turn on for 1 second and then turn off. After that it will quickly flash every time it receives valid data from the mouse. If it flashes (one second intervals) continuously, then the mouse doesn't support PS/2 mode.
Bryce.
So I'm not getting any activity on the LED at all, so I suppose that indicates that the PIC isn't running(?) I'll check the clock, I just need to remember how to use my oscilloscope properly :p If there's no mouse plugged in at all, would the LED flash or stay unlit?
With no mouse the LED stays off as far as I can remember.
Bryce.
Quote from: Bryce on 09:10, 29 November 22With no mouse the LED stays off as far as I can remember.
Bryce.
Ok, no luck so far - I've been trying to make some sense with a scope, but tbh, this is a bit beyond me (though I'm eager to learn!) My first thought is to just verify the obvious things, that power and clock are fine. Power is fine, CLKOUT is a sine wave going between 0V and ~5V - is this expected? CLKIN also looks weird - where it just seems stuck at around 2.5V with some noise. I see a little flash of a sine wave when I touch the probe to it, but then it gets stuck at 2.5V immediately after - is that expected?
The resonator I used is the Murata CSTLA4M00G55. It has a capacitance of 30pF (though the ebay page says 33/39pF - not sure why two values, or why higher than the datasheet...) - I note that's higher than the 22pF you quote on the wiki page when using a crystal, is 30pF (or 39?) too slow?
Any tips for debugging this would be gratefully received!
Because you are using a passive probe (not an active probe), you are most likely stopping the clock by touching it with the probe tip. The capacity of the probe is enough to collapse a crystal signal. To measure a clock directly at the crystal you either need to use an active probe (these cost a lot more than your scope) or use a non-contact method (NF Probe, which also cost a bunch).
Bryce.
Remember AMX Stop Press! They showed how good a joystick compatible mouse really can do.
Yes, but from a hardware perspective they didn't do anything different. It's the software on the CPC that decides how good the mouse feels.
Bryce.
Sure. That's what I always tell. Everything depends on the software.
Therefore I talked about a joystick compatible mouse (any!) and mentioned the particular software.
Like an acceleration parameter which works for joystick compatible mouses quite good as well.
It's probably one of the reasons why joystick compatible mouses could feel and be used like proportional mouses, if you are not experienced in the real difference and learn to handle them in this way.
ja.PNG
I've been debugging and trying to verify and understand more - as far as I can tell, everything is wired how I intended to wire it and behaving as I would expect. The chip select on the LS240 is being pulsed correctly and all the output pins go where I expect and are what I'd expect to see (pulled high, waiting to be grounded). Really, the only thing that isn't doing its job appears to be the PIC. It's receiving power and the clock looks good on CLKOUT (I assume it's meant to look like a sine wave and not a square wave?), but it doesn't appear to be communicating with the mouse at all.
So my thought is either I've not flashed the PIC correctly or that perhaps I've not understood the circuit and wired something incorrectly. Regarding the latter, it's not like there's a whole lot I could get wrong, so I'm still suspecting that it isn't flashed correctly or there's something wrong with the clock and I don't understand what it should look like.
Something I wonder about; I've tied RA4 on the PIC to ground - as I understand the circuit, this should permanently enable auto-detect. Though even if that was wrong, I'd have thought the side-effect would be no mouse wheel (which won't work until I connect X7 from the keyboard connector anyway, iiuc), not the entire thing not working?
I suppose I could try to make the flashing circuit and follow the exact steps from the wiki page rather than using MPLAB, but it feels like I'm clutching at straws somewhat now... Does anyone have any suggestions?
Can't you read back the PIC content and confirm that's it's programmed? The HEX file doesn't lock the code, it should be readable.
Bryce.
Quote from: Bryce on 13:07, 02 December 22Can't you read back the PIC content and confirm that's it's programmed? The HEX file doesn't lock the code, it should be readable.
Bryce.
Yes, and I can confirm that it is what I'd expect - the program code is from 0x0-0x1af and the rest is filled with 3FFF. MPLAB verification says it's correct and there aren't any errors during programming. I also verified the flags reflect what's said in the wiki too, and it does.
On the off-chance, I tried the 1.0 firmware given I based my circuit on the diagram of the PS/2 circuit, but no change in behaviour. I guess I should learn enough about PIC programming to just write a small debug program to check that the circuit is ok by flashing LED patterns... But I'll exhaust a few more easier, brute-force methods first.
My mistake, sorry
Quote from: Cwiiis on 13:29, 02 December 22On the off-chance, I tried the 1.0 firmware given I based my circuit on the diagram of the PS/2 circuit, but no change in behaviour. I guess I should learn enough about PIC programming to just write a small debug program to check that the circuit is ok by flashing LED patterns... But I'll exhaust a few more easier, brute-force methods first.
I've not read the complete thread - but when using a new MCU / IDE there's always a few issues that will catch you out...Have you configured the "hardware side" of the MCU correctly? normally you have to configure the oscillator type (such as external oscillator / Crystal or ceramic resonator etc), clock path / clock dividers / PLL, ADC, DAC, watchdog timers etc...
Not sure what's required for your MCU, but might be good to write a simple software routine to flash an LED etc. just to see that the MCU hardware configuration is OK (clock frequency etc).
Quote from: RetroCPC on 00:05, 30 March 23Quote from: Cwiiis on 13:29, 02 December 22On the off-chance, I tried the 1.0 firmware given I based my circuit on the diagram of the PS/2 circuit, but no change in behaviour. I guess I should learn enough about PIC programming to just write a small debug program to check that the circuit is ok by flashing LED patterns... But I'll exhaust a few more easier, brute-force methods first.
I've not read the complete thread - but when using a new MCU / IDE there's always a few issues that will catch you out...Have you configured the "hardware side" of the MCU correctly? normally you have to configure the oscillator type (such as external oscillator / Crystal or ceramic resonator etc), clock path / clock dividers / PLL, ADC, DAC, watchdog timers etc...
Not sure what's required for your MCU, but might be good to write a simple software routine to flash an LED etc. just to see that the MCU hardware configuration is OK (clock frequency etc).
He's using the compiled HEX file I created. That has all the correct setup parameters in it as long as he hasn't changed anything on the hardware side it should work fine.
Bryce.
Chris,
Happy Birthday:-
You have an error on the MCLR line (Reset_n), I dont believe the 100uF cap should be connected to MCLR, rather VDD/VCC, see Bryce's orginal schematic..
I'm not sure if there should have been a 100nF Cap to Ground on MCLR - maybe the PIC has internal Reset...
Anyway, the solution as I see it is to connect the Postive of 100uF cap to VCC /VDD...
If it works - a Birthday gift :)
Quote from: RetroCPC on 13:01, 03 April 23Chris,
Happy Birthday:-
You have an error on the MCLR line (Reset_n), I dont believe the 100uF cap should be connected to MCLR, rather VDD/VCC, see Bryce's orginal schematic..
I'm not sure if there should have been a 100nF Cap to Ground on MCLR - maybe the PIC has internal Reset...
Anyway, the solution as I see it is to connect the Postive of 100uF cap to VCC /VDD...
If it works - a Birthday gift :)
Thanks :)
I tried correcting this and unfortunately no luck.
I then recreated the circuit partially on a breadboard, but no luck there either - I don't know what the PIC code does to know exactly how much I can reduce the circuit, but I made the assumption that you don't need to connect RB0-6 or RA2/3 for mouse detection to work at least, but I see no signs of life on the LED connected to RB7 in this configuration.
I should probably do some probing to double-check that my breadboard setup is correct, but at this point I'm thinking I need to put together a simple PIC program that just flashes an LED so I can see that I at least have power/clock/reset setup correctly.
/MCLR should be tied high to VCC via a 4k7 resistor, otherwise the circuit is in a permanent random reset loop. The 100uf and 100nf should both be across VCC and GND.
Bryce.
No one replied about the lightpen input, so, here it goes.
The way lightpen works is they detect the electron beam in the display, and just send a signal "I am above the electron beam just now". This signal is sent to the CRTC, when it receives it, it remembers which part of the display it was displaying at that exact time.
So, if you wanted to make a mouse from this, you would have to also connect it to the video output, and have it count lines and pixels there in realtime, so it can send the pulse at just the right time.
It's possible, but probably more complicated than the other options.
As for the analogue joystick port, I think that could be made to work. Especially as that port does have a +5V supply for it, and is not used for anything else really :)