UART DMA only transmitting a single byte

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

Hi,

I am trying to use DMA to transmit 10 bytes from the UART, but I am only seeing one byte.

Image4.png

As far as I can see, I am setting the transferCount to 10, so I should see 10 bytes.

What am I doing wrong?

Please find attached my project. Any help appreciated.

const unsigned char packet_num_bytes = 10;
unsigned char packet_out_buffer[256];
unsigned char packet_in_buffer[256];

void Configure_DMA()
{
     CyDmaTdSetConfiguration( tx_td,                                          // Set up the Transaction Descriptor for 32-bit reads                            
                              packet_num_bytes,                                // Length of transfer                            
                              CY_DMA_DISABLE_TD,                                              // Works                            
                              TD_INC_SRC_ADR);                                    

     CyDmaTdSetAddress(       tx_td,                            
                              LO16((uint32) packet_out_buffer),                                         
                              LO16((uint32) UART_TXDATA_PTR));

     CyDmaTdSetConfiguration( rx_td,
                              packet_num_bytes,                  // DMA both the address and the data packet                            
                              CY_DMA_DISABLE_TD,                            
                              TD_INC_DST_ADR | DMA_RX__TD_TERMOUT_EN);         

      CyDmaTdSetAddress(      rx_td,                            
                              LO16((uint32) UART_RXDATA_PTR),                            
                              LO16((uint32) packet_in_buffer));
}
0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Hi,

Your code is missing one thing.  DMA_TX is set  to derived.  However, the tx_interrupt used (FIFO_Not_Full) needs the DMA_TX set to LEVEL.

Once I set it to LEVEL, 10 bytes transmitted every 1 msec.

pastedImage_0.png

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
1 Reply
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Hi,

Your code is missing one thing.  DMA_TX is set  to derived.  However, the tx_interrupt used (FIFO_Not_Full) needs the DMA_TX set to LEVEL.

Once I set it to LEVEL, 10 bytes transmitted every 1 msec.

pastedImage_0.png

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes