Problem with LPC845 UART TX and DMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with LPC845 UART TX and DMA

829 Views
nikolaj_rahbak
Contributor II

I'm trying to get the LPC845 to run the USART with DMA on TX, but without luck. Any chance for an experts code review :smileywink: I have attached the c file.

Tested on a LPCXpresso845-max.

What I did:

1) I have imported the uart terminal and transfer dma demos from the SDK. Both work as expected.

2) I wated to mod the terminal demo to send a string using DMA. Change done:

  2.1) removed the IRQ part

  2.2) copied lots of the DMA demo (see lines 33 to 66 in attached)

  2.3) removed the "pingpong" descriptor (see line 39)

  2.4) change `uart->RXDAT` to `uart->TXDAT` and swapped source and destination (see line 60)

  2.5) change from `kDMA_PeripheralToMemory` to `kDMA_MemoryToPeripheral` (see line 61)

  2.6) removed to creation of the pingpong descriptor and added a new single descriptor (see line 64 and 65). I have no idea what to set the `next` descriptor to, I have tried setting it to the same descriptor and NULL. Neither works.

  2.7) Added `DMAConfigutation()` and `StartTransfer()` to the main function, just before the infinit loop. (see line 93 and 94)

What I expected to see: "Hello, world!" printed in my terminal.

What I actually see: The project builds and runs. I can debug it and single step the code. But nothing in printed in the terminal.

Labels (1)
0 Kudos
2 Replies

701 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Nikolaj,

Hope you are doing well.

From an initial look at your code, I'd like to ask you where are you expecting to see your string printed? Is it once you receive it or when you are sending it.

Can you confirm that on your receiving buffer you are actually receiving the string? 

Let me know so I can continue to support you.

Hope it helps!

Sabina

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------- 

0 Kudos

701 Views
nikolaj_rahbak
Contributor II

Hi Sabina

Thank you for you answer. Sorry, maybe I have misunderstood the DMA part completely. I'm not setting up the receiver (at least that was my plan), so I *cannot* confirm that the receiver is receiving anything. 

My setup is that I have a serial terminal running and connected to the 845. Same setup is for the two demos. For the demo I can see that I can write in the terminal, I can add breakpoints in the code and see the 845 is receiving what I wrote, and the 845 can send a reply back, that I can see in the terminal.

When the attached program starts up, I would expect that it

1) initializes the board (lines 81-91, code directly copied from the transfer_dma demo),

2) configures DMA channel 0 for TX (line 93 + 49-66, code copied and adapted from the transfer_dma demo, see ad. 2.4-2.6 in original post). Part of the configuration is setting up the tx_buffer (line 60), and the tx_buffer has already been loaded with "Hello, world!\n" (line 38).

3) Send the contend of the tx_buffer (line 94).

My expectation would then be to see "Hello, world\n" printed in my serial terminal, but nothing is send.

/nikolaj

0 Kudos