startUart4Traffic

The final component that needs to be explored in this example is how data will be sent to UART2. These examples are meant to simulate external data being received by USART2.  To achieve this without additional hardware, we wired together UART4 Tx and USART2 RX pins earlier in the chapter. The call to startUart4Traffic() is a TimerHandler prototype. A oneshot timer is started and set to fire 5 seconds after the application starts.

The function that does all of the heavy lifting is SetupUart4ExternalSim(). It sets up a continuous circular DMA transfer (which executes without CPU intervention) that transmits the string data from uart4 repeatedly. A full example using DMA will be covered later in this chapter – for now, it is sufficient to realize that data is being sent to USART2 without involvement from the CPU.

startUart4Traffic() creates a continuous stream of bytes that will be transmitted out of UART4 Tx and into UART2 Rx (with no flow control). Depending on the selected baud rate and the amount of time it takes for the receiving code to execute, we can expect that, eventually, a byte will be missed on the receiving side during some examples. Keep this in mind when running examples on your own. See the Choosing a driver model section for more details on selecting the appropriate driver type for your application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.187.233