Skip to main content
julienterrier39
Associate III
August 7, 2015
Question

Need help to understand Firmware UART_TwoBoards_ComDMA

  • August 7, 2015
  • 16 replies
  • 2182 views
Posted on August 07, 2015 at 18:35

Hello everybody,

I want create a project wich work with USART, I use as IDE Keil µvision5 (light version) then I bought a STM32F429ZI-DISCOVERY board to train with it. 

Currently I trying to understand how does it work, indeed I saw that I need two boards for the program to work.

Actually I trying to understand ''UART_TwoBoards_ComDMA'' project.

 In the packages, I have three example wich use the USART protocol:

-UART_TwoBoards_ComDMA-

-UART_TwoBoards_ComIT-

-UART_TwoBoards_ComPolling-

To lead my project with success I need  someone who has a knowledge on the µcontroller such as STM32F4 and who can help me througout this forum.

Of course I have started to read the relevant datasheet such as STM32F4 ref manual and STM32F429ZIT to learn the register and how does it work.

But as I am beginner in embedded firmware its very hard to undestand everything.

My first question will be:

What is the significant difference between this 3 examples (DMA, INTERRUPT and POLLING) ?

I saw that the DMA is used as internal data bus ? and I know that the interrupt  for example it make with a timer.

I hope that my post is clear but I am french and beginner.

Thank you so much.     
    This topic has been closed for replies.

    16 replies

    Nesrine M_O
    Associate
    August 10, 2015
    Posted on August 10, 2015 at 12:23

    Hi,

     […I have started to read the relevant datasheet such as STM32F4 ref manual and STM32F429ZIT …], you should know that there is a difference between datasheet and reference manual.

    I suggest you to read the readme file that describes every example. Also the differences between UART transmission modes are described in the section Universal synchronous asynchronous receiver transmitter (USART), in the

    http://www.st.com/web/en/resource/technical/document/reference_manual/DM00031020.pdf

     Reference manual.

    -Syrine-

    julienterrier39
    Associate III
    August 10, 2015
    Posted on August 10, 2015 at 16:47

    Hello,

    Thank you for your help!

    I read again readme.txt between DMA method and interrupt method and sincerely, I have found nothing that would help me understand the differences there are between these methods. 

    Anyway I understood  I have to read several times all part of RM0090 who interested me, USART, GPIO, DMA etc..  For example Reading the RM0090 and I found this advantage with the DMA:

    ''Data can be quickly moved by DMA without any CPU action. This keeps CPU resources free for other operations.''

    Amel NASRI
    ST Technical Moderator
    August 11, 2015
    Posted on August 11, 2015 at 12:34

    Hi julien.terrier,

    I read again readme.txt between DMA method and interrupt method and sincerely, I have found nothing that would help me understand the differences there are between these methods. 

     

    So it would be helpful for you to have a look to AN and user manuals available in

    http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF259243

    (mainly AN4739, UM1725 and UM1730).

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    RomainR.
    ST Employee
    August 11, 2015
    Posted on August 11, 2015 at 14:17

    Julien,

    First try to write a first UART project (in polling mode) without DMA and Interrupt.

    Start with this project :

    C:\Users\username\STM32Cube\Repository\STM32Cube_FW_F4_V1.7.0\Projects\STM32F429I-Discovery\Examples\UART\UART_TwoBoards_ComPolling

    Polling method means during transmit or receive sequence, your code must wait for UART Data Register Receive Not Empty or Transmit Empty Flag synchronization. 

    That include latency and it's not used for realtime communication (depending application)

    let me know.

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    Nesrine M_O
    Associate
    August 11, 2015
    Posted on August 11, 2015 at 14:53

    Hi,

    Polling/IT/DMA modes are not UART specific, it is valid for all peripheral with communication.

    Polling : no concurrent calls / function calls are blocking mode (you call function to transfer 20 bytes, you will exit function only at the end (when all bytes are transmitted =>it  is not possible to execute other code during this transmission.) So polling mode should be used only when this constraint is not a problem

    DMA and IT mode are more flexible, and between transfer start and end (user callback is called), other code could be executed ... globally, IT and DMA modes are more efficient.

    -Syrine-

    Tesla DeLorean
    Guru
    August 11, 2015
    Posted on August 11, 2015 at 18:27

    What is the significant difference between this 3 examples (DMA, INTERRUPT and POLLING) ?

    It's to demonstrate various methods people are used to using. May be you should be reviewing this in a Computer Architecture and Computer Science sense, the STM32 is only one part in a large galaxy of micro-processors/controllers. Generally the reasons to use DMA or Interrupts is so the processor can go about doing useful work instead of grinding in a loop waiting for some slow interface to respond or for a user to depress a key.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    julienterrier39
    Associate III
    August 12, 2015
    Posted on August 12, 2015 at 05:36

    Thanks a lot everybody for your answers, I understood well that with DMA or interrupt methods the processor could work more easily without latency therefore it will work in multi-tasking and my choice will depend of my application and my needs.

    However I am going read all related documents that you suggest me. I bought a second board to compile these three methods and above all I stay close of you for any questions! 
    julienterrier39
    Associate III
    August 22, 2015
    Posted on August 22, 2015 at 17:02

    Hello everybody,

    I purchased a second discovery-board STM32F429ZI to try UART_TwoBoards_ComIT program but I didn't get anything.

    In first I made the connection between two boards through PA09Tx (Tx Bd) to PA10Rx (Rx Bd) and PA10Rx (Tx Bd) to PA09Tx (Rx Bd).

    Then according to the warning in readme.txt:

     I should remove a switch on the receiver board, but which switch CN4(x2)? and during any operation should I move out this switch ? Compilation, Loading in flash memory ?

    For your information both are supplied throughout  USB port, and if I move out CN4 switchs The ST-link is not recognized!

    Thank you for your help! 

    Tesla DeLorean
    Guru
    August 22, 2015
    Posted on August 22, 2015 at 17:52

    PA9, and PA10 should be usable on the STM32F429I-DISCO. Make sure you bond the ground between the two boards.

    Shouldn't require you to change any links or jumpers.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    julienterrier39
    Associate III
    August 22, 2015
    Posted on August 22, 2015 at 19:21

    Thanks for your answer,

    I have the same ground because the power is supplied by the same PC in two different USB port but if GND from CN1 is different of GND from I/O peripheral?

    But certainly you talk about GND from I/O peripheral so I should connect a wire between GND TRANSMITTER BOARD and GND RECEIVER BOARD?

    Now about the switch! This warning is provide from the readme.txt:

    Warning: As both boards do not behave same way, ''TRANSMITTER_BOARD'' switch 

    compilation exists to determine either software is for 1st transmitter board or 

    2nd receiver (then transmitter) board. In other words, 1st board has to be 

    flashed with software compiled with switch enable, 2nd board has to be flashed 

    with software compiled with switch disable.

    The switch is maybe the BUTTON USER ?

    Sorry maybe my question is a bit stupid but I am a beginner!

    Thank you  for your patience!