<< Chapter < Page
  Ti dsp/bios lab   Page 1 / 1
Chapter >> Page >
This module is a lab assignment to better understand the TI DSP/BIOS QUE module.

Introduction

This lab module will help you become familiar with the TI DSP/BIOS v5.x QUE module. Code Composer Studio v4 is used in this module.

Reading

  • SPRU423 TMS320 DSP/BIOS Users Guide: Read the section title Queues

Lab module prerequisites

This lab module uses aspects of the TSK and SEM modules.

Laboratory

Part 1

  • In this part you will be creating two TSKs were one will generate some data and send it to the other TSK in a queue. The transmitting TSK will generate 5 messages to send to the receiving TSK which will print out the content of the message.
  • Follow the procedure in Code Composer Studio v4 DSP/BIOS Project to create a new CCS DSP/BIOS project. Your project should have a DSP/BIOS v5.x configuration file using the ti.platforms.sim67xx template (or another appropriate template).
  • Create a LOG object by right clicking on Instrumentation->LOG and selecting Insert LOG. Change the name to trace . Set its properties to have a length of 512 and be a fixed buffer.
  • Change the LOG_system object to have a length of 512.
  • If using the simulator then change the RTDX interface to Simulator by right clicking on Input/Output->RTDX and bringing up the properties. Change the RTDX mode to Simulator. If you do not do this then when you load your program you will see the error RTDX application does not match emulation protocol . If you are loading onto an EVM or DSK you leave the setting on JTAG.
  • Create a QUE object by right clicking on Syncronization->QUE and selecting Insert QUE. This will create a queue called QUE0 . There are no properties to set (unless you want to change the comment).
  • Create two TSKs with the following properties
  • Name: TSK0 , priority: 1, function: _funTSK0 .
  • Name: TSK1 , priority: 1, function: _funTSK1 .
  • On the priority list make sure that TSK0 is first.
  • Create a main.c file and include a main function that does nothing.
  • At the top of main.c make a global structure for your message as follows:
typedef struct MsgObj { QUE_Elem elem; /* first field for QUE */Int val; /* message value */ } MsgObj, *Msg;
  • In the main.c file make functions for your TSKs, funTSK0 and funTSK1 .
  • In funTSK0 , which will generate the data, create a loop that will loop 5 times and in the loop have it:
  1. Allocate memory for a new message
  2. Fill the message value with the message number. Use a command like: "msg->val = ..."
  3. Print to the trace LOG which message is being generated
  4. Put the message on the queue QUE0
  • In funTSK1 , which will receive the data, create a loop that will loop 5 times and in the loop have it:
  1. Check to see if there is a message on the queue and if not then print an error message to the trace LOG and return . This will cause the task to be done running and enter the terminated state.
  2. Get the message from the queue QUE0
  3. Print which message number was read
  4. Free the buffer that was used for the message
  • Start the debug session.
  • Open the log view by selecting Tools->RTA->Printf Logs .
  • Run the program and record the results.
  • Describe in detail the processing that is occurring.

Part 2

  • Change the priority of TSK1 to 2.
  • Start the debug session.
  • Run the program and record the results.
  • How does the execution change? Describe in detail.

Part 3

  • In this part you will be adding a semaphore to synchronize the two tasks using the queue. The semaphore will keep track of how many messages are in the queue.
Setup for Part 3
  • Copy the main.c file from above to a new file main3.c . Remove the main.c from your project and add main3.c .
  • Add a semaphore to your configuration file and call it QUE0_SEM . It should be initialized to 0.
  • Keep the priority of TSK0 set to 1 and TSK1 set to 2.
  • In main3.c change the following:
  1. In funTSK0 after the QUE_put add a SEM_post for QUE0_SEM .
  2. In funTSK1 delete the code that checks to see if there is a message on the queue and replace it with a SEM_pend for QUE0_SEM . Use SYS_FOREVER for the timeout on the pend.
  • Start the debug session.
  • Run the program and record the results.
  • Describe in detail the processing that is occurring.

Part 4

  • Notice that in Part 3 that if the program ran for a long time that the code would have to continually allocate memory for a message and then de-allocate it when it was done using the message. This could take up a substantial amount of time and could cause fragmentation of the memory space. A better method is to have two queues where one queue holds messages that are free and one holds messages that contain data being transmitted from one task to another. In this part you will be adding another queue which will be initialized by adding some free messages to it. Also, another semaphore will be added to track the number of free messages on the free queue.
Setup for Part 4 with a free message queue
  • Copy the main3.c file from above to a new file main4.c . Remove the main3.c from your project and add main4.c .
  • Add another semaphore to your configuration file and call it QUE_Free_SEM . It should be initialized to 0.
  • Create a QUE object and call it QUE_Free .
  • Change the priority of TSK1 to 1 and make sure TSK0 is first in the list.
  • To the main function add code that loops 3 times and adds 3 messages to the queue QUE_Free . You will need to allocate memory for the messages. Be sure to post to QUE_Free_SEM after adding the message to the queue. This will set up the free messages to be used in the program. These messages can then be used and reused without having to allocate and free memory over and over again.
  • In the function funTSK0 delete the code that allocates a message and replace it will code that pends on QUE_Free_SEM and then gets a message from QUE_Free .
  • In the function funTSK1 delete the code that frees the message buffer and replace it will code that puts the message on QUE_Free and then posts to QUE_Free_SEM .
  • Start the debug session.
  • Run the program and record the results.
  • Describe in detail the processing that is occurring.

Questions & Answers

How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Ti dsp/bios lab. OpenStax CNX. Sep 03, 2013 Download for free at http://cnx.org/content/col11265/1.8
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ti dsp/bios lab' conversation and receive update notifications?

Ask