Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560

Sponsor

Evaluate multicore with Texas Instruments:
Low-cost evaluation module & free software development kit available NOW.

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C6x | UART on DSK6713

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

UART on DSK6713 - avin...@gmail.com - Mar 7 12:10:27 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.

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - Jeff Brower - Mar 7 15:20:25 2010

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.

_____________________________________

______________________________
StarterWare provides C-based no-OS platform support for the C6000 DSP devices.
Click here for details.




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - Richard Williams - Mar 7 19:28:52 2010

avinashaecwb,

You may also need to read
<http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/112/t/1135
9.aspx>
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...@yahoogroups.com 
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 -------

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - Richard Williams - Mar 7 19:29:02 2010

avinashaecwb,

You might also want to read:
<ttp://focus.ti.com/lit/er/sprz191j/sprz191j.pdf>
which is the 'problems' errata for the c6713,

R. Williams

---------- Original Message -----------
From: a...@gmail.com 
To: c...@yahoogroups.com 
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.

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 8 13:47:36 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.
>
>_____________________________________
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.

_____________________________________





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - Richard Williams - Mar 8 13:53:43 2010

OOps,

The URL should be:
<http://focus.ti.com/lit/er/sprz191j/sprz191j.pdf>

R. Williams

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

>  
> 
> avinashaecwb,
> 
> You might also want to read:
> <ttp://focus.ti.com/lit/er/sprz191j/sprz191j.pdf>
> which is the 'problems' errata for the c6713,
> 
> R. Williams
<snip>

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Jeff Brower - Mar 8 14:28:42 2010

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.

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - avinash jha - Mar 8 16:06:48 2010

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 <j...@signalogic.com> 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

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Mar 9 2:06:43 2010

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...@yahoogroups.com 
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 -------





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 19 19:00:36 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.
>
>_____________________________________

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 <csl.h>   
#include <csl_mcbsp.h>
#include <csl_edma.h> 
#include <csl_dma.h>
#include <csl_irq.h> 
#include <stdio.h>

/* 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<=27;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<=27;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??

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Jeff Brower - Mar 20 0:52:28 2010

Avinash-

> 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??

A few comments:

1) First, suggest to focus only on receiving with HyperTerminal.  I suggested
this before, but seems like you insist
to try the whole loopback.  There is a saying:  before you can walk, you must
crawl.

2) How do you know the baud rate should be 19200?  Did you verify on a dig
scope?  Suggest to try several rates in
HyperTerminal, see if you get something that makes sense.

3) For desired 19200 baud rate, using the formula on pg 5 of spra633c, I get a
CLKGDV value of 732.  Why are you using
1200?  At what clock rate is your DSK 6713 board running?  You should know this
value.

4) Your output test string is not actually 'M'.  It is 'M' followed by a CR and
LF.  I hope you can figure out what I
mean.

5) Related to 4) above, your output message buffer won't have 27 copies of 'M'.

6) This line:

  for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)

will clear only 1/4 of your output buffer.  Again, hope you can figure out why.

The good news is that you seem to get something on HyperTerminal, so that's a
start and you should be able to build on
that.  Each time you run your DSP program, suggest to restart HyperTerminal
first.  I know that's tedious, but it
prevents any left over artifacts in HyperTerminal, which is not known to be the
most reliable program (you might look
up something called Tera Term).

Let us know when you can receive on HyperTerminal a character that makes sense.

-Jeff
> 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 <csl.h>
> #include <csl_mcbsp.h>
> #include <csl_edma.h>
> #include <csl_dma.h>
> #include <csl_irq.h>
> #include <stdio.h> /* 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<=27;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<=27;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??

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Jeff Brower - Mar 20 12:02:13 2010

Avinash-

> Actually when i started working i tested only transmission part.
> The receiver part was inactive.Also i had tried using different
> Baud rates.like for 19200, i wrote CLKGDV as 732 (instead of
> 1200, an error crept in while pasting here).The hyper terminal
> showed output but with breaks.Even then the output was absurd.
> I tried different baud rates then like 2400, 1200, etc. but no
> use. Output comes but unrecognizable.

This is where you have to do the debug work.  You need to measure with dig scope
and see *why* HyperTerminal gets the
wrong char.  You say "unrecognizable" but actually there may be many
clues in the data HyperTerminal receives.  Is
there a start bit problem?  Too many stop bits?  You're training to be an
engineer, you have to figure this out.  You
can't say "output is absurd" and then give up.  That's very wimpy,
pardon my choice of words.

> Also, i must state that the baud rate of 19200 is in accordance with my
> DSK6713 clock rate.

That comment doesn't make sense.  How can a DSP clock rate and an RS-232 baud
rate be "in accordance"?  There is no
relationship between the two.

> And i again repeat, my primary concern is why isn't the data
> in xmitbuf and recvbuf similar when both arre at same mem
> location??Do calrify this.

At this point, loopback is *not* your primary concern.  First you have to get
transmit working; it's easier to debug. 
Then you can both transmit and receive.

Maybe someone else on the group will chime in here and help convince you to
apply proper debug procedures.

-Jeff
> On Sat, Mar 20, 2010 at 11:21 AM, Jeff Brower
<j...@signalogic.com>wrote:
>
>> Avinash-
>>
>> > 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??
>>
>> A few comments:
>>
>> 1) First, suggest to focus only on receiving with HyperTerminal.  I
>> suggested this before, but seems like you insist
>> to try the whole loopback.  There is a saying:  before you can walk,
you
>> must crawl.
>>
>> 2) How do you know the baud rate should be 19200?  Did you verify on a
dig
>> scope?  Suggest to try several rates in
>> HyperTerminal, see if you get something that makes sense.
>>
>> 3) For desired 19200 baud rate, using the formula on pg 5 of spra633c,
I
>> get a CLKGDV value of 732.  Why are you using
>> 1200?  At what clock rate is your DSK 6713 board running?  You should
know
>> this value.
>>
>> 4) Your output test string is not actually 'M'.  It is 'M' followed by
a CR
>> and LF.  I hope you can figure out what I
>> mean.
>>
>> 5) Related to 4) above, your output message buffer won't have 27 copies
of
>> 'M'.
>>
>> 6) This line:
>>
>>  for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)
>>
>> will clear only 1/4 of your output buffer.  Again, hope you can figure
out
>> why.
>>
>> The good news is that you seem to get something on HyperTerminal, so
that's
>> a start and you should be able to build on
>> that.  Each time you run your DSP program, suggest to restart
HyperTerminal
>> first.  I know that's tedious, but it
>> prevents any left over artifacts in HyperTerminal, which is not known
to be
>> the most reliable program (you might look
>> up something called Tera Term).
>>
>> Let us know when you can receive on HyperTerminal a character that
makes
>> sense.
>>
>> -Jeff
>> > 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 <csl.h>
>> > #include <csl_mcbsp.h>
>> > #include <csl_edma.h>
>> > #include <csl_dma.h>
>> > #include <csl_irq.h>
>> > #include <stdio.h>
>> >
>> > /* 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<=27;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<=27;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??
> --
> AVINASH JHA
>

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 20 18:04:19 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.
>
>_____________________________________
..................................................
Jeff,
With baud rate of 1200,the whole screen of HyperTerminal gets filled with the
ASCII code for 239.With Baud rate as 19200, i get a series of figures which
comprise values for ASCII from 128 to 240, each time a new sequence. Thus, i
said unrecognizable.I understand it is tedious for u to solve my problems, but i
am doing this project in a government research institute which allows me to work
only 2 days a week.So i don't have access to the exact output sequence.I will
debug the way u told and next time will be more specific.
Thanx.

and George HyperTerminal works fine with other applications, so problem is in
the code i think. 

_____________________________________

______________________________
StarterWare provides C-based no-OS platform support for the C6000 DSP devices.
Click here for details.




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - George Wicks - Mar 20 18:04:42 2010

Jeff is absolutely right here: you have to do the debug work. You are 
the one that can make this work or not.

Some humble suggestions:

The 6713 UART application note program is fairly involved. No disrespect 
meant, but have you tried say another PC workstation to transfer data 
back and forth with the workstation that you are using? That actually 
removes the 6713 from the "equation" - but that sounds like something

you would want to do as step 1. You don't even need a secondary 
workstation, provided you have more than one COM port on your machine. 
Use a NULL modem cable going from one COM port to the other COM port. 
Then, have application thread (an instance of Hyperterminal, or some 
other windows based application) generate a send an established pattern 
(could be something simple like "0123456789" or "abcdefgh"
or whatever) 
and then call Hyperterminal on the other COM port to receive.

Then check:
* Are you getting in what you send out?
* If not, recheck your applications used to insure that they have the 
same baud rate, stop bits, start bits 8 or 7 bits, etc. If those aren't 
right, adjust and retry. (also check flow control settings, hardware or 
software control).
* By the way, if any of the terms I brought up sound unfamiliar to you, 
it would probably be a good idea to do some research on serial 
communications.
* If after you've checked your settings, etc., and it still doesn't 
work, get another NULL modem cable. Try it.
* If that still doesn't work, you have several options here: (a). a 
single loopback "plug", where pins 2 and 3 are tied together; (b). or

use another workstation to transmit and/or receive.

What I'm suggesting above is just to help you insure that your 
workstation and your serial port are functioning fine. No, it is not 
uncommon to have a serial card go bad - I've had that happen to me 
before, and I had to go through this whole process of elimination (which 
is at the heart and core of the whole debugging process).

You need to understand that debugging is a skill that is developed over 
time and experience, and that if you develop a good spirit of inquiry 
you'll get much further than allowing frustration to settle in. You need 
to go from saying "I'm getting output that is absurd" to where you are

saying (for example) "I'm sending out a character '0', which is hex 
0x30, but I'm receiving a character "1", which is hex 0x31 - hmmm,
it's 
setting the LSB high - I wonder why???" - when that happens you are 
developing much better debugging skills.

I hope this helps - Good Luck

George
On 03/20/2010 01:01 PM, Jeff Brower wrote:
>
> Avinash-
>
> > Actually when i started working i tested only transmission part.
> > The receiver part was inactive.Also i had tried using different
> > Baud rates.like for 19200, i wrote CLKGDV as 732 (instead of
> > 1200, an error crept in while pasting here).The hyper terminal
> > showed output but with breaks.Even then the output was absurd.
> > I tried different baud rates then like 2400, 1200, etc. but no
> > use. Output comes but unrecognizable.
>
> This is where you have to do the debug work. You need to measure with 
> dig scope and see *why* HyperTerminal gets the
> wrong char. You say "unrecognizable" but actually there may be
many 
> clues in the data HyperTerminal receives. Is
> there a start bit problem? Too many stop bits? You're training to be 
> an engineer, you have to figure this out. You
> can't say "output is absurd" and then give up. That's very wimpy,

> pardon my choice of words.
>
> > Also, i must state that the baud rate of 19200 is in accordance with
my
> > DSK6713 clock rate.
>
> That comment doesn't make sense. How can a DSP clock rate and an 
> RS-232 baud rate be "in accordance"? There is no
> relationship between the two.
>
> > And i again repeat, my primary concern is why isn't the data
> > in xmitbuf and recvbuf similar when both arre at same mem
> > location??Do calrify this.
>
> At this point, loopback is *not* your primary concern. First you have 
> to get transmit working; it's easier to debug.
> Then you can both transmit and receive.
>
> Maybe someone else on the group will chime in here and help convince 
> you to apply proper debug procedures.
>
> -Jeff
>
> > On Sat, Mar 20, 2010 at 11:21 AM, Jeff Brower 
> <j...@signalogic.com <mailto:jbrower%40signalogic.com>>wrote:
> >
> >> Avinash-
> >>
> >> > 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??
> >>
> >> A few comments:
> >>
> >> 1) First, suggest to focus only on receiving with HyperTerminal.
I
> >> suggested this before, but seems like you insist
> >> to try the whole loopback. There is a saying: before you can walk,
you
> >> must crawl.
> >>
> >> 2) How do you know the baud rate should be 19200? Did you verify
on 
> a dig
> >> scope? Suggest to try several rates in
> >> HyperTerminal, see if you get something that makes sense.
> >>
> >> 3) For desired 19200 baud rate, using the formula on pg 5 of 
> spra633c, I
> >> get a CLKGDV value of 732. Why are you using
> >> 1200? At what clock rate is your DSK 6713 board running? You
should 
> know
> >> this value.
> >>
> >> 4) Your output test string is not actually 'M'. It is 'M' followed

> by a CR
> >> and LF. I hope you can figure out what I
> >> mean.
> >>
> >> 5) Related to 4) above, your output message buffer won't have 27 
> copies of
> >> 'M'.
> >>
> >> 6) This line:
> >>
> >> for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)
> >>
> >> will clear only 1/4 of your output buffer. Again, hope you can 
> figure out
> >> why.
> >>
> >> The good news is that you seem to get something on HyperTerminal,

> so that's
> >> a start and you should be able to build on
> >> that. Each time you run your DSP program, suggest to restart 
> HyperTerminal
> >> first. I know that's tedious, but it
> >> prevents any left over artifacts in HyperTerminal, which is not 
> known to be
> >> the most reliable program (you might look
> >> up something called Tera Term).
> >>
> >> Let us know when you can receive on HyperTerminal a character that

> makes
> >> sense.
> >>
> >> -Jeff
> >>
> >>
> >> > 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 <csl.h>
> >> > #include <csl_mcbsp.h>
> >> > #include <csl_edma.h>
> >> > #include <csl_dma.h>
> >> > #include <csl_irq.h>
> >> > #include <stdio.h>
> >> >
> >> > /* 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<=27;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<=27;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??
> >>
> >>
> >
> >
> > --
> > AVINASH JHA
> > 
______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 23 8:27:18 2010

hi,
i am trying all the ways, but am not able to do it.the data shown in Recvbuf is
correct i.e. 16 bit extended form of each bit of the 8 bit ASCII code. But the
data in recvbuf is completey random.On each run, data in recvbuf changes.My
steps in programme are -

1) connected pin 35,36,41,42 on 6713 together.
2) the programme. forst transmit data.
3)enable handles and channnel for McBsp and edma.
4)enable xmt and recv for hMcBSP1
5)enable Fsync.
6)interrup the CPU if transmit done.
7chk if recv buf and transmitbif are equal .
8)change the recv data back in ASCII form.

but the data in recv buf is random.Plz sort this out.

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.
>
>_____________________________________

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 24 2:28:22 2010

In the code given few posts above....when i diasble the
while(!receive_done|| !transmit_done); statement along with disabling the
EDMA_intEnable(14);and EDMA_intEnable(15); the code works fine. 

Can u provide me any help on which command line calls the interrupt
c_int(08).Even when i don't call it, it gets called.

And out EDMA_intEnable(14); or EDMA_Fsync() or EDMA_enable, or EDMA_Xmit(); or
EDMA_Rcv commands does any has the function to clear the buffer when it's
called???

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.
>
>_____________________________________

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Bernhard 'Gustl' Bauer - Mar 24 9:38:09 2010

a...@gmail.com schrieb:
> Can u provide me any help on which command line calls the interrupt 
> c_int(08).Even when i don't call it, it gets called.

I have not been through your code - it is just to much information to 
process.

AFAIR when I have been doing something similar c_int08 may be called by 
the end of an EDMA transfer.

HTH

Gustl

_____________________________________

______________________________
StarterWare provides C-based no-OS platform support for the C6000 DSP devices.
Click here for details.




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Mar 24 23:51:11 2010

Avinash,

I noticed that your sizing of the transmit and receive buffers, 
(on which you used a #pragma to give a 'name' that the .cmd file would
recognize)
are each 1k in size.
This seems a bit odd as your working buffers are only 27 in size.

A couple of questions?
1) exactly what '-D' names have you defined in the project build options?
2) have you looked at the output data bits via an oscilloscope or logic analyzer
to see what is actually being output? 
3) have you looked at the output data bits via an oscilloscope or logic analyzer
to see exactly what the timing of the bits are?

To Me, #2 and #3 questions are needed to be answered before proceeding with
anything else.

BTW:
1)according to your posted code, the McBSP receiver is not enabled during the
transmit cycle, so anything in the receive buffer will always be junk.
2)do you have the 'echo' turned off in the Hyperterminal?
(it should be off as a previous statement of yours is that the input<->
output pins of the McBSP are shorted together.)

One final detail.
The transmit and receive buffers in L1 should be on separate L1 lines, not (as
you stated) on the same L1 line.

R. Williams

---------- Original Message -----------
From: "Jeff Brower" <j...@signalogic.com> 
To: "Avinash Jha" <a...@gmail.com> 
Cc: c...@yahoogroups.com 
Sent: Sat, 20 Mar 2010 11:01:43 -0600 (CST) 
Subject: Re: [c6x] Re: UART on DSK6713

>  
> 
> Avinash-
> 
> > Actually when i started working i tested only transmission part.
> > The receiver part was inactive.Also i had tried using different
> > Baud rates.like for 19200, i wrote CLKGDV as 732 (instead of
> > 1200, an error crept in while pasting here).The hyper terminal
> > showed output but with breaks.Even then the output was absurd.
> > I tried different baud rates then like 2400, 1200, etc. but no
> > use. Output comes but unrecognizable.
> 
> This is where you have to do the debug work. You need to measure with dig
scope and see *why* HyperTerminal gets the
> wrong char. You say "unrecognizable" but actually there may be
many clues in the data HyperTerminal receives. Is
> there a start bit problem? Too many stop bits? You're training to be an
engineer, you have to figure this out. You
> can't say "output is absurd" and then give up. That's very wimpy,
pardon my choice of words.
> 
> > Also, i must state that the baud rate of 19200 is in accordance with
my
> > DSK6713 clock rate.
> 
> That comment doesn't make sense. How can a DSP clock rate and an RS-232
baud rate be "in accordance"? There is no
> relationship between the two.
> 
> > And i again repeat, my primary concern is why isn't the data
> > in xmitbuf and recvbuf similar when both arre at same mem
> > location??Do calrify this.
> 
> At this point, loopback is *not* your primary concern. First you have to
get transmit working; it's easier to debug. 
> Then you can both transmit and receive.
> 
> Maybe someone else on the group will chime in here and help convince you to
apply proper debug procedures.
> 
> -Jeff
> 
> > On Sat, Mar 20, 2010 at 11:21 AM, Jeff Brower
<j...@signalogic.com>wrote:
> >
> >> Avinash-
> >>
> >> > 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??
> >>
> >> A few comments:
> >>
> >> 1) First, suggest to focus only on receiving with HyperTerminal.
I
> >> suggested this before, but seems like you insist
> >> to try the whole loopback. There is a saying: before you can walk,
you
> >> must crawl.
> >>
> >> 2) How do you know the baud rate should be 19200? Did you verify
on a dig
> >> scope? Suggest to try several rates in
> >> HyperTerminal, see if you get something that makes sense.
> >>
> >> 3) For desired 19200 baud rate, using the formula on pg 5 of
spra633c, I
> >> get a CLKGDV value of 732. Why are you using
> >> 1200? At what clock rate is your DSK 6713 board running? You
should know
> >> this value.
> >>
> >> 4) Your output test string is not actually 'M'. It is 'M' followed
by a CR
> >> and LF. I hope you can figure out what I
> >> mean.
> >>
> >> 5) Related to 4) above, your output message buffer won't have 27
copies of
> >> 'M'.
> >>
> >> 6) This line:
> >>
> >> for (i=0; i<(sizeof(xmitbuf)/sizeof(unsigned int)); i++)
> >>
> >> will clear only 1/4 of your output buffer. Again, hope you can
figure out
> >> why.
> >>
> >> The good news is that you seem to get something on HyperTerminal,
so that's
> >> a start and you should be able to build on
> >> that. Each time you run your DSP program, suggest to restart
HyperTerminal
> >> first. I know that's tedious, but it
> >> prevents any left over artifacts in HyperTerminal, which is not
known to be
> >> the most reliable program (you might look
> >> up something called Tera Term).
> >>
> >> Let us know when you can receive on HyperTerminal a character that
makes
> >> sense.
> >>
> >> -Jeff
> >>
> >>
> >> > 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 <csl.h>
> >> > #include <csl_mcbsp.h>
> >> > #include <csl_edma.h>
> >> > #include <csl_dma.h>
> >> > #include <csl_irq.h>
> >> > #include <stdio.h>
> >> >
> >> > /* 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<=27;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<=27;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??
> >>
> >>
> >
> >
> > --
> > AVINASH JHA
> > 
------- End of Original Message -------

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: UART on DSK6713 - avin...@gmail.com - Mar 31 15:26:29 2010

Williams sir,
->Yes i checked the data on the oscilloscope.Again there the pattern of
transmit data is corrct but receive data is wrong.
->Even reducing the size of recvbuf and xmitbuf didn't help.
->In the example code they have wriiten "aligning data on L2 cache
memory", what is this?? I used #pragma
DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too didn't help.
->In my code the steps invollved are--
1)Enable CSl
2)Enable interrupts and set SRGR
3)Config McBSP
4)Enable EDMA channels
5)transmit data (this fills the recvbuf array)
6)enable McBSP as a receiver
7)enable McBSP as a transmitter
8)enable Fsync
9)data transfer starts
10)close EDMA

now tell me where am i wrong?? I have used all the methods known to me and from
the TI app. notes, still no solution.
What i think is that xmitbuf and recvbuf must be alligned but how to do this??
Also will be please explain me the detailed working of McBSPenablexmit() and
McBSP_enablerecv(); functions.i.e. on which values do they work??

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.
>
>_____________________________________

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Jeff Brower - Mar 31 16:26:11 2010

Avinash-

> ->Yes i checked the data on the oscilloscope.Again there the
> pattern of transmit data is corrct but receive data is
> wrong.

1) When you say "receive", was this with HyperTerminal?  What baud
rate?

2) Can you post a screen capture of your dig scope trace on McBSP Tx (PC RxD)? 
Just one byte is enough (I assume
you're sending the same byte repeatedly).

-Jeff

> ->Even reducing the size of recvbuf and xmitbuf didn't help.
> ->In the example code they have wriiten "aligning data on L2 cache
memory", what is this?? I used #pragma
> DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too didn't
help.
> ->In my code the steps invollved are--
> 1)Enable CSl
> 2)Enable interrupts and set SRGR
> 3)Config McBSP
> 4)Enable EDMA channels
> 5)transmit data (this fills the recvbuf array)
> 6)enable McBSP as a receiver
> 7)enable McBSP as a transmitter
> 8)enable Fsync
> 9)data transfer starts
> 10)close EDMA
>
> now tell me where am i wrong?? I have used all the methods known to me and
from the TI app. notes, still no solution.
> What i think is that xmitbuf and recvbuf must be alligned but how to do
this??
> Also will be please explain me the detailed working of McBSPenablexmit()
and McBSP_enablerecv(); functions.i.e. on
> which values do they work??
>
> 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.

_____________________________________





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Mar 31 23:25:19 2010

Avina,

I'm a bit confused by your sequence:
5)transmit data (this fills the recvbuf array)
6)enable McBSP as a receiver
7)enable McBSP as a transmitter

The xmitbuf needs to be filled before starting the MCBSP receiver and
transmitter.
However, the recvbuf should be getting filled from the data read by the McBSP
receiver' which cannot happen until after the McBSP receiver is enabled.

Please clarify.

R. Williams

---------- Original Message -----------
From: a...@gmail.com 
To: c...@yahoogroups.com 
Sent: Wed, 31 Mar 2010 14:22:38 -0400 
Subject: [c6x] Re: UART on DSK6713

>  
> 
> Williams sir,
> ->Yes i checked the data on the oscilloscope.Again there the pattern of
transmit data is corrct but receive data is wrong.
> ->Even reducing the size of recvbuf and xmitbuf didn't help.
> ->In the example code they have wriiten "aligning data on L2 cache
memory", what is this?? I used #pragma
DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too didn't help.
> ->In my code the steps invollved are--
> 1)Enable CSl
> 2)Enable interrupts and set SRGR
> 3)Config McBSP
> 4)Enable EDMA channels
> 5)transmit data (this fills the recvbuf array)
> 6)enable McBSP as a receiver
> 7)enable McBSP as a transmitter
> 8)enable Fsync
> 9)data transfer starts
> 10)close EDMA
> 
> now tell me where am i wrong?? I have used all the methods known to me and
from the TI app. notes, still no solution.
> What i think is that xmitbuf and recvbuf must be alligned but how to do
this??
> Also will be please explain me the detailed working of McBSPenablexmit()
and McBSP_enablerecv(); functions.i.e. on which values do they work??
> 
> 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.
> >
> >_____________________________________
> >
> > 
------- End of Original Message -------

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Mar 31 23:25:24 2010

Avina,

This is good news that the transmited data is correct.

Lets take this one problem at a time.
Starting with the xmitbuf...
The code needs:
#pragma DATA_SECTION( "xmitbuf", "L2xmitbuf");

In the .cmd file MEMORY entries, add:
named entry defined that begins on a L2 row address and is as long as the
xmitbuf size in the code. (sorry, I do not know what the L2 row addresses are).
(lets call the named memory area: L2RowXmitBuf)

In the .cmd file SECTIONS entries, add:
L2xmitbuf > L2RowXmitBuf

A similar set of additions are needed for the 'recvbuf'.
Note the L2 rows have to be far enough apart to allow for the size of the
xmitbuf area.

R. Williams

---------- Original Message -----------
From: a...@gmail.com 
To: c...@yahoogroups.com 
Sent: Wed, 31 Mar 2010 14:22:38 -0400 
Subject: [c6x] Re: UART on DSK6713

>  
> 
> Williams sir,
> ->Yes i checked the data on the oscilloscope.Again there the pattern of
transmit data is corrct but receive data is wrong.
> ->Even reducing the size of recvbuf and xmitbuf didn't help.
> ->In the example code they have wriiten "aligning data on L2 cache
memory", what is this?? I used #pragma
DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too didn't help.
> ->In my code the steps invollved are--
> 1)Enable CSl
> 2)Enable interrupts and set SRGR
> 3)Config McBSP
> 4)Enable EDMA channels
> 5)transmit data (this fills the recvbuf array)
> 6)enable McBSP as a receiver
> 7)enable McBSP as a transmitter
> 8)enable Fsync
> 9)data transfer starts
> 10)close EDMA
> 
> now tell me where am i wrong?? I have used all the methods known to me and
from the TI app. notes, still no solution.
> What i think is that xmitbuf and recvbuf must be alligned but how to do
this??
> Also will be please explain me the detailed working of McBSPenablexmit()
and McBSP_enablerecv(); functions.i.e. on which values do they work??
> 
> 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.
> >
> >_____________________________________
> >
> > 
------- End of Original Message -------

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Mar 31 23:27:11 2010

Avina,

regarding:
Also will be please explain me the detailed working of McBSPenablexmit() and
McBSP_enablerecv(); functions.i.e. on which values do they work??

The xmitbuf must be filled before calling McBSPenablexmit().
(the edma will be used to actually move the xmitbuf data to the McBSP)

The recvbuf will be filled from the data read by the McBSP. 
(the edma will be used to actually move the data from the McBSP to the
recvbuf.)

R. Williams

---------- Original Message -----------
From: a...@gmail.com 
To: c...@yahoogroups.com 
Sent: Wed, 31 Mar 2010 14:22:38 -0400 
Subject: [c6x] Re: UART on DSK6713

>  
> 
> Williams sir,
> ->Yes i checked the data on the oscilloscope.Again there the pattern of
transmit data is corrct but receive data is wrong.
> ->Even reducing the size of recvbuf and xmitbuf didn't help.
> ->In the example code they have wriiten "aligning data on L2 cache
memory", what is this?? I used #pragma
DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too didn't help.
> ->In my code the steps invollved are--
> 1)Enable CSl
> 2)Enable interrupts and set SRGR
> 3)Config McBSP
> 4)Enable EDMA channels
> 5)transmit data (this fills the recvbuf array)
> 6)enable McBSP as a receiver
> 7)enable McBSP as a transmitter
> 8)enable Fsync
> 9)data transfer starts
> 10)close EDMA
> 
> now tell me where am i wrong?? I have used all the methods known to me and
from the TI app. notes, still no solution.
> What i think is that xmitbuf and recvbuf must be alligned but how to do
this??
> Also will be please explain me the detailed working of McBSPenablexmit()
and McBSP_enablerecv(); functions.i.e. on which values do they work??
> 
> 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.

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - avinash jha - Apr 1 8:55:46 2010

thanx,
thse indeed r valuable info.
 And in my sequence, Processtransmitdata() function fills the xmitbuf
array, theni wake up the McBSP as transmitter and receiver. For this
the TI application note said that it must first be enabled as a
receiver and then as transmitter.Finally when Fsync() is enabled the
transfer startts. I followed the similar procedure.
  I did a typo mistake in step 5) transmit data (fills xmitbuf()).

and plese elaborate on L2 row address. I read spru609 and 656 for 6713
2level memory but could not understand much.How do i get the L2 row
address??

Thanx again for ur help.

On 4/1/10, Richard Williams <r...@lewiscounty.com> wrote:
> Avina,
>
> regarding:
> Also will be please explain me the detailed working of McBSPenablexmit()
and
> McBSP_enablerecv(); functions.i.e. on which values do they work??
>
> The xmitbuf must be filled before calling McBSPenablexmit().
> (the edma will be used to actually move the xmitbuf data to the McBSP)
>
> The recvbuf will be filled from the data read by the McBSP.
> (the edma will be used to actually move the data from the McBSP to the
> recvbuf.)
>
> R. Williams
>
> ---------- Original Message -----------
> From: a...@gmail.com
> To: c...@yahoogroups.com
> Sent: Wed, 31 Mar 2010 14:22:38 -0400
> Subject: [c6x] Re: UART on DSK6713
>
>> Williams sir,
>> ->Yes i checked the data on the oscilloscope.Again there the pattern
of
>> transmit data is corrct but receive data is wrong.
>> ->Even reducing the size of recvbuf and xmitbuf didn't help.
>> ->In the example code they have wriiten "aligning data on L2
cache
>> memory", what is this?? I used #pragma
>> DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too
didn't
>> help.
>> ->In my code the steps invollved are--
>> 1)Enable CSl
>> 2)Enable interrupts and set SRGR
>> 3)Config McBSP
>> 4)Enable EDMA channels
>> 5)transmit data (this fills the recvbuf array)
>> 6)enable McBSP as a receiver
>> 7)enable McBSP as a transmitter
>> 8)enable Fsync
>> 9)data transfer starts
>> 10)close EDMA
>>
>> now tell me where am i wrong?? I have used all the methods known to me
and
>> from the TI app. notes, still no solution.
>> What i think is that xmitbuf and recvbuf must be alligned but how to
do
>> this??
>> Also will be please explain me the detailed working of
McBSPenablexmit()
>> and McBSP_enablerecv(); functions.i.e. on which values do they work??
>>
>> 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.
>
-- 
AVINASH JHA

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Re: UART on DSK6713 - Richard Williams - Apr 1 12:12:47 2010

Avina,

caveat: The L2 cache and L2 sram is an area that I do not know much about.

Before you can use the L2 cache, the L2 cache has to be enabled and placed into
a desirable mode.
the c6713 L2 cache+L2 sram is 256k in size.

The addressing for the cache is broken down as follows:
(this is a quote from SPRU609B.pdf)
==========================
The L2 cache is a set associative cache whose capacity varies between
16K bytes and 64K bytes depending on its mode. The cache is organized as
128 sets with a 128-byte line size. The associativity varies between 1-way and
4-way as the capacity changes. Therefore, external physical memory
addresses map onto the L2 cache identically, regardless of the cache mode.
The physical address divides into three fields as shown in Figure 5. Bits
6&#8722;0
of the address specify an offset within a line. Bits 13&#8722;7 of the
address select
one of the 128 sets within the cache. Bits 31&#8722;14 of the address serve
as the
tag for the line.
==================================
This means each line, starting from the beginning of the L2 cache is 128 bytes
long.
This means recvbuf and xmitbuf have to be aligned on 128 byte boundaries within
the L2 cache.

R. Williams

---------- Original Message -----------
From: avinash jha <a...@gmail.com> 
To: Richard Williams <r...@lewiscounty.com> 
Cc: c...@yahoogroups.com 
Sent: Thu, 1 Apr 2010 11:06:25 +0530 
Subject: Re: [c6x] Re: UART on DSK6713

> thanx, 
> thse indeed r valuable info. 
> And in my sequence, Processtransmitdata() function fills the xmitbuf 
> array, theni wake up the McBSP as transmitter and receiver. For this 
> the TI application note said that it must first be enabled as a 
> receiver and then as transmitter.Finally when Fsync() is enabled the 
> transfer startts. I followed the similar procedure. 
>  I did a typo mistake in step 5) transmit data (fills xmitbuf()). 
> 
> and plese elaborate on L2 row address. I read spru609 and 656 for 6713 
> 2level memory but could not understand much.How do i get the L2 row 
> address?? 
> 
> Thanx again for ur help. 
> 
> On 4/1/10, Richard Williams <r...@lewiscounty.com> wrote: 
> > Avina, 
> > 
> > regarding: 
> > Also will be please explain me the detailed working of
McBSPenablexmit() and 
> > McBSP_enablerecv(); functions.i.e. on which values do they work?? 
> > 
> > The xmitbuf must be filled before calling McBSPenablexmit(). 
> > (the edma will be used to actually move the xmitbuf data to the McBSP)

> > 
> > The recvbuf will be filled from the data read by the McBSP. 
> > (the edma will be used to actually move the data from the McBSP to the

> > recvbuf.) 
> > 
> > R. Williams 
> > 
> > ---------- Original Message ----------- 
> > From: a...@gmail.com 
> > To: c...@yahoogroups.com 
> > Sent: Wed, 31 Mar 2010 14:22:38 -0400 
> > Subject: [c6x] Re: UART on DSK6713 
> > 
> >> 
> >> 
> >> Williams sir, 
> >> ->Yes i checked the data on the oscilloscope.Again there the
pattern of 
> >> transmit data is corrct but receive data is wrong. 
> >> ->Even reducing the size of recvbuf and xmitbuf didn't help. 
> >> ->In the example code they have wriiten "aligning data on
L2 cache 
> >> memory", what is this?? I used #pragma 
> >> DATA_ALIGN(xmitbuf,L2_CACHE_LINESIZE) to align them, but this too
didn't 
> >> help. 
> >> ->In my code the steps invollved are-- 
> >> 1)Enable CSl 
> >> 2)Enable interrupts and set SRGR 
> >> 3)Config McBSP 
> >> 4)Enable EDMA channels 
> >> 5)transmit data (this fills the recvbuf array) 
> >> 6)enable McBSP as a receiver 
> >> 7)enable McBSP as a transmitter 
> >> 8)enable Fsync 
> >> 9)data transfer starts 
> >> 10)close EDMA 
> >> 
> >> now tell me where am i wrong?? I have used all the methods known
to me and 
> >> from the TI app. notes, still no solution. 
> >> What i think is that xmitbuf and recvbuf must be alligned but how
to do 
> >> this?? 
> >> Also will be please explain me the detailed working of
McBSPenablexmit() 
> >> and McBSP_enablerecv(); functions.i.e. on which values do they
work?? 
> >> 
> >> 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. 
> > 
> > 
> > -- 
> AVINASH JHA 
------- End of Original Message -------

_____________________________________

______________________________
StarterWare provides C-based no-OS platform support for the C6000 DSP devices.
Click here for details.




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )