AN2153 Freescale Semiconductor / Motorola, AN2153 Datasheet - Page 34

no-image

AN2153

Manufacturer Part Number
AN2153
Description
A Serial Bootloader for Reprogramming the MC9S12DP256 FLASH Memory
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Freescale Semiconductor, Inc.
Application Note
The proper queue size for an application will depend on the expected
length of messages transmitted and received. If the selected transmit
queue size is too small, the routines essentially will behave the same as
the polled SCI example. Once the queue fills, the CPU12 will have to
wait until a character is transmitted before the next character can be
placed in the queue. If the receive queue is too small, there will be a risk
that received characters will be lost if the queue becomes full and
CPU12 does not remove some of the data before the next piece of data
arrives. Conversely, picking queue sizes larger than necessary does not
have a detrimental effect on program performance or loss of data.
However, it will consume the valuable on-chip memory unnecessarily. If
uncertain on the exact queue size for a particular application, it is best to
make it larger than necessary. As shown, the transmit and receive
queues do not have to be the same size, and their sizes are not required
to be an even power of two.
The XOffCount and XOnCount constants are used to manage how full
and how empty, respectively, the receive queue is allowed to get before
the XOff and XOn control characters are sent to the host computer. The
value for XOffCount should be chosen based on the number of bytes
that are expected to be sent from the host after a request has been made
for the TxIRQ routine to send an XOff to the host. This value, which
represents the number of remaining bytes in the receive queue when an
XOff should be sent, will depend on the UART characteristics of the host
computer. In this case, a value of XOffCount would allow up to 10
additional characters to be sent after a request to send the XOff had
been posted. This would allow for the host computer UART with an
8-byte FIFO plus the possible 2-character delay in sending the XOFF
character if the transmit shift register and the transmit data register were
both full.
The value for XOnCount should be selected such that the queue will
never become empty as long as the host has data to send. Setting the
correct value for this constant requires analysis of the rate at which data
is removed from the queue by the application and the delay before the
host computer begins sending data after receiving an XOn. Because the
host’s characteristics can vary widely, a value of the receive buffer minus
eight was arbitrarily chosen. Note that the value of XOnCount
represents the number of characters available in the receive queue.
AN2153
34
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com

Related parts for AN2153