[comp.dsp] HELP!!! IBM PC/AT 8237 DMA Ch6 Conflicts With BIOS Fixed Disk Write

annala@neuro.usc.edu (A J Annala) (02/12/90)

>I have an eight channel multiplexed analog to digital converter hooked
>up to a SONY PCM-F1 digital signal processor (aka digital audio to VCR
>video conversion box).  The 16 bit wide * 88.1 KHz data stream can be
>retrieved as a 16 bit TTL bus signal plus data ready strobe via 25 pin
>RS-232-C shell connector on the back of the box. 
>
>The data stream is currently being read into an IBM PC/AT via a simple
>TTL compatible digital input card using channel 6 on the second 8237A
>DMA controller.  The problem comes when I try to simultaneously input
>the data stream from the digital input card and write the data to hard
>disk.  I get many errors from the disk (going through either Turbo C
>formatted/unformatted io calls, MSDOS file service calls, MSDOS fixed
>disk service calls, or BIOS fixed disk service calls) when I try to do
>a write while simultaneously reading data from the DMA chip.  
>
>Perhaps if I were to use a large capacity FIFO chip in the data stream 
>I might be able to mask out (disable) channel 6 for long enough to write 
>data to the hard disk.  Does anyone have any suggestions here?  Dr. Dobbs
>used a 1024 byte FIFO chip (IDT7202 source unknown) to buffer data about
>100 KBytes/second.  His code ran in an interrupt service routine (does
>this maybe suspend DMA briefly?).  In any case I am open to suggestions
>about how to get this data into memory and write it to disk continuously
>and without interruption.
>
>Thanks, AJ
>  

Thank you very much for your kind offer to provide some advice.  I have
enclosed answers to the questions you posed.  I do appreciate any help
you can provide on this problem.  I really don't know where else to turn.
No published materials seem to offer any clue about the conflict between
the DMA operations and my attempts to write buffers to the fixed disk.

>Questions:

>1) is your AT a real IBM or a compatible? If compatble, which one?
...... I am using an authentic original IBM manufactured PC/AT ...

>2) what is the clock frequency of your AT (it makes a big difference)?
...... 80286-8 chip w/ 16 MHz crystal ... therefore I presume clock = 8 MHz
...... curiously it contains an 80287-3 ... would I gain anything by buying
...... a higher speed 80283 chip?

>3) what is the clock frequency of your 8237A (4MHz?)?
...... 8237AC-5 chip ... no apparent crystal ... I presume frequency = 5 MHz

>4) the info on 88.1 KHz data stream says something about the "service
>   request frequency" (and in turn about the "required throuput"),
>   but it does not say anything about the size of your data (are you
>   looking at this data for ms, sec, or hours?). How much data do you need
>   to store on disk? (the answer to this question will tell me if a bigger
>   fifo will do)
...... My PC/AT has one Seagate ST4038 (32 MB) drive and one Toshiba MK53F
...... (72 MB 10 head x 17 sector x 830 track) drive.  I have the original
...... PC/AT controller available for reinstallation (3:1 interleave) and I
...... have installed a WD1006V-MM2 controller (1:1 interleave).  I plan to
...... use the Seagate with PC DOS 3.3 file system for software development.
...... I plan to dedicate the entire Toshiba drive to data collection using
...... BIOS calls to write data to raw head/sector/track locations.  The new
...... controller has just about doubled the data transfer rate to/from disk
...... and bypassing PC DOS by going directly to the BIOS fixed disk services
...... gives me better control over the disk head movement (no seeks to the
...... DOS FAT or hidden repeated attempts to write bad / marginal sectors).
...... My program will skip bad tracks found during a separate intensive bad
...... track scan.  In any case, direct access to BIOS means that the heads
...... should move one or two tracks at a time; no long range seeks will be
...... done during data collection.
......
...... I plan to acquire data continuously and write it to disk during about
...... seven minutes per experiment.  I would prefer to do acquire the data
...... to disk with no gaps during those seven minutes.  I can write 256 KB
...... in less than 50 msec.  If I simply mask off the DMA channel for 50 to
...... 60 msec I could probably get by with a 8K X 16 bit wide FIFO.  On the
...... other hand, it would be very nice to just be able to write to fixed
...... disk while the DMA channel is running.  Dr. Dobbs Journal (January
...... 1990 pp. 28-37, 94-96) claims to do just precisely what I am trying
...... to do with a throughput of 100 KB/sec.  However, the author wrote an
...... interrupt service routine to ping pong between two buffers and write
...... data to disk.  This implies that one should be able to write to disk
...... while the DMA is running; but there may be some differences from my
...... approach because he performed his write during an interrupt and his
...... data rate is only about 60 percent of my target rate.

>These are just few questions.

>From a less technical point of view, I would like to know:
>1) what are you doing (course project, degree thesis, publication, or other)?
...... I am a M.D./Ph.D. student in the Neuroscience Program at USC.  I am 
...... trying to collect high rate high resolution records of neural signals
...... originating in those portions of the brain that are involved in the
...... association of illness with food consumed just prior to poisoning as
...... a part of cancer chemotherapy.  Essentially, I am looking for the
...... memory trace that preserves the connection between illness and food
...... consumed just before the onset of illness.  This work is primarily 
...... intended to serve as my dissertation project.  However, I should also 
...... be able to spin off a few good publications from these experiments.
...... The potential to make meaningful changes to the way health care is
...... delivered to cancer patients and to improve their quality of life is
...... substantial.  If you are interested in coauthoring an article for
...... something like Journal of Neuroscience Methods, I suspect solving
...... this problem would be of interest to other Neuroscience investigators.

>2) what is your position (student, graduate student, researcher, teacher,
>   other)?
...... I teach from time to time in the Computer Science Department at West 
...... Coast University (based on my M.S. in Information Science from The
...... Claremont Graduate School) ... Mostly, I am working full time on my
...... Ph.D. in Neuroscience on my way to an M.D. & neurosurgery residency.
...... I plan a career in academic medicine.

>3) do you have a budget for your project (this question is related to the
>   possible use of a coprocessor card, that may be expensive, i.e: ~$5,000)?
...... Once I have collected enough data to demonstrate that we are capable
...... of collecting meaningful data ... then I may be able to acquire some
...... high powered coprocessor ... however, until I can get my current card
...... working well enough to collect a reasonable amount of data, I probably
...... won't be able to get a $5,000 solution funded.

>4) what is the time frame of your project?
...... I am devoting full time to at least beginning to collect some data
...... (even if it has 50 msec holes every 1.74 seconds) in the next two
...... weeks.  I plan to finish my dissertation defense (and this project)
...... prior to September 1991.

>5) do you know how to program in assembly language (it is faster)?
...... I can program in assembly language if necessary.  Most of my code
...... right now is written in Turbo C 2.0, Microsoft C 5.1, and FORTRAN.
...... I have a very old version of MASM for some small pieces of code I
...... have written.  I could purchase new MASM or Turbo ASM at academic
...... discount without much strain on my budget.

>6) what is your background (hardware, software, analog, digital or other)? 
>   Are you an electrical engineer, a computer scientist or other?
...... My background is mostly computer science (programming in FORTRAN, C,
...... ALGOL, PASCAL, assembler ... system programming on VAX VMS, PDP-11
...... RT-11/RSX-11M, CDC-1700 MSOS, BSD 4.3 UNIX ... scientific programming
...... on a wide variety of other machines ... image processing ... 2D & 3D
...... graphics ... biological neural network simulation).  I have done some
...... analog/digital hardware design, construction, and programming.  But
...... my expertise is mostly in the software area.

>I do not have any spare time, but if you give me some elements, I may be able
>to pass some suggestion to you.
...... I deeply appreciate any comments you can offer.  You are the only
...... person I have been able to locate that has any significant degree of
...... expertise in the areas of this problem that I have not been able to
...... solve.  The documentation on how to do realtime programming on the
...... IBM PC/AT is somewhat limited.  The Eggebrecht book on Interfacing
...... to the IBM Personal Computer was very helpful.  The Intel manuals on
...... their microprocessors and support chips were useful in learning how
...... to deal with the 8237 DMA chip.  The Phoenix Technologies System BIOS
...... book was very helpful for identifying ports and memory locations used
...... to support the Intel chips in the IBM PC/AT product.  The Dr. Dobbs
...... article on DMA programming was also quite helpful.  However, no one
...... seems to have a clue why the DMA operation should interfer with any
...... attempts to write to the fixed disk via Turbo C/Microsoft C library
...... calls, MS DOS file services, or direct access to the IBM System BIOS.
...... I really don't know where to turn and I do appreciate your help.

Thanks, AJ Annala, USC Neuroscience Program
        Hedco Neuroscience Building HNB-534
        University Park, Los Angeles, CA 90089-2520
        (213)743-3250 (office)  (213)743-8868 (lab)