Re: serial bus timing (was: C64 Kernal disassembly question)

From: Spiro Trikaliotis (ml-cbmhackers_at_trikaliotis.net)
Date: 2004-05-13 09:43:21

Hello,

well, thinking about it, many of your arguments seem to be right. I
think about a multitasking environment, even on the uC.

* On Thu, May 13, 2004 at 10:14:00AM +0300 Marko Mäkelä wrote:
> On Thu, May 13, 2004 at 08:35:34AM +0200, Spiro Trikaliotis wrote:

> > Upon reception of an ATN, each peripherel sets the DATA line almost
> > immediately to tell the controller that it needs some more time. In
> > fact, in the 1541, this is done with an XOR gate, so there is no
> > need for the processor to process the ATN itself.
> 
> True, but the timeouts in the protocol allow a software-based
> response.  Womo measured that my C2N232 solution has a delay of a few
> microseconds, even though it responds to ATN with an interrupt.

Yes, that's true. opencbm does this in the interrupt routine on a Linux
or Windows machine, so there is in fact enough time to handle it there.
Anyway, it would be hard to do this with polling on such a system, as
the polling itself would consume considerably much time.


> > As soon as the peripheral is ready, it unsets the DATA line. When
> > the last one has done so, the control recognizes this and is able to
> > put the appropriate command (LISTEN, TALK, ...) on the serial bus.
> 
> True.  This is where flow control can be implemented: delay raising
> DATA until the RS-232 transmission buffer is ready to accept data.

This mechanism is used by the 1541 in wait until the main loop is able
to process the bus, which is polled on the 1541. The machine has enough
time to stop whatever it is doing.

OTOH, this means: If the uC is doing something which is time-consuming
and does not allow handling the bus, at least the ATN line has to be
checked in between. If this is not possible, use the interrupt.

Is this description better? ;-)


> > So, if you want to implement a controller, the DATA line needs an
> > interrupt.
> 
> Why?  A microcontroller can easily do this with polling.  At 38400
> bps, RS-232 receive interrupts can arrive every 260 µs.  I've disabled
> the RS-232 receive interrupts in some places in my serial bus code.

Ok, I rephrase: If *might* need to have an interrupt on the DATA line,
depending on the overall design. Is this better? ;-)

 
> On a multitasking computer, it's a completely different matter, as you
> can't tie the processor for long periods of time.  There, it's better
> to use interrupts (or delegate the serial bus handling to an external
> microcontroller, like the C2N232 with the serial bus modification).

Depending on the design of the uC, it might be an issue even with the
controller, especially if handling the serial bus is not the only task
of the controller.

Kind regards,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.