📝 DMA Channels of 8257 (10 MCQs)
Four Independent Channels for Peripheral-to-Memory Transfers
The Intel 8257 provides four programmable DMA channels, numbered 0 through 3, so that four peripheral devices can request direct access to memory. Each channel has a 16-bit address register and a 16-bit terminal count register. These registers specify the starting memory location, transfer length and operation type, allowing separate DMA operations to be configured for different devices.
Address and Terminal Count Registers Within Each Channel
The address register holds the next memory location and is incremented after each byte transfer. The terminal count register uses D13–D0 for the number of DMA cycles minus one and D15–D14 for operation selection. These operation codes are 00 for verify, 01 for write and 10 for read; 11 is an illegal combination.
DRQ and DACK Signals for Request and Selection
Each channel receives its own active-high DMA request input, DRQn, and provides an active-low acknowledge output, DACKn. A peripheral raises its request and maintains it until the controller recognizes it. When the channel is selected, its DACK output becomes low, informing the peripheral that its DMA transfer has been accepted.
Example of Fixed Priority Between Two Requesting Channels
Suppose DRQ0 and DRQ3 become active together and both channels are enabled. In fixed priority mode, channel 0 is selected because it has higher priority than channel 3. The controller activates DACK0 and performs the requested transfer before selecting the lower-priority request.
Transfer Direction and Capacity of an Individual Channel
In DMA write operation, data moves from the peripheral to memory; in DMA read operation, it moves from memory to the peripheral. DMA verify performs the acknowledge and address/count progression without transferring data. Since the count field contains 14 bits, one programmed block can contain up to 16,384 bytes.
Misunderstandings About Channel Selection and Counting
'Channel 3 has the highest fixed priority' is incorrect because channel 0 ranks highest and channel 3 lowest. 'The terminal count register stores only a 16-bit byte count' is incorrect because its two upper bits select the operation. 'DACK is active high' is incorrect because the acknowledge output is active low.
Channel Numbering, Priority and Count Calculations in Exams
Identify the address and terminal count registers associated with each channel, and match DRQn with DACKn. For a required transfer of N bytes, calculate the programmed count as N minus one. Distinguish DMA read from DMA write by data direction, and determine which channel wins when simultaneous requests occur under fixed priority.
Channel Registers and Request Signal Terms
- DRQ - Active-high DMA request input.
- DACK - Active-low channel acknowledgement.
- DMA Read - Transfers memory data to a peripheral.
- DMA Write - Transfers peripheral data to memory.
- DMA Verify - Performs no data transfer.
- Terminal Count - Indicates the final programmed cycle.
📝 All DMA Channels of 8257 MCQs
Q1. What is the primary function of the Intel 8257 DMA controller?
📖 Explanation: The Intel 8257 is designed to move blocks of data directly between memory and peripheral devices, allowing the CPU to release the bus and continue other tasks. Option B correctly describes this role. Options A, C, and D describe unrelated functions such as clock speed, code storage, or interrupt generation, which are not the controller’s main purpose. This understanding helps engineers select the DMA controller when designing systems that require efficient bulk data movement.
Q2. Why does a DMA transfer free the CPU from handling each byte individually?
📖 Explanation: During a DMA operation the controller asserts the bus‑grant signal, taking over the address and data lines. This lets the controller move entire blocks of data while the CPU can perform other work. Option B captures this mechanism. Option A is incorrect; the controller does not replace registers. Option C misstates power management, and Option D confuses OS scheduling with hardware bus control. Recognizing this frees designers to offload repetitive data movement to DMA.
Q3. A system needs to copy 1024 bytes from a sensor buffer starting at address to RAM starting at using channel 2 of the 8257. Which register setting is required for the count register?
📖 Explanation: The count register holds the total number of bytes to transfer. For 1024 bytes, the value placed in the register is 1024 (decimal), which fits within the 14‑bit field. Option A provides the correct count. Options B, C, and D represent incorrect byte totals that would either truncate the transfer or cause overflow, leading to incomplete or corrupted data movement. Properly setting the count ensures the DMA controller knows when to stop, a critical step in reliable system design.
Q4. How does the 8257 determine which of its four channels will respond to a peripheral’s request?
📖 Explanation: The 8257 has dedicated priority pins (HRQ, HLDA) and fixed channel priority lines that decide which channel gains bus control when multiple requests arrive. Option A correctly reflects this hardware priority scheme. The controller does not implement round‑robin scheduling (B), nor does the CPU select the channel during a DMA request (C). Peripheral address (D) is unrelated to channel arbitration. Understanding priority helps prevent bus contention in multi‑device systems.
Q5. During a DMA write operation, the CPU receives an acknowledge signal before the transfer begins. Which signal indicates the DMA controller has completed the transfer?
📖 Explanation: The 8257 asserts the Transfer Complete (TC) line when the count register reaches zero, signaling that all requested bytes have been moved. Option B is the correct indicator. END OF PROCESS (A) is not a defined signal for the 8257, IRQ (C) may be generated after TC but is not the primary completion flag, and Bus Release (D) describes the bus state rather than a specific signal. Recognizing TC helps software correctly handle post‑DMA actions.
Q6. A designer connects two high‑speed UARTs to channels 0 and 1 of the 8257. If both devices request DMA simultaneously, what is the most likely outcome given the default channel priority?
📖 Explanation: The 8257 assigns fixed priority, with channel 0 having the highest. When concurrent requests occur, channel 0 wins arbitration, and channel 1 must wait until channel 0 finishes. Option A describes this behavior. Option B is false because the controller does not interleave transfers. Option C reverses the priority order, and D is incorrect as the controller does not halt on contention. Knowing priority prevents unexpected latency in time‑critical UART communication.
Q7. Explain why the two most significant bits of the 8257’s count register are used to indicate the type of DMA operation rather than part of the byte count.
📖 Explanation: The 8257’s count register uses the upper two bits to specify the transfer mode (e.g., read from memory, write to memory, or verify), separating operational control from the 14‑bit byte count. This design allows the controller to manage the direction and nature of the transfer without sacrificing count capacity. Option B captures this purpose. Options A and C misinterpret the bits as address extension or error checking, while D incorrectly claims they are unused. Understanding this encoding is essential for configuring DMA correctly in complex systems.
Q8. A microcontroller must perform a DMA transfer of 20000 bytes, but the 8257 count register can hold only 14 bits for the byte count. How can the system successfully transfer the entire block?
📖 Explanation: The 14‑bit field caps the count at bytes, so a 20000‑byte block exceeds this limit. The usual solution is to divide the transfer into multiple DMA cycles, each with a count that fits within the register, such as two operations of 10000 bytes each. Option A correctly describes this method. Options B and C imply hardware replacement or data loss, while D would cause overflow and corrupted transfers. Segmenting large blocks ensures reliable DMA operation despite register size constraints.
Q9. If a DMA transfer is interrupted by a higher‑priority interrupt, what must the 8257 do to resume correctly after the interrupt service routine finishes?
📖 Explanation: When an interrupt occurs, the 8257 saves the current address and remaining byte count, allowing it to resume the transfer once the interrupt is cleared. Option B reflects this behavior. Resetting registers (A) would lose progress, restarting (C) repeats data, and ignoring the interrupt (D) would violate interrupt handling protocols. Properly pausing and resuming ensures data integrity in systems where DMA coexists with other interrupt‑driven activities.
Q10. Why is it advantageous for each DMA channel to have its own 16‑bit address register rather than sharing a single address register among all channels?
📖 Explanation: Having separate address registers lets each channel maintain its own source/destination pointer, permitting overlapping or back‑to‑back transfers without reprogramming the register between operations. This independence supports concurrent channel activity (A). Sharing a single register would require extra multiplexing and could cause contention. Options B and D are unrelated to register architecture, and C, while true, does not capture the performance benefit of parallelism. Recognizing this design choice helps engineers exploit the full capability of multi‑channel DMA.