Hello,
I use UART tansmit trigger DMA, i configurate the UART and DMA registers refer to related reference manual and demo , while, the resulte is the UART can't trigger the DMA .
I can use DMA_TCD1_CSR-》 START trigger the DMA and then the data can send through UART.
I have checked my program for many times , plase help me .
The screenshot is the configration .
I use UART3 can DMA1.
Solved! Go to Solution.
Hi Linda
1. Function prototype - Wikipedia, the free encyclopedia
3. If you want to write to it you need to write the data register and not read it; it won't convert a read into a write for you.http://en.wikipedia.org/wiki/Function_prototype
Regards
Mark
Hi
You don't show DMA configuration, which is more likely to have a problem. If the DMA channel is not configured correctly there will be a DMA error, which is visible by checking the DMA error register (where the cause if also signalled).
Regards
Mark
Linda
I took a look at your project and there are a number of problems:
1. There are some warnings that your new functions have no prototypes and so the compiler doesn't know what types are being passed as parameters. This doesn't mean that it won't work but there is a risk that there is false use of parameters or the caller and subroutine don't match. Please always use prototypes to avoid a possible problem due to this.
2. You are setting the DMA trigger enable in the DMA channel MUX. This is used for periodic triggering (special use) and is not used/needed for the type of transfer you are trying to do. I don't know what affect it has but I have never seen it set in this mode and so consider it wrong.
3. You have set up for DMA transfer due to UART 3 Tx source. The DMA channel has however been configured to transfer data "from" the UART3 RxD register to memory (that is, the wrong direction). Otherwise I think that the basic setup would Ok for a single byte transfer.
I understand that the code is probably testing a first step but there is still a lot of additional work to make good use of UART DMA operation, whereby you don't have any appliictaion interafce yet.
If your work is not for pure learing how to set up a few details you can already get complete UART DMA support in the uTasker project at KINETIS Project Code which will allow simultaneous Rx and Tx DMA operation on all K60 UARTs and a simple user interface as described in http://www.utasker.com/docs/uTasker/uTaskerUART.PDF (as well as integrated TCP/IP and USB stacks, FAT and most other Kinetis peripheral drivers). The uTasker simulator allows UART and DMA operation to be simulated in approx. real-time so debugging and study is must simpler than on the HW target.
Regards
Mark
Hi Mark,
Thank for your help.
From your help I still have some questions .
1, I don't understand your meaning of "use functions prototypes " and how use ? Examole ,please ?
3,From the datasheet of k60, "The UARTx_D register is two separate register .Reads return the contents of the read-only receive data register and write go to the writek-only transmit data register ." and when use software trigger DMA , data can transmit successfully throuh UART. So, I think UART can confirm direction automatically . Right?
I will study hard your recommended .
Thank you!
Linda
Hi Linda
1. Function prototype - Wikipedia, the free encyclopedia
3. If you want to write to it you need to write the data register and not read it; it won't convert a read into a write for you.http://en.wikipedia.org/wiki/Function_prototype
Regards
Mark
Hi Mark,
In my project I only write to the data register not read it.
Now , I disalbe the UART receive function ,only enalbe the transmite function, then the DMA and UART can work normally, I don't know why ?
Does DMA can't judge the UART receive or send ?
I'm upset, About this "The UARTx_D register is two separate register .Reads return the contents of the read-only receive data register and write go to the writek-only transmit data register ." is this meaning the two register , recive and send ? while from the memory map , there only have one.
UART can work at full dulpex , so how does the UARTx_D register work when Send and receive at the same time ?
Thank you !
Linda
LInda
This is an 'implementation' method used in many serial devices (same for I2C and SPI).
Just because the data register shares an address it doesn't mean much since the address is only a "window" to read or write the rx/tx. Usually there will be multiple buffers there (or FIFO) so that writing data to the UARTx_D register queues data for transmission and reading it retrieves waiting data from its receiver queue.
Therefore there are no restrictions to this - it is just an address for reading and writing that happens to have the same value. Try to imaging (pretend) that the addresses for read and write are different if it heps you to.
Regards
Mark