How to Change the UART Baud Rate During the Runtime on PSoC - KBA230021

Version 3

    Author: EktaN_26           Version: **

     

    Translation - Japanese: PSoCの動作中にUARTボーレートを変更する方法 - KBA230021 - Community Translated (JA)

     

    1. Select the UART Component from the Component Catalog and place it in the *TOPDesign.cysch tab as shown in Figure 1.

     

    Figure 1. Placing the UART Component in the TOPDesign.cysch

     

    2. Double-click on the UART Component and enable the “Clock Terminal” in the Configure ‘UART’ as shown in Figure 2.

     

    Figure 2. Configure the UART Component

     

    3. Connect an external clock to the UART Component and configure the Frequency of the clock, according to the initially required baud rate as shown in Figure 3.

     

    Figure 3. Add an External Clock to the UART Component

    4. During run time, change the clock divider value to change the baud rate by using Clock_SetDivider(uint16 divider) to change the baud rate of the UART as shown in the following code snippet (the baud rate is set to 9600; the baud rate can be modified depending on the clock set divider value and by setting the appropriate external clock frequency).

    5. Now, the actual baud rate is set to 9607 bps.

     

    Figure 4. Setting the Baud Rate