[AT-START-F403A Evaluation] Part 2 FreeRTOS system IAR environment clock configuration and serial port DMA implementation are completely pri...
[Copy link]
This post was last edited by uuxz99 on 2020-10-3 21:08
【AT-START-F403A Review】 Part 2: FreeRTOS system implements full printf function based on IAR environment clock configuration and serial port DMA
In the last evaluation, only simple task switching was implemented, and the task interrupt mechanism was not yet implemented. This evaluation implemented the task interrupt switching and other functions. By using DMA and its interrupt mechanism to implement the complete printf function, in order to obtain excellent DMA performance, let's first look at the configuration of the clock system.
Clock Configuration:
- The system clock can be configured in system_at32f4xx.c in the Startup directory of the project. Of course, it can also be adjusted at runtime. The evaluation is based on the highest clock setting.
- In order to observe the configuration results, set a global variable systemClock of RCC_ClockType type. In the main startup, you can get the configuration of the system clock through RCC_GetClocksFreq(&systemClock).
- After starting the debugging breakpoint and stopping, observe the variable systemClock in watch
- Confirm the clock configuration
The clock output is described in the RCC CFG register of the datasheet as follows. The register is actually consistent with the description. Currently, the external 8MHz clock is configured as the PLL clock source, and the PLL clock is used as the system clock output 240MHz. It should be noted that if the above configuration is not modified, the default system clock and APB are all 8MHz.
Complete printf function implementation:
- The evaluation is implemented by sending print characters in DMA mode through UART. Based on the three tasks of the previous evaluation ("at-start-f403a evaluation one - freeRTOS system construction"), the serial port DMA printing function is added, which is named console function in the evaluation.
- Implement serial port DMA printing and drive initialization of gpio, serial port and DMA devices respectively.
- Serial port gpio device initialization
-
- Serial port device initialization
-
- DMA device initialization
Enable RCC and DMA interrupt configuration.
-
- console function initialization
-
- DMA Send
-
- Console function implementation
Add the console function to the original three lighting tasks
-
- Functional result example
|