TI 320c30: making an async port from the serial port?

TI 320c30: making an async port from the serial port?

Post by unkno » Sat, 26 Feb 1994 17:01:06



Greetings,

On an application, I would need an asynchronous serial port for sending
data to a PC. I would not add an extra chip if possible to avoid.
I looked at the 'c30 data book and began to think, if a 'c30 serial port
can, with some serious hacking be used the way I need.
I could use any of the data rates available on PC (300,...,38400 bps).

Is this possible? Has someone done a similar thing? Any ideas?
Or should I leave this dream and go to do some boring chip shopping?

Thanks a lot,
Jouni
--

M.Sc., Research Scientist
Technical Research Centre of Finland            Tel.    +358 31 163 632
P.O.Box 192, SF-33101 Tampere, Finland          Telefax +358 31 163 694

 
 
 

TI 320c30: making an async port from the serial port?

Post by Jonathan Tho » Mon, 28 Feb 1994 09:56:32


: Greetings,

: On an application, I would need an asynchronous serial port for sending
: data to a PC. I would not add an extra chip if possible to avoid.
: I looked at the 'c30 data book and began to think, if a 'c30 serial port
: can, with some serious hacking be used the way I need.
: I could use any of the data rates available on PC (300,...,38400 bps).

: Is this possible? Has someone done a similar thing? Any ideas?
: Or should I leave this dream and go to do some boring chip shopping?

: Thanks a lot,
: Jouni
: --

: M.Sc., Research Scientist
: Technical Research Centre of Finland          Tel.    +358 31 163 632
: P.O.Box 192, SF-33101 Tampere, Finland                Telefax +358 31 163 694

--

If you only want to send to an async port you can probably use the
synchronous serial port on the C30 but it still will not be easy because of
the need for start/stop bits.

Everytime I've looked at the problem of having an async interface to the C30
the least expensive / least hassle solution has been to memory map a UART.

If anyone has an async interface to a C30 serial port that they'd like to
share please post your solution.

______________________________________________________________________________
Jon Thorn
Texas Instruments

Disclaimer:  opinions are mine, your mileage may vary, nothing here implies
             an endor*t by my employer.
______________________________________________________________________________

 
 
 

TI 320c30: making an async port from the serial port?

Post by Corey Minya » Tue, 01 Mar 1994 07:08:25


unknown (j...@tuhkelo.kau.vtt.fi) wrote:

: Greetings,

: On an application, I would need an asynchronous serial port for sending
: data to a PC. I would not add an extra chip if possible to avoid.
: I looked at the 'c30 data book and began to think, if a 'c30 serial port
: can, with some serious hacking be used the way I need.
: I could use any of the data rates available on PC (300,...,38400 bps).

: Is this possible? Has someone done a similar thing? Any ideas?
: Or should I leave this dream and go to do some boring chip shopping?

: Thanks a lot,
: Jouni
: --
: Jouni Siirtola                                        Jouni.Siirt...@kau.vtt.fi
: M.Sc., Research Scientist
: Technical Research Centre of Finland          Tel.    +358 31 163 632
: P.O.Box 192, SF-33101 Tampere, Finland                Telefax +358 31 163 694

I have done this without any additional hardware on the C30.  I have
submitted a tech report to TI (they keep telling me they will publish it,
but I haven't seen it come out yet).  For the interest of the DSP community,
I will publish it here.  It includes a crude hardware diagram and some
source code.

I wrote this as part of an experimental OS for the 'C30.  I used it to
bring up a board, but it didn't go into the final product.  Thus, it is
not extremely well tested.  Plus, if performance is your concern, a
dedicated UART is definately the way to go, because this will take 16
bit periods for every sent character (instead of 10 with the standard
n81 UART configuration) and three interrupts for every received character.

Hope this helps and I'd like to get feedback if anyone uses this technique.

Corey
miny...@bnr.ca

          Using a `C30 serial port as an asyncronous RS-232 port

                              Corey Minyard

                          Bell Northern Research

Although the 320C30 serial port were designed to be used as syncronous
port, they can be used as asyncronous port with a little creative software.
This application note describes the hardware and software to use a `C30
serial port as an asyncronous port.

How It Works
------------

This design relies on the fact that received RS-232 signals always start
with a "start bit" that is not part of the data and one or more "stop
bits) that are also not part of the data.  The method normally keeps
the receiver turned off and an interrupt (also tied to the receive line)
turned on.  When the interrupt goes off, this signals a start bit on
the line.  The code then turns the interrupt off and the receiver on;
the data comes in as a normal 8 bit character.  The stop bits assure the
`C30 has time to handle the data before the next character.

The transmitter basically frames the data into 16 bit words, adding a
start bit, the character to send, and the stop bits.  This will result
in up to 6 clock cycles (RS-232 clock rate) where bandwidth on the
channel is "wasted".  (Think of it as having 7 stop bits.  Thats kind of
how it works.)  A more efficient (but more complicated) design could be done,
but was not necessary for my project.  Character go in and out the serial
port "backwards" from the RS-232 method; they must be bit-swapped to be
correct.

The serial port is set up as a continuous transmit normal port.  Frame syncs
are not used and internal clocks are used for the serial port timing; these
are timed of the C30 clock and need to be adjusted if clock rates change.

Hardware
--------

Little hardware design needs to be done to handle this, basically just
wire the serial port to the `C30 properly.

                                             +
                  |\ 75C189A (or eqiv.)      |
       RXD        | \                        |
       -----------|  |0-----------+----------| DRx
                  | /             |          |
                  |/       +      |          |
                           \      +----------| INTx
                           /                 |
         75C188 (or eqiv)  \                 |
                    /|     /                 |
       TXD         / |     |                 |
       ----------0|  |-----+-----------------| DXx
                   \ |                       |
                    \|                       |
                                             |
                     +    +    +    +        |
                     |    |    |    |        |
                     \    \    \    \        |
                     /    /    /    /        |
                     \    \    \    \        |
                     /    /    /    /        |
                     |    |    |    |        |
                     |    |    |    +--------| CLKXx
                     |    |    |             |
                     |    |    +-------------| FSXx
                     |    |                  |
                     |    +------------------| CLKRx
                     |                       |
                     +-----------------------| FSRx
                                             |

Notice that the received signal is tied to DRx (Data Receive) and also
INTx (any of the C30 interrupts).  DXx (Data TRANSmit) must be pulled
high to avoid having to have the C30 constantly supply "1" on the line
when it has nothing to transmit.  The clocks and frame syncs are not
used.

Software
--------

The real meat of this design lies in the software.  It must handle
the interrupts and port setups and the queueing of the data.  Actual code
and descriptions follow in this article.  The code ran under an operating
system written by me, but the operation of the OS routines should be obvious.

Transmitter
-----------

The transmitter does not do very much; just frames the data properly, waits
for the transmitter to be free, and sends the data.  The transmitter interrupt
also drove the OS timer tick; therefore the transmitter was constantly driven
with data even when idle.

Receiver
--------

The receiver does a lot more than the transmitter; some interrupt tricks
supply the necessary "sync to async" conversion.  Normally the serial port
receiver is turned off.  An interrupt comes in (the rec_coming interrupt)
when a start bit comes in the receiver.  This will turn off the rec_coming
interrupt and start the receiver.  The next 8 bits coming in the serial port
should be the character desired.  After these 8 bits are received; the
rec0 interrupt goes off.  This will handle the received character; turn
off the receiver, and turn back on the rec_coming interrupt to wait for the
next start bit.

/******************************************************************************/

/*
 * io.c - The I/O routines and tasks to handle I/O to the C30 serial port.
 */

#include "monitor.h"
#include "debug.h"
#include "io.h"

Queue_Id       gets_queue;
Queue_Id       rec_int_queue;
Queue_Id       io_state;
int            rec_ready;

static Queue_Id  wait_rec_int[2];
static Queue_Id  wait_rec_cmd[2];

/*
 * invert_8 - swaps the bits in the 8 bit character supplied.
 */
char invert_8(inchar)
    char inchar;
{
    char outchar;

    outchar = 0;
    if (inchar & 0x01)
    {
        outchar |= 0x80;
    }
    if (inchar & 0x02)
    {
        outchar |= 0x40;
    }
    if (inchar & 0x04)
    {
        outchar |= 0x20;
    }
    if (inchar & 0x08)
    {
        outchar |= 0x10;
    }
    if (inchar & 0x10)
    {
        outchar |= 0x08;
    }
    if (inchar & 0x20)
    {
        outchar |= 0x04;
    }
    if (inchar & 0x40)
    {
        outchar |= 0x02;
    }
    if (inchar & 0x80)
    {
        outchar |= 0x01;
    }
    return(outchar);

}

/*
 * The get string task.  This receives request to receive strings then
 * receives them and sends the result back to the requesting task.
 */
void
gets_task()
{
    unsigned int my_tid;
    unsigned int msg;
    unsigned int tid;
    unsigned int qid;
    unsigned int dummy1;
    unsigned int dummy2;
    Buffer_Id    buf;
    void         *bufptr;

    char outbuf[3];

    char *out_loc;
    unsigned int count;
    unsigned int max_size;
    int finished;
    unsigned int c;

    io_state = NODEBUG_STATE;

    my_tid = 0;

    os_task_inquiry(&my_tid, NULL);     /* Get my task id (and therefore my) */
                                        /*   main queue id. */
    os_create_queue(&gets_queue);       /* Create another queue for requests */
                                        /*   to get data. */

    rec_int_queue = my_tid;             /* My main queue same as tid */

    wait_rec_int[0] = rec_int_queue;    /* Set up queue lists for wait queues */
    wait_rec_int[1] = END_QUEUE;

    wait_rec_cmd[0] = gets_queue;
    wait_rec_cmd[1] = END_QUEUE;

    while (TRUE)
    {
        rec_ready = FALSE;      /* Not receiving any data here */

        /* Wait for someone to request a string */
        os_wait_fetch(wait_rec_cmd, &msg, &buf, &bufptr, &tid, &qid);
        if (buf != NO_BUFFER)
        {
          os_free_buffer(buf);
        }

        rec_ready = TRUE;       /* Now we are receiving data */

        /*
         * The following is not 32-bit clean, but it doesn't matter for
         * C30s
         */
        max_size = (msg >> 24) & 0xff;  /* Get the num bytes to receive */
        out_loc = ((char *) (msg & 0xffffff));  /* Get the address to put */
                                                /*   the string in. */

        count = 0;
        finished = FALSE;
        while (!finished)
        {
            if (count >= max_size)      /* If all the data is in, send a msg */
            {                           /*   back to the requestor */
                *out_loc = '\0';
                finished = TRUE;
                os_put_queue(REC_FINISHED, NO_BUFFER, tid);
            }
            else
            {
                /* Wait for the receiver to send me some data */
                os_wait_fetch(wait_rec_int, &c, &buf, &bufptr, &dummy1, &dummy2);
                if (buf != NO_BUFFER)
                {
                   os_free_buffer(buf);
...

read more »

 
 
 

1. Connecting C30 Serial port to PC serial port

        Has anyone (is it possible) to connect the serial port of the TI
C30 chip to the serial port of a PC?  As I understand it, there are
compatibility problems, but I'm assumming it can be done, but have little
experience in the area.

        We are using the C30 chip in the real-time board by Spectrum/LSI
to implement a modem and would like to feed/get bits to the C30 via a PC
with a serial connection.  I know I could use the bus of the PC where the
board is currently installed right now, but would rather opt to use the
serial port. Any suggestions would be greatly appreciated!

thanks!

dma

--
begin 600 .signature

2. Epson 1200 Vs. LightJet 5000

3. TMS320C203: Async. serial port

4. Display Problems

5. COM PORT to DSP SERIAL PORT?

6. A processors list !

7. How To Configure HPI of Ti DSP To Serial Port?

8. Does anyone know about Cluster Centre

9. How can I send data from TMS320C50-TI-Starter Kit to PC (serial port)

10. Using TI 6201 signle channel DMA to access serial port

11. TI TMS320C50 DSK Serial Port Communication

12. Serial Ports on TI DSP Chips

13. Need TI tech support for C31 serial port problem