<< Chapter < Page Chapter >> Page >
Explains how to send and receive data with the DSP through the USB port using RTDX. Example code is shown in C as well as MATLAB for interfacing on the PC. Some example code for creating a MATLAB GUI is also shown.

Introduction

The USB port on the DSP box can also be used to transmit data between the DSP and the PC during real-time operation. Texas Instruments came up with Real Time Data Exchange (RTDX) to allow users real-time bidirectional exchange of data between the target and host. This allows the simulation of data input and output which can be used as feedback from the DSP for a variety of applications. Both input and output data are buffered until read, allowing transmission of larger amounts of data.

Setting up input/output channels

The RTDX works by setting up input and output channels to the DSP. RTDX functionality is supplied through the include file rtdx.h so be sure it is included in your main.c and any other files that use rtdx functions.

Depending on whether there will be input and/or output from the computer in your project, add input and output channels in the main.c file using the commands. These are declared like global variables near the top of the code after the include files. They do NOT go in the main() function or any other function.

RTDX_CreateInputChannel(ichan); RTDX_CreateOutputChannel(ochan);

By default, these channels are disabled on the DSP. You may enable them in the main loop so that they will be enabled for the duration of the program. This can be accomplished with the following instructions:

RTDX_enableInput(&ichan); RTDX_enableOutput(&ochan);

In other C files that utilize the declared input and output channels, you will need to declare the input and output channels again with an extern so that your files know what the variables are.

extern RTDX_input_channel ichan; extern RTDX_output_channel ochan;

Lastly, RTDX MUST be manually enabled on the DSP boards. Go to Tools->RTDX->Configuration Control and select 'Enable RTDX' in the window that opens. Another helpful window for debugging is the 'Channel Viewer Control' accessed through Tools->RTDX->Configuration Control . This window displays the number of completed and outstanding transfers between computer and board.

Using the dsp to access the usb port

The data buffer can be written to in C, but requires the block method of input/output used in Lab 4 and Lab 5 . The sample-by-sample method used in Labs 1 through 3 will not work with RTDX. RTDX functionality is supplied through the include file rtdx.h so be sure it is included in your main.c file and any other files that use rtdx functions.

Using c to send/receive

There are several functions for transmitting and receiving data within the C environment:

  • RTDX_readNB() takes three arguments: the first is a pointer to the input channel, the second is a pointer to the variable in which to store read data, and the third is the number of bytes to read. This is a non-blocking read, meaning if no data is available to be read, it will merely return. However, there will then be an outstanding read and the variable will be updated when some data is finally read. It returns 'RTDX_OK' on success, '0' on failure (the target buffer is full), and 'RTDX_READ_ERROR' when the channel is currently busy reading.
  • RTDX_read() also takes three inputs like RTDX_readNB() and but on successful read, it returns the number of bytes of data actually in the buffer. The difference from RTDX_readNB() is it's a blocking read, meaning RTDX_read() won't return until something is read. If the channel is busy or not enabled, 'RTDX_READ_ERROR' will be returned.
  • RTDX_write() takes three arguments: the first is the pointer to the output channel, the second is a pointer to the buffer containing the data to write, and the third is the size of the buffer in bytes. It returns an integer, non-zero on success and '0' on failure.
  • RTDX_sizeofInput() takes a pointer to an input channel and returns the number of bytes of data actually read from the buffer. It is used in conjunction with RTDX_readNB() after a read operation is completed.
  • RTDX_channelBusy() takes a pointer to an input channel and returns an int indicating the status of the channel. A return of '0' means the channel is not busy while non-zero means the channel is busy. This is usually used in conjunction with RTDX_readNB() to check if another read request needs to be issued.

Questions & Answers

what is microbiology
Agebe Reply
What is a cell
Odelana Reply
what is cell
Mohammed
how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing laboratory (ece 420 55x). OpenStax CNX. Jan 18, 2010 Download for free at http://cnx.org/content/col10397/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420 55x)' conversation and receive update notifications?

Ask