The first step of the test is to light up the LED light, which has almost become an unchanging step. I was going to post the lighting and unboxing together, but I encountered the problem of not being able to recognize ST_LINK. I tried every possible way to repeatedly install the drivers I could find, including installing the so-called ST-LINK family bucket, but it was all a nephew holding a lantern to illuminate his uncle. Finally, I searched for a post in the ST32 community. The poster had the same problem and finally solved the problem by upgrading the Keil version. Before this, I also suspected that it might be a problem with the version being too low, because when using CUbeMX to generate the project framework, the option when selecting IDE is V5.27, and it cannot be modified, and I am using V5.25. Today, I downloaded and installed the V5.30 version and checked it again. ST-LINK was clearly visible. It turned out to be a problem with the version being too low.
Version upgraded to V5.30:
Check the download options again, ST-LINK is clearly visible:
After solving the ST-LINK driver burning problem, I encountered a new problem when trying to download:
But I know the cause of the problem, because when I created the first test project, I selected Yes when selecting the safe area. According to the experience of netizens, I should select No (see the figure below). I re-created a test project and it was OK:
Lighting up the LED is a relatively simple problem. I set a global variable, increment it by 1 through the SysTick interrupt handler, and then implement the timing processing in the main loop. The code is as follows:
while (1)
{
if(ms>499){
ms = 0;
ledn++;
if(ledn>6){
ledn = 1;
ledm++;
if(ledm>2){
ledm = 0;
}
}
switch (ledm){
case 0:
if(ledn%2 == 0)
LED_On(0);
else
LED_Off(0);
break;
case 1:
LED_Off(0);
if(ledn > 0)
LED_On(ledn);
break;
case 2:
LED_On(0);
if(ledn > 0)
LED_Off(ledn);
break;
case 3:
break;
}
}
Here are some pictures from the test:
Here is the recorded animation: