cancel
Showing results for 
Search instead for 
Did you mean: 

UART1 DMA Link List Byte or half word mode problems

rgreenthal
Associate II
Posted on August 08, 2008 at 16:22

UART1 DMA Link List Byte or half word mode problems

1 REPLY 1
rgreenthal
Associate II
Posted on May 17, 2011 at 09:54

Hi

What am I doing wrong

We are running at 625K baud & regesters look correct for this

We run at 96 MHZ with a divide by 2 forthe BRCLK so reg are 0x04 & 0x33

The first setup of the Link List works the 2nd doesn't

usNetRxCommand[] is defined as an unsigned short array of 256, 4 times bigger than we should ever need

I can't see any difference

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

// Poll response terminal count interrupt

// Get a unsigned short ( 2 bytes)(our Message structure)

// Get size of Message to be Received

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

StructLinkList LLRxPoll = {

(long*)UART1_BASE, // source pointer-- &UART1->DR

(long*)&usNetRxCommand[0], // destination &usRs485NetRxBuffer[0]

(long*)0x0, // rotating buffer, don't point to anywhere, End of LL

// Channel control register--cc (overwrite length) (long) 0x88000002,

(long) DMA_DesIncrement // destination increment, NewFWLib name

| DMA_SrcWidth_Byte // source 8 bits

| DMA_DesWidth_Byte // destination 8 bits

| DMA_TCInterrupt // Terminal Count Interrupt enable, usually used to indicate that a transfer has finished 0x80000000

| 0x02, // Transfer size (two bytes)(mask for data size is 0x00000FFF)

// Channel Configuration--ccnf 0x0000900C

(long) DMA_FlowCntrl2_DMA // flow control Peripheral-to-memory 0x00001000

| DMA_ITMask_ITC // Terminal Count Interrupt Mask, usually used to indicate that a transfer has finished 0x00008000

| DMA_SRC_UART1_RX // 0x0C

};

StructLinkList LLRxPoll = {

(long*)UART1_BASE, // source pointer

(long*)&usNetRxCommand[0], // destination

(long*)0x00, // rotating buffer

// Channel Control

(long) DMA_DesIncrement // destination increment

| DMA_SrcWidth_HalfWord // source 16 bits

| DMA_DesWidth_HalfWord // destination 16 bits

| DMA_TCInterrupt // Terminal Count Interrupt enable, usually used to indicate that a transfer has finished 0x80000000

| 0x01, // length

// Channel Configuration

(long) DMA_FlowCntrl2_DMA // flow control

| DMA_ITMask_ITC // Terminal Count Interrupt Mask, usually used to indicate that a transfer has finished 0x00008000

| DMA_SRC_UART1_RX // source UART1 receive

};

Also I have a problem with another LL that is defined as longer

If there is a gap in the Receive byte stream of 64 usec (4 byte spacing), see scope trace

During that 65 usec gap the DMA LL gets 4 trash characters

It then gets the next trailing byte properly

My message is displayed in the debug screen shots above the scope trace

Good message should be 0x0503 0x0001 0xFBFC

Where 0x0503 has the count of half words 0f 0x03 and the last half word is the checksum