English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 04 May 2020, 15:39   #1
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
CIA/Paula Floppy Signals

Hi guys,

Long time lurker, first time poster

I'm not sure how familiar folks are here with MISTer but it's an FPGA based system which has a version of the Minimig core on it and also has 6 GPIO pins.

I'm looking to output floppy motor control signals so my old floppy drive can sing along with the simulation but I'm having some issues whoch I'm sure are down to my lack of understanding on the even CIA and how it forms pulses.

The step pulse for example is present (as are all the other pulses/signals) but the step, select and direction pulses seem to all be about 2us long. As I understand it, the step pulse at least needs to go low for at least 3ms for compatibility with all floppy drives.

It seems the software is doing it's thing by creating the step signals but the duration of the pulse must be based off something else. I seem to recall it's to do with scanlines but my memory is hazy.

Also it seems the step pulses are all duplicated about 100ms later so for example in the kickstart bootloop where it steps to seek the floppy disk, it's sending the step signal then 100ms later doing it again where a real amiga will only do this once. Anyone have any ideas why? 100ms is obviously far too long to be the start and end of a step pulse.

Any help in understanding how the CIA (or maybe Paula?) Forms these signals would help tremendously
Retrorepair is offline  
Old 04 May 2020, 15:41   #2
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
As an afterthought, if anyone had access to a logic analyzer and an amiga it would be fantastic to see what these signals SHOULD be doing, particularly in the kickstart bootloop.
Retrorepair is offline  
Old 04 May 2020, 16:13   #3
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,716
There is some good information here, if that helps you:

https://www.chzsoft.de/site/hardware...ogic-analyzer/
solarmon is offline  
Old 04 May 2020, 16:44   #4
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
Thanks but that doesn't really explain what I'm looking for. He mentions the signals I'm looking at but doesn't say how they are generated by the original hardware.
Retrorepair is offline  
Old 04 May 2020, 18:11   #5
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,716
You might want to have a browse through the Amiga System Programmers Guide to see if that had the information you are looking for.
solarmon is offline  
Old 04 May 2020, 18:41   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
There is no select or direction "pulse". Perhaps GPIO pins are set to wrong mode?

Hardware Reference manual has floppy timing diagram that shows min and max length of all important signals.
Toni Wilen is online now  
Old 05 May 2020, 01:46   #7
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,581
Quote:
I'm having some issues whoch I'm sure are down to my lack of understanding on the even CIA and how it forms pulses.
The CIAs are just used as simple GPIO. Once set up, each pin is either an input or output which can be accessed with memory read/write and 'bit' instructions.

I took advantage of this in my floppy drive interface for the CD32, which used standard TTL logic gates hard-wired for the correct I/O directions.
Bruce Abbott is offline  
Old 05 May 2020, 08:23   #8
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
Quote:
Originally Posted by Toni Wilen View Post
There is no select or direction "pulse". Perhaps GPIO pins are set to wrong mode?

Hardware Reference manual has floppy timing diagram that shows min and max length of all important signals.
Do you mean the 8520 pin mode? I see in the hardware manual outputs can be set to pulse and toggle. I see theres a runmode bit too, one-shot/continuous. Could be it's never reading CRB or just ignores these bits? I'll need to take another look.

None of this explains the repeated signals 100ms after the first though.
Retrorepair is offline  
Old 05 May 2020, 13:11   #9
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
See attached for output from my logic analyzer, the first image is a whole step, the second is zoomed into the first part of that. As you can see the signals are there, but the step isn't nearly long enough and appears twice for reasons I can't explain.

Looking at the code it doesn't seem CRB2 (outmode) is implemented at all in the timers.

The hardware book is useful to get to this point but doesn't explain how to use this signal. Is it even going to be my problem?

Last edited by Retrorepair; 28 May 2021 at 22:30.
Retrorepair is offline  
Old 05 May 2020, 13:18   #10
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
The CIA doesn't form any pulses. As mentioned above, it's just simple GPIO controlled by the CPU.

Paula is not involved in anything regarding selecting, stepping, motor control, etc.
hooverphonique is offline  
Old 05 May 2020, 13:43   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Outmode and so on are CIA timer related and have nothing to do with CIA general IO ports used for floppy control (which includes seek, drive select, side select etc), fire button read, printer port, serial handshake lines etc..
Toni Wilen is online now  
Old 05 May 2020, 14:40   #12
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
Ok so essentially this is going to be down to the memory being read into the CIA.

One thing I did notice is select isn't active when the extra step/direction signals are active so maybe a real Amiga does this but as only DF0 is selected it's not actually repeated. Could be the extra signals are generated for DF1?
Retrorepair is offline  
Old 06 May 2020, 11:15   #13
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Retrorepair View Post
Ok so essentially this is going to be down to the memory being read into the CIA.

One thing I did notice is select isn't active when the extra step/direction signals are active so maybe a real Amiga does this but as only DF0 is selected it's not actually repeated. Could be the extra signals are generated for DF1?

The kickstart will try to detect up to 4 floppy drives, if that's what you meant. For DF1+, it pulses the corresponding SEL and listens for a pulse train returned from the drive on RDY - this returned pulse train identifies the type of floppy drive (3½", 5 1/4", HD, etc) to the kickstart.
hooverphonique is offline  
Old 06 May 2020, 13:14   #14
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
Ok that makes sense then as minimig is set up for 2 drives so there will be extra step pulses and sel1 will probably line up with them.

I just need to work out why the step pulse is so short. I'm sure it's down to how the data into the cia is being handled.
Retrorepair is offline  
Old 07 May 2020, 09:24   #15
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
So I made sure the assignments to the IO were made on the rising edge of the clock and now all the signals look exactly like they do on a real Amiga (managed to score one locally).

Still no stepping though. Do these drives have to have 5v logic? The SNAC (level shifter) only seems to be able to manage 4v but I'd have thought this would be enough?
Retrorepair is offline  
Old 08 May 2020, 01:53   #16
Retrorepair
Registered User
 
Join Date: May 2020
Location: Rochford
Posts: 28
I ended up working out the issue, it was the logic levels that the drive didn't like. I actually ended up using an arduino with direct port control (digitalRead is way too slow) to fake a level shifter which worked surprisingly well. Apparently manipulating the ports this way can get down to ns timing.

Here's a video of Hybris loading on MISTer hooked up to a real Amiga floppy drive. Keep in mind this is loading from SD, the floppy drive is simply using the control signals in minimig to appear as if it's loading. I'm very pleased, it's great to hear that feedback again

[ Show youtube player ]
Retrorepair is offline  
Old 08 May 2020, 15:37   #17
Gorf
Registered User
 
Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,295
Quote:
Originally Posted by Retrorepair View Post
Here's a video of Hybris loading on MISTer hooked up to a real Amiga floppy drive. Keep in mind this is loading from SD, the floppy drive is simply using the control signals in minimig to appear as if it's loading. I'm very pleased, it's great to hear that feedback again
ok ... so if I understand you correctly the part, where you actually receive data from the floppy is still missing?
How hard would it be to implement it?
Gorf is offline  
Old 04 June 2020, 09:00   #18
bloodline
Registered User
 
bloodline's Avatar
 
Join Date: Jan 2017
Location: London, UK
Posts: 433
Quote:
Originally Posted by Gorf View Post
ok ... so if I understand you correctly the part, where you actually receive data from the floppy is still missing?
How hard would it be to implement it?
He would need to use the Arduino to sample the data stream (which is a very low quality signal, and will proabably require some careful ADC coding) and feed the MFM transitions to the FPGA at TTL levels , the Amiga does all the actual decoding in software, so that makes it quite a bit easier.
bloodline is offline  
Old 04 June 2020, 22:49   #19
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,581
Quote:
Originally Posted by bloodline View Post
He would need to use the Arduino to sample the data stream (which is a very low quality signal, and will proabably require some careful ADC coding) and feed the MFM transitions to the FPGA at TTL levels , the Amiga does all the actual decoding in software, so that makes it quite a bit easier.
The data is digital (so no ADC issues), but it is in MFM format and you may have to store an entire track before decoding it. Most Arduinos do not have enough RAM to store the raw data.
Bruce Abbott is offline  
Old 06 June 2020, 17:13   #20
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,233
Quote:
Originally Posted by Retrorepair View Post
The step pulse for example is present (as are all the other pulses/signals) but the step, select and direction pulses seem to all be about 2us long. As I understand it, the step pulse at least needs to go low for at least 3ms for compatibility with all floppy drives.

It seems the software is doing it's thing by creating the step signals but the duration of the pulse must be based off something else. I seem to recall it's to do with scanlines but my memory is hazy.
Unfortunately, the duration of the pulses is entirely upon control of software. No timer is being used, and even worse, the trackdisk.device in the kickstart (up to and including release 3.1.4) uses a busy-waiting loop to time this signal, which means that the duration of the step pulse depends on the speed of the CPU (yuck!). The v47 trackdisk.device is a bit more careful and uses proper timing through custom-chip accesses.


Quote:
Originally Posted by Retrorepair View Post
Also it seems the step pulses are all duplicated about 100ms later so for example in the kickstart bootloop where it steps to seek the floppy disk, it's sending the step signal then 100ms later doing it again where a real amiga will only do this once. Anyone have any ideas why? 100ms is obviously far too long to be the start and end of a step pulse.
I am unclear on what you are trying to say here. It is not the "kickstart boot loop" which performs stepping, but the trackdisk.device. There is no replication there. It is all part of the TDSeek function which performs stepping, and only there.




Quote:
Originally Posted by Retrorepair View Post

Any help in understanding how the CIA (or maybe Paula?) Forms these signals would help tremendously
Neither. CIA outputs these signals, but it does not time them. That is just software, and even by an (inappropriate) busy loop. Paula only receives (or generates) the MFM encoded track data, but it does not control the step motor nor the disk motor or the select impulses. That is all through the CIAs.
Thomas Richter is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga 2000 Floppy Drive Issues (CIA?) caliban6 support.Hardware 1 24 September 2018 17:20
Interaction of signals and noixemul pipper Coders. System 0 05 February 2018 20:01
Cd32 Rx Tx Signals amigoun support.Hardware 13 21 December 2017 14:46
Amiga VGA sync signals? jarp support.Hardware 9 03 April 2017 18:03
example of a CIA timer interrupt in assembler using cia.resource Apollo Coders. Asm / Hardware 3 05 July 2013 08:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:20.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.21203 seconds with 13 queries