DSPRelated.com
Forums

UART on DSK6713

Started by avin...@gmail.com March 7, 2010
hi all,
I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.

I searched this website and this groupa nd archives but could not find any relevant thread.

Problems-
1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.

2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???

3)When i connect the kit with TRX radio kit, nothing transmission is shown.

I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
I tried a lot, but failed.

also i would appreciate if u give me some info on ISR of EDMA.

I am very new to DSP so need ur help.
Thanx.

_____________________________________
Avinasha-

> hi all,
> I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the
> process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given
> there for EDMA using serial port communication does not give correct output.
>
> I searched this website and this groupa nd archives but could not find any relevant thread.
>
> Problems-
> 1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm
> file.
>
> 2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the
> data in receive buffer is different, though it has to be same.I need to know why it is so???

Basic rule of engineering: before you can know why, you must debug. Here are some questions to get you started:

1) You say your receive data is "different". How so? Bits are shifted? Inverted? (To get help on a tech forum, you
must be specific.)

2) What test patterns have you tried? If you connect your DSK 6713 Tx to Rx (i.e. a loopback) and you send out values
a, b, c, d... then you get back what values?

3) What baud rates have you tried?

-Jeff

> 3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>
> I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
> I tried a lot, but failed.
>
> also i would appreciate if u give me some info on ISR of EDMA.
>
> I am very new to DSP so need ur help.
> Thanx.

_____________________________________
avinashaecwb,

You may also need to read

and the embedded links.
which discuss uart data corruption when using the MCBSP and EDMA.
An item to remember is that the spra633c document is for the c642x and c620x DSPs (fixed point), so there will be minor differences between the code presented in the document and what you will need to write for the C6713(floating point).

As a suggestion..
do not compile the portion of the code that initiates the EDMA nor the DMA.
(to make things as simple as possible)
The determine where your code deviates from the example given in spra633c.

Do be sure to download both the spra633c.pdf document and the spra633c.zip file.
The .zip file contains actual working code for both send and receive, including the proper initialization of the McBSP peripheral for its' use as a UART.

Note:
The McBSP is not a UART, so all the UART functionality (formatting, etc) has to be performed in software.
The actual output will contain a 'prefix' and a 'suffix' that have to be stripped by any device using the data.
Normally, this prefix and suffix are most all '1s so stripping it is relatively easy. Also, the output is a 32 bit-time sequence, not just the usual ~10bits of UART data.

If you cannot get it working, you could try posting the code here. Then we could probably tell you the root problem.

BTW:
the vector macro is near the top of the vecs.asm file.
It has always worked for me. What did you have to change?

I would suggest a debug approach of connecting a logic analyzer to the data+ output of the McBSP and examining the captured data for format and timing correctness.
To do the above, *I* would probably have the program only prepare a single character for transmit, then use some GPIO input (with debounce) as a signal to transmit once.
The 'transmit' trigger signal can then be used to have a very controlled transmit
To make it even easier to debug, I would have the GPIO input signal also be used to trigger the logic analyzer for one capture sequence.

When the above is working correctly and the captured data is looking good, then I would modify the program to transmit a short string, say 3-4 characters and get that working.
Then, you can begin working on the 'wraparound' input.
The communication with the TRX radio would be debugged last, after all the software is working in a multi character wraparound mode.

Note:
just hooking everything up and noticing that it does not work, as expected, is 'mostly' a waste of time.
Each simple step along the way has to work before the 'whole' can be expected to work.
You have got a good start by verifying that the transmit data is correct when written to the TX register.
You should also check that ALL the other McBSP (and related) registers are correct.

How are you wrapping the transmit data to the receive data pins on the McBSP(s)?
Are you using two different McBSPs, one for transmit and one for receive or trying to perform both functions at the same time with only one McBSP?
Are you using the CSL? Which CSL version?

You did read the part in the example code about each McBSP transmit sequence ONLY handles one bit of the byte to be transmitted.
One effect of this is the McBSP will be clocking at a much higher rate than what is expected at the input to the TRX radio.
Does the TRX radio have the ability to decode the output from the McBSP? (there is a lot of data line high time to be discarded by the TRX radio).

R. Williams



---------- Original Message -----------
From: a...@gmail.com
To: c...
Sent: Sun, 07 Mar 2010 11:38:55 -0500
Subject: [c6x] UART on DSK6713

>
>
> hi all,
> I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.
>
> I searched this website and this groupa nd archives but could not find any relevant thread.
>
> Problems-
> 1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.
>
> 2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???
>
> 3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>
> I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
> I tried a lot, but failed.
>
> also i would appreciate if u give me some info on ISR of EDMA.
>
> I am very new to DSP so need ur help.
> Thanx.
------- End of Original Message -------
avinashaecwb,

You might also want to read:

which is the 'problems' errata for the c6713,

R. Williams

---------- Original Message -----------
From: a...@gmail.com
To: c...
Sent: Sun, 07 Mar 2010 11:38:55 -0500
Subject: [c6x] UART on DSK6713

>
>
> hi all,
> I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.
>
> I searched this website and this groupa nd archives but could not find any relevant thread.
>
> Problems-
> 1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.
>
> 2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???
>
> 3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>
> I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
> I tried a lot, but failed.
>
> also i would appreciate if u give me some info on ISR of EDMA.
>
> I am very new to DSP so need ur help.
> Thanx.
hi all,
>I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.
>
>I searched this website and this groupa nd archives but could not find any relevant thread.
>
>Problems-
>1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.
>
>2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???
>
>3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>
>I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
>I tried a lot, but failed.
>
>also i would appreciate if u give me some info on ISR of EDMA.
>
>I am very new to DSP so need ur help.
>Thanx.
>
>_____________________________________
I have tried Baud rates 731, 198,108 (changed in hex)..... but none worked.I transmitted the Bit 'M' and the transmit buffer shows the ones complement data.Why so? I mean why ones complemented data gets stored?? And the receive buffer has some random value, none in any sequence.

In vectors.asm I had to chnge vecs.asm to vecs_edma.asm to make it work.I don't know why.It was just a random debug change and it worked.

Do guide me on Tx and Rx function errors.

_____________________________________
OOps,

The URL should be:


R. Williams

---------- Original Message -----------
From: "Richard Williams"
To: a...@gmail.com, c...
Sent: Sun, 7 Mar 2010 17:02:47 -0700
Subject: Re: [c6x] UART on DSK6713

>
>
> avinashaecwb,
>
> You might also want to read:
>
> which is the 'problems' errata for the c6713,
>
> R. Williams
Avinasha-

>>I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the
>> process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given
>> there for EDMA using serial port communication does not give correct output.
>>
>>I searched this website and this groupa nd archives but could not find any relevant thread.
>>
>>Problems-
>>1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm
>> file.
>>
>>2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the
>> data in receive buffer is different, though it has to be same.I need to know why it is so???
>>
>>3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>>
>>I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
>>I tried a lot, but failed.
>>
>>also i would appreciate if u give me some info on ISR of EDMA.
>>
>>I am very new to DSP so need ur help.
>>Thanx.
>>
>>_____________________________________
> I have tried Baud rates 731, 198,108 (changed in hex)..... but none worked.

I don't get these numbers, they are not any standard baud rates (either dec or hex). Suggest to use something like
1200 baud, then you can use standard PC tools like Hyperterminal to receive and see what you get.

> I transmitted the Bit 'M' and the transmit buffer shows the
> ones complement data.

Man, it's not fun spending even a couple of minutes guess what the heck you mean. You mean character 'M'? What
actual 8-bit value did you try to transmit? Another basic rule of engineering: be precise. You can't solve a
problem if you can't define it.

> Why so? I mean why ones complemented data gets stored?? And the
> receive buffer has some random value, none in any sequence.

Is this with Rx connected to Tx? If so, what actual DSK pins did you wire together?

-Jeff

> In vectors.asm I had to chnge vecs.asm to vecs_edma.asm to make
> it work.I don't know why.It was just a random debug
> change and it worked.
>
> Do guide me on Tx and Rx function errors.

_____________________________________
Yes I transmitted the character M.nd the binary of its ASCII should be
transmitted Wid each bit expanded to 16 bit format.But the value
stored in TX buffer is that of 1's complement of binary of M.I tied
pin 36,41,42 pins of DSK daughtercard peripheral i.e. DX,RX,TX.

On 3/9/10, Jeff Brower wrote:
> Avinasha-
>
>>>I am a new member of this wonderful website.I have been working on
>>> implementation of OFDM on TI's DSK6713 kit.In the
>>> process i need to implement UART using McBSP.For this, i used spra633c
>>> document from TI.But the example code given
>>> there for EDMA using serial port communication does not give correct
>>> output.
>>>
>>>I searched this website and this groupa nd archives but could not find any
>>> relevant thread.
>>>
>>>Problems-
>>>1)When I build it in CCS 3.1 it gives error as 'vector' macro not
>>> found....i resolved it by debugging vectors.asm
>>> file.
>>>
>>>2)Now, the transmit function works properly and the data stored in
>>> transmit buffer is correct(i printed it), but the
>>> data in receive buffer is different, though it has to be same.I need to
>>> know why it is so???
>>>
>>>3)When i connect the kit with TRX radio kit, nothing transmission is
>>> shown.
>>>
>>>I need help on the transmission and receiver part.Plz give me an idea on
>>> how to make it work.
>>>I tried a lot, but failed.
>>>
>>>also i would appreciate if u give me some info on ISR of EDMA.
>>>
>>>I am very new to DSP so need ur help.
>>>Thanx.
>>>
>>>_____________________________________
>>>
>>>
>> I have tried Baud rates 731, 198,108 (changed in hex)..... but none
>> worked.
>
> I don't get these numbers, they are not any standard baud rates (either dec
> or hex). Suggest to use something like
> 1200 baud, then you can use standard PC tools like Hyperterminal to receive
> and see what you get.
>
>> I transmitted the Bit 'M' and the transmit buffer shows the
>> ones complement data.
>
> Man, it's not fun spending even a couple of minutes guess what the heck you
> mean. You mean character 'M'? What
> actual 8-bit value did you try to transmit? Another basic rule of
> engineering: be precise. You can't solve a
> problem if you can't define it.
>
>> Why so? I mean why ones complemented data gets stored?? And the
>> receive buffer has some random value, none in any sequence.
>
> Is this with Rx connected to Tx? If so, what actual DSK pins did you wire
> together?
>
> -Jeff
>
>> In vectors.asm I had to chnge vecs.asm to vecs_edma.asm to make
>> it work.I don't know why.It was just a random debug
>> change and it worked.
>>
>> Do guide me on Tx and Rx function errors.
--
AVINASH JHA

_____________________________________
Avin,

I'm a bit confused by your post.
Why?
because the example does not have a 'vectors.asm' file nor a 'vector' macro.
It does have a 'vecs.asm' file and a 'VEC_ENTRY' macro.

Per my understanding,

a transmit buffer needs to be created for each byte of data to transmit.
the contents of the transmit buffer for each byte are:
0x0000 //start bit(s)
0x(bit 0 of byte to transmit, occurs 4 times
0x(bit 1 of byte to transmit, occurs 4 times)
...
0x(bit 7 of byte to transmit, occurs 4 times)
0xFFFF // 1 stop bit
0xFFFF // 1 stop bit

then wakeup the McBSP transmitter
then enable the frame sync generator for the McBSP
wait for the interrupt flag to indicate the xmit is complete.

this means to transmit one byte of data requires a transmit buffer of size 11 unsigned short int.
I.E. xmitbuffer[11];

also, if your planning on using DMA or EDMA then the buffer needs to be aligned on a 'L2' line boundary.
--this requires cooperation between your program and the contents. of the .cmd file.

All of the above (and much more) is covered, including a code example in the SPRA633c.zip files.

I would strongly suggest downloading the SPRA633c.zip from T.I.,un-zipping it, and using it to learn how to transmit and receive in UART format using the McBSP.

Note:
Please read the spra633c example program for the correct approach to UART communication using the McBSP peripheral.
I think the easiest start would be defining DMA_SUPPORT in the example program.

BTW:
the line:
"printf("String transmitted: %s \n", xmit_msg);"
is not correct.
the transmit does not even start until the line:
"MCBSP_enableFsync(hMcbsp1);"

and is not complete until after the line:
"while (!receive_done || !transmit_done);"

R. Williams

---------- Original Message -----------
From: a...@gmail.com
To: c...
Sent: Mon, 08 Mar 2010 12:09:42 -0500
Subject: [c6x] Re: UART on DSK6713

>
>
> hi all,
> >I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.
> >
> >I searched this website and this groupa nd archives but could not find any relevant thread.
> >
> >Problems-
> >1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.
> >
> >2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???
> >
> >3)When i connect the kit with TRX radio kit, nothing transmission is shown.
> >
> >I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
> >I tried a lot, but failed.
> >
> >also i would appreciate if u give me some info on ISR of EDMA.
> >
> >I am very new to DSP so need ur help.
> >Thanx.
> >
> >_____________________________________
> >
> > I have tried Baud rates 731, 198,108 (changed in hex)..... but none worked.I transmitted the Bit 'M' and the transmit buffer shows the ones complement data.Why so? I mean why ones complemented data gets stored?? And the receive buffer has some random value, none in any sequence.
>
> In vectors.asm I had to chnge vecs.asm to vecs_edma.asm to make it work.I don't know why.It was just a random debug change and it worked.
>
> Do guide me on Tx and Rx function errors.
------- End of Original Message -------
hi all,
>I am a new member of this wonderful website.I have been working on implementation of OFDM on TI's DSK6713 kit.In the process i need to implement UART using McBSP.For this, i used spra633c document from TI.But the example code given there for EDMA using serial port communication does not give correct output.
>
>I searched this website and this groupa nd archives but could not find any relevant thread.
>
>Problems-
>1)When I build it in CCS 3.1 it gives error as 'vector' macro not found....i resolved it by debugging vectors.asm file.
>
>2)Now, the transmit function works properly and the data stored in transmit buffer is correct(i printed it), but the data in receive buffer is different, though it has to be same.I need to know why it is so???
>
>3)When i connect the kit with TRX radio kit, nothing transmission is shown.
>
>I need help on the transmission and receiver part.Plz give me an idea on how to make it work.
>I tried a lot, but failed.
>
>also i would appreciate if u give me some info on ISR of EDMA.
>
>I am very new to DSP so need ur help.
>Thanx.
>
>_____________________________________

After going through all ur replies and suggestions, i made few cahnges in the programme provided in spra633c.My code is given below.......
#define CHIP_6713 1

/* Include files */
#include "xyzcfg.h"
#include
#include
#include
#include
#include
#include

/* Create buffers and aligning them on an L2 cache line boundary. */
#pragma DATA_SECTION(xmitbuf,"xmit_buf");
unsigned short xmitbuf[0x0400];

#pragma DATA_SECTION(recvbuf,"recv_buf");
unsigned short recvbuf[0x0400];

/* Definitions */
#define BUFFER_SIZE 27 /* total number of UART data words */
#define TRUE 1
#define FALSE 0

/* Declare CSL objects */
MCBSP_Handle hMcbsp1; /* handle for McBSP1 */
#if (EDMA_SUPPORT)
EDMA_Handle hEdma14; /* handle for EDMA 14 */
EDMA_Handle hEdma15; /* handle for EDMA 15 */
#endif
/* Global Variables */
volatile int receive_done = TRUE;
volatile int transmit_done = TRUE;
char xmit_msg[BUFFER_SIZE] = "M\n";
char recv_msg[BUFFER_SIZE] = "T\n";

/* Include the vector table to call the IRQ ISRs hookup */
extern far void vectors();

/* Prototypes */
void ConfigMcBSP(void);
void ConfigEDMA(void);
void ConfigDMA(void);
void ProcessTransmitData(void);
void ProcessReceiveData(void);
short VoteLogic(unsigned short);
int CheckTestCase(void);
interrupt void c_int11(void);
interrupt void c_int09(void);
interrupt void c_int08(void);
/*******************************************************************/
/* void main(void) */
/*******************************************************************/
void main(void)
{
int i;
int waittime = 0;
int works = FALSE;

/* initialize the CSL library */
CSL_init();

/* enable NMI and GI */
IRQ_nmiEnable();
IRQ_globalEnable();

/* point to the IRQ vector table */
IRQ_setVecs(vectors);

#if (EDMA_SUPPORT)

/* disable and clear the event interrupt */
IRQ_reset(IRQ_EVT_EDMAINT);

/* clear Parameter RAM of EDMA */
EDMA_clearPram(0x00000000);

#endif

/* process transmit data */
// printf("%d",'M');
//printf("Processing Transmit string...\n");
ProcessTransmitData();
//printf("String transmitted: %s \n", xmit_msg);

#if (EDMA_SUPPORT)

/* Open the EDMA channels - EDMA 14 for transmit, EDMA 15 for receive */
hEdma14 = EDMA_open(EDMA_CHA_XEVT1, EDMA_OPEN_RESET);
hEdma15 = EDMA_open(EDMA_CHA_REVT1, EDMA_OPEN_RESET);

#endif

/* Open the McBSP channel 1 */
hMcbsp1 = MCBSP_open(MCBSP_DEV1, MCBSP_OPEN_RESET);

#if (EDMA_SUPPORT)

/* Configure the EDMA channels */
ConfigEDMA();

/* enable EDMA-CPU interrupt tied to McBSP */
IRQ_enable(IRQ_EVT_EDMAINT);

/* enable EDMA channel interrupt to CPU */
EDMA_intEnable(14);
//EDMA_intEnable(15);

/* Enable EDMA channels */
EDMA_enableChannel(hEdma14);
// EDMA_enableChannel(hEdma15);

#endif

/* Setup for McBSP */
ConfigMcBSP();

/* Start Sample Rate Generator: set /GRST = 1 */
MCBSP_enableSrgr(hMcbsp1);

/* inserted wait time for McBSP to get ready */
for (waittime=0; waittime<0xF; waittime++);

/* Wake up the McBSP as transmitter and receiver */
//MCBSP_enableRcv(hMcbsp1);
MCBSP_enableXmt(hMcbsp1);

/* Enable Frame Sync Generator for McBSP 1: set /FRST = 1 */
// MCBSP_enableFsync(hMcbsp1);

/* To flag an interrupt to the CPU when EDMA transfer/receive is done */
//printf("String transmitted: %s \n", xmit_msg);
// c_int08();
while (!receive_done || !transmit_done);

// puts("hello");
//printf("String transmitted: %s \n", xmit_msg);
//for(i=0;i<';i++)
//printf("%x",xmitbuf[i]);

/* Check to make sure the test case works */
//// works = CheckTestCase();
//// printf("%d",works);
//// if (works != 0) printf("Transmission Error....\n\n");
//// else printf("Received data matched transmitted data!\n\n");

/* process received data */
// printf("Processing Receive string...\n");
MCBSP_enableRcv(hMcbsp1);
EDMA_enableChannel(hEdma15);
MCBSP_enableFsync(hMcbsp1);
ProcessReceiveData();
EDMA_intEnable(15);
//printf("String received: %s \n", recv_msg);

#if (EDMA_SUPPORT)

IRQ_disable(IRQ_EVT_EDMAINT);
EDMA_RSET(CIER, 0x0);

#endif

MCBSP_close(hMcbsp1); /* close McBSP 1 */

#if (EDMA_SUPPORT)

EDMA_close(hEdma14); /* close EDMA 14 */
EDMA_close(hEdma15); /* close EDMA 15 */

#endif

} /* End of main() */

/*******************************************************************/
/* void ConfigEDMA(void): set up EDMA channel 14/15 for UART Xmit */
/*******************************************************************/
#if (EDMA_SUPPORT)

void ConfigEDMA(void)
{
EDMA_configArgs(hEdma14,

/* OPT Setup */
#if (C64_SUPPORT)
EDMA_OPT_RMK(
EDMA_OPT_PRI_HIGH, /* 1 */
EDMA_OPT_ESIZE_16BIT, /* 01 */
EDMA_OPT_2DS_NO, /* 0 */
EDMA_OPT_SUM_INC, /* 01 */
EDMA_OPT_2DD_NO, /* 0 */
EDMA_OPT_DUM_NONE, /* 00 */
EDMA_OPT_TCINT_YES, /* 1 */
EDMA_OPT_TCC_OF(14), /* 14 */
EDMA_OPT_TCCM_DEFAULT, /* 0 */
EDMA_OPT_ATCINT_DEFAULT, /* 0 */
EDMA_OPT_ATCC_DEFAULT, /* 0 */
EDMA_OPT_PDTS_DEFAULT, /* 0 */
EDMA_OPT_PDTD_DEFAULT, /* 0 */
EDMA_OPT_LINK_NO, /* 0 */
EDMA_OPT_FS_NO /* 0 */
),
#else
EDMA_OPT_RMK(
EDMA_OPT_PRI_HIGH, /* 1 */
EDMA_OPT_ESIZE_16BIT, /* 01 */
EDMA_OPT_2DS_NO, /* 0 */
EDMA_OPT_SUM_INC, /* 01 */
EDMA_OPT_2DD_NO, /* 0 */
EDMA_OPT_DUM_NONE, /* 00 */
EDMA_OPT_TCINT_YES, /* 1 */
EDMA_OPT_TCC_OF(14), /* 14 */
EDMA_OPT_LINK_NO, /* 0 */
EDMA_OPT_FS_NO /* 0 */
),
#endif

/* SRC Setup */
EDMA_SRC_RMK((Uint32) xmitbuf), /*xmitbuf address*/

/* CNT Setup */
EDMA_CNT_RMK(
EDMA_CNT_FRMCNT_DEFAULT,
EDMA_CNT_ELECNT_OF(BUFFER_SIZE*11)
),

/* DST Setup */
EDMA_DST_RMK(MCBSP_getXmtAddr(hMcbsp1)),

/* IDX Setup */
EDMA_IDX_RMK(0,0),

/* RLD Setup */
EDMA_RLD_RMK(0,0)
);

EDMA_configArgs(hEdma15,

/* OPT Setup */
#if (C64_SUPPORT)
EDMA_OPT_RMK(
EDMA_OPT_PRI_HIGH, /* 1 */
EDMA_OPT_ESIZE_16BIT, /* 01 */
EDMA_OPT_2DS_NO, /* 0 */
EDMA_OPT_SUM_NONE, /* 00 */
EDMA_OPT_2DD_NO, /* 0 */
EDMA_OPT_DUM_INC, /* 01 */
EDMA_OPT_TCINT_YES, /* 1 */
EDMA_OPT_TCC_OF(15), /* 15 */
EDMA_OPT_TCCM_DEFAULT, /* 0 */
EDMA_OPT_ATCINT_DEFAULT, /* 0 */
EDMA_OPT_ATCC_DEFAULT, /* 0 */
EDMA_OPT_PDTS_DEFAULT, /* 0 */
EDMA_OPT_PDTD_DEFAULT, /* 0 */
EDMA_OPT_LINK_NO, /* 0 */
EDMA_OPT_FS_NO /* 0 */
),
#else
EDMA_OPT_RMK(
EDMA_OPT_PRI_HIGH, /* 1 */
EDMA_OPT_ESIZE_16BIT, /* 01 */
EDMA_OPT_2DS_NO, /* 0 */
EDMA_OPT_SUM_NONE, /* 00 */
EDMA_OPT_2DD_NO, /* 0 */
EDMA_OPT_DUM_INC, /* 01 */
EDMA_OPT_TCINT_YES, /* 1 */
EDMA_OPT_TCC_OF(15), /* 15 */
EDMA_OPT_LINK_NO, /* 0 */
EDMA_OPT_FS_NO /* 0 */
),
#endif

/* SRC Setup */
EDMA_SRC_RMK(MCBSP_getRcvAddr(hMcbsp1)),

/* CNT Setup */
EDMA_CNT_RMK(0, (BUFFER_SIZE * 11)),

/* DST Setup */
EDMA_DST_RMK((Uint32) recvbuf), /*recvbuf address*/

/* IDX Setup */
EDMA_IDX_RMK(0,0),

/* RLD Setup */
EDMA_RLD_RMK(0,0)
);

} /* End of ConfigEDMA() */

#endif

/*******************************************************************/
/* void ConfigMcBSP(void): Setup for McBSP Configuration */
/*******************************************************************/
void ConfigMcBSP(void)
{

MCBSP_Config mcbspCfg1 = {

/* SPCR Setup */

#if (EDMA_SUPPORT)
MCBSP_SPCR_RMK(
MCBSP_SPCR_FREE_YES, /* 1 */
MCBSP_SPCR_SOFT_DEFAULT, /* 0 */
MCBSP_SPCR_FRST_DEFAULT, /* 0 */
MCBSP_SPCR_GRST_DEFAULT, /* 0 */
MCBSP_SPCR_XINTM_XRDY, /* 00 */
MCBSP_SPCR_XSYNCERR_DEFAULT, /* 0 */
MCBSP_SPCR_XRST_DEFAULT, /* 0 */
MCBSP_SPCR_DLB_OFF, /* 0 */
MCBSP_SPCR_RJUST_RZF, /* 00 */
MCBSP_SPCR_CLKSTP_DISABLE, /* 0 */
MCBSP_SPCR_DXENA_OFF, /* 0 */
MCBSP_SPCR_RINTM_RRDY, /* 00 */
MCBSP_SPCR_RSYNCERR_DEFAULT, /* 0 */
MCBSP_SPCR_RRST_DEFAULT /* 0 */
),
#endif

/* RCR Setup */

#if (EDMA_SUPPORT)
MCBSP_RCR_RMK(
MCBSP_RCR_RPHASE_DUAL, /* 1 */
MCBSP_RCR_RFRLEN2_OF(1), /* 00010 */
MCBSP_RCR_RWDLEN2_8BIT, /* 000 */
MCBSP_RCR_RCOMPAND_MSB, /* 00 */
MCBSP_RCR_RFIG_YES, /* 1 */
MCBSP_RCR_RDATDLY_1BIT, /* 01 */
MCBSP_RCR_RFRLEN1_OF(8), /* 01000 */
MCBSP_RCR_RWDLEN1_16BIT, /* 010 */
MCBSP_RCR_RWDREVRS_DISABLE /* 0 */
),
#endif

/* XCR Setup */

#if (EDMA_SUPPORT)
MCBSP_XCR_RMK(
MCBSP_XCR_XPHASE_DUAL, /* 1 */
MCBSP_XCR_XFRLEN2_OF(1), /* 00010 */
MCBSP_XCR_XWDLEN2_8BIT, /* 000 */
MCBSP_XCR_XCOMPAND_MSB, /* 00 */
MCBSP_XCR_XFIG_YES, /* 1 */
MCBSP_XCR_XDATDLY_0BIT, /* 00 */
MCBSP_XCR_XFRLEN1_OF(8), /* 01000 */
MCBSP_XCR_XWDLEN1_16BIT, /* 010 */
MCBSP_XCR_XWDREVRS_DISABLE /* 0 */
),
#endif

/* SRGR Setup */
MCBSP_SRGR_RMK(
MCBSP_SRGR_GSYNC_FREE, /* 0 */
MCBSP_SRGR_CLKSP_RISING, /* 0 */
MCBSP_SRGR_CLKSM_INTERNAL, /* 1 */
MCBSP_SRGR_FSGM_DXR2XSR, /* 0 */
MCBSP_SRGR_FPER_DEFAULT, /* 0 */
MCBSP_SRGR_FWID_DEFAULT, /* 0 */
// MCBSP_SRGR_CLKGDV_OF(40) /* CLKGDV */
MCBSP_SRGR_CLKGDV_OF(1200) /* CLKGDV */
),

/* MCR Setup */
MCBSP_MCR_DEFAULT, /* default values */

/* RCER Setup */
#if (C64_SUPPORT)
MCBSP_RCERE0_DEFAULT,
MCBSP_RCERE1_DEFAULT,
MCBSP_RCERE2_DEFAULT,
MCBSP_RCERE3_DEFAULT,
#else
MCBSP_RCER_DEFAULT, /* default values */
#endif

/* XCER Setup */
#if (C64_SUPPORT)
MCBSP_XCERE0_DEFAULT,
MCBSP_XCERE1_DEFAULT,
MCBSP_XCERE2_DEFAULT,
MCBSP_XCERE3_DEFAULT,
#else
MCBSP_XCER_DEFAULT, /* default values */
#endif

/* PCR Setup */
MCBSP_PCR_RMK(
MCBSP_PCR_XIOEN_SP, /* 0 */
MCBSP_PCR_RIOEN_SP, /* 0 */
MCBSP_PCR_FSXM_INTERNAL, /* 1 */
MCBSP_PCR_FSRM_EXTERNAL, /* 0 */
MCBSP_PCR_CLKXM_OUTPUT, /* 1 */
MCBSP_PCR_CLKRM_OUTPUT, /* 1 */
MCBSP_PCR_CLKSSTAT_0, /* 0 */
MCBSP_PCR_DXSTAT_0, /* 0 */
MCBSP_PCR_FSXP_ACTIVELOW, /* 1 */
MCBSP_PCR_FSRP_ACTIVELOW, /* 1 */
MCBSP_PCR_CLKXP_RISING, /* 0 */
MCBSP_PCR_CLKRP_FALLING /* 0 */
)
};

MCBSP_config(hMcbsp1, &mcbspCfg1);

} /* end of Config_McBSP(void) */

/*******************************************************************/
/* void ProcessTransmitData(void) */
/* */
/* This function expands each of the 8-bit ASCII characters in the */
/* transmit string "xmit_msg" into UART transmission 16-bit word */
/* and place them in the transmit buffer "xmitbuf". In addition, */
/* 16-bit Start and 8-bit Stop framing words, respectively, are */
/* inserted before and after each of the ASCII characters in the */
/* buffer. */
/*******************************************************************/
void ProcessTransmitData(void)
{
int i;
short cnt = 1;
unsigned char xmit_char;
unsigned short *xmitbufptr;

/* point to Transmit Buffer */
xmitbufptr = (unsigned short *)xmitbuf;

for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)
{
xmitbufptr[i] = 0x0000; /* zero fill buffer */
}

xmitbufptr = (unsigned short *)xmitbuf;

/* Process data BYTES in xmit_msg[] and put in xmit buffer */
for (i = 0; i < BUFFER_SIZE; i++)
{
/*Get transmit character (one byte) from xmit_msg[] and put in xmit buffer*/
xmit_char = xmit_msg[i];

/* Process each BYTE of transmit character */
for (cnt = -1; cnt < 10; cnt++)
{
if (cnt == -1)
{
*xmitbufptr++ = 0x0000;
MCBSP_write(hMcbsp1,0x00000000);
}
else if (cnt == 8 || cnt ==9)
{
*xmitbufptr++ = 0xFFFF;
MCBSP_write(hMcbsp1,0xFFFFFFFF);
}
else if (xmit_char & (1 << cnt))
{
*xmitbufptr++ = 0xFFFF;
MCBSP_write(hMcbsp1,0xFFFFFFFF);
}
else
{
*xmitbufptr++ = 0x0000;
MCBSP_write(hMcbsp1,0x00000000);
}
} /* end for cnt */
//MCBSP_write(hMcbsp1,xmit_char);

} /* end for i*/

for(i=0;i<';i++);
//printf("%x\n",xmitbuf[i]);

} /* end ProcessTransmitData */
/*******************************************************************/
/* void ProcessReceiveData(void) */
/* */
/* This function decodes the data in the receive buffer, "recvbuf" */
/* and strips the framing start (0x0000) and Stop (0xFFFF) words. */
/* It calls the subroutine VoteLogic() to determine each bit of */
/* the ASCII character. It then puts the result in recv_msg. */
/*******************************************************************/
void ProcessReceiveData(void)
{
int i;
unsigned char recv_char = 0;
short cnt = -1;
short recv_val;
unsigned short raw_data;
unsigned short *recvbufptr; /*receive buffer pointer*/

/* Point to the receive buffer */
recvbufptr = (unsigned short *)recvbuf;

/* for(i=0;i<27;i++)
{
MCBSP_read(hMcbsp1);
if(xmitbuf[i]==recvbuf[i])
// printf("\nequal");
else
// printf("\n%d",i);
}*/
//for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)
// {
// printf("%x\n",recvbuf[i]);
// }

/* Process all data in the Receive buffer */
for (i = 0; i < BUFFER_SIZE; i++)
{
recv_char = 0;

/* Process each UART frame */
for (cnt = -1; cnt < 10; cnt++)
{
if(cnt == -1 || cnt == 8 || cnt == 9)
{
/* Ignore Start and Stop bits */
*recvbufptr++;
}
else
{
/* Get 16-bit data from receive buffer */
raw_data = *recvbufptr;
recvbufptr++;

/* get the value of the majority of the bits */
recv_val = VoteLogic(raw_data);

/* put received bit into proper place */
recv_char += recv_val << cnt;
}
} /* end for cnt */

/* A full BYTE is decoded. Put in result: recv_msg[i] */
recv_msg[i] = recv_char;
// printf("\n%s",recv_msg);

} /* end for i */

} /* end ProcessReceiveData() function */
/*******************************************************************/
/* void CheckTestCase(void) */
/*******************************************************************/
int CheckTestCase(void)
{
unsigned short *source;
unsigned short *result;
unsigned int i = 0;
short cnt = -1;
int error = 0;

source = (unsigned short *) xmitbuf;
result = (unsigned short *) recvbuf;

for (i = 0; i < BUFFER_SIZE ; i++)
{
for (cnt = -1; cnt < 10; cnt++)
{
/* Ignore the start and stop bits */
if(cnt == -1 || cnt == 8 || cnt ==9)
{
source++;
result++;
}
else
{
if (*source != *result)
{
error = i + 1;
break;
}
source++;
result++;
}
}
}
//printf("%d",error);

return(error);

} /* end CheckTestCase() function */
/*******************************************************************/
/* short VoteLogic(unsigned short) */
/* */
/* This function decoded the received character by testing the */
/* center 4 bits of the baud. A majority rule is used for the */
/* decoding. */
/*******************************************************************/
short VoteLogic(unsigned short value)
{
short returnvalue;

switch ((value >> 6) & 0x0F)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 8:
case 9:
case 10:
returnvalue = 0;
break;
case 7:
case 11:
case 12:
case 13:
case 14:
case 15:
returnvalue = 1 ;
break;
} /* end switch */

return (returnvalue);

} /* end VoteLogic() funciton */
/*******************************************************************/
/* EDMA Data Transfer Completion ISRs */
/*******************************************************************/

interrupt void c_int11(void) /* DMA 2 */
{
#if (DMA_SUPPORT)
transmit_done = TRUE;
// printf("Transmit Completed\n");
#endif
}

interrupt void c_int09(void) /* DMA 1 */
{
#if (DMA_SUPPORT)
receive_done = TRUE;
// printf("Receive Completed\n");
#endif
}
interrupt void c_int08(void)
{
#if (EDMA_SUPPORT)
if (EDMA_intTest(14))
{
EDMA_intClear(14);
transmit_done = TRUE;
// printf("Transmit Completed\n");
}

if (EDMA_intTest(15))
{
EDMA_intClear(15);
receive_done = TRUE;
//printf("Receive Completed\n\n");
}
#endif
}

.................................

Now when i run this programme, the value stored in the xmitbuf(transmit buffer)gets printed. Now as we have aligned the xmitbuf and recvbuf, so the data in recvbuf should also be similar, but when i print recvbuf values, they are completely differnt. They do not follow any pattern and give a garbage value at each execution of programme.

Plz chk the code and help me to find teh error.why the data in xmitbuf and recvbuf are different?

Also, the data getting transnitted i.e. 'M' was read using a hyper terminal TRS kit,baud rate 19200, but the screen didn't show 'M', it printed something unrecognizabe like ASCII characters.
Why??

_____________________________________