[Silicon Labs BG22-EK4108A Bluetooth Development Evaluation] 2. Hardware Testing: Lighting and Code Explanation
[Copy link]
This post was last edited by lang518899 on 2022-1-10 21:23
Silicon Labs BG22-EK4108A was tested with hardware, buttons and LED lights. Since the soc_blinky project always crashes during debugging and the cause of the debug problem is not found, I will develop another one later. Here I mainly test the blink_pwm_baremetal project to achieve the breathing light effect.
1. First, according to the SDK example, select the new key project, the new project wizard pops up, select Platform, and then select Platform_Blink PWM.
2. In the pop-up project creation naming window, configure the project name, path, etc., as shown in the figure below
3. After creation, click the hammer icon to start compiling. After compilation, it will be as shown in the figure below.
4. Click the Beetle logo to start debugging. Before debugging, the firmware will be downloaded to the MCU first, as shown in the figure below.
5. Click Run and then power on again, you can see the LED light flashing with a breathing effect.
f795d5634f45c8b961c2faccd6ad43d7.mp4
(783.07 KB, downloads: 6)
6. The following is a code description. Open main.c and check the code entry function. As shown in the figure below, you can see the initialization of the underlying hardware, APP, and the PWM adjustment function to change the brightness of the light in the main loop.
7. In the system bottom hardware initialization function, the following functions are called. Here you can see the parameter configuration for initializing PWM.
8. The PWM parameter configuration function is shown in the figure below. The frequency and polarity can be changed manually.
9. In the initialization APP function, you can see the start PWM function. Call this function to start PWM output.
10. In the main loop, PWM automatically adjusts the light intensity, as shown in the figure below. The PWM cycle is changed every 6ms, gradually changing from dark to bright, and then from bright to dark, thus achieving the breathing light effect.
11.
|