This post was last edited by ddllxxrr on 2020-12-10 21:13
It actually arrived yesterday, and my Cainiao Guoguo also showed it as arrived, but when I went to pick it up, I really didn't see it. I saw it today. I didn't stop. I took it out and showed it to the public.
It looks like the old NUClEO board. But this time I am confident that I will use KEIL MDK 5 plus STM32CUBEMX. Mainly to evaluate FREERTOS.
So I started working on it before the board arrived, and prepared two tools:
1. One is MDK PACK, install before downloading.
2. The other one is STM32CUBEMX, which is also installed.
STM32CUBEMX is very easy to use, just open the model of this board.
I turned on FREERTOS, enabled it, selected FREERTOS plus thread, and added a lighting thread for backup.
This board has STLINK, which has a virtual serial port, so the second one I send out is “HELLO EEWORLD!!!”
I checked the schematic:
Check the data sheet:
It can be seen that PA1 and PA2 are UART2, and these are the two pins in STM32CUBE (because I chose the board model).
I defined the second thread to always send "HELLO EEWORLD!!!"
I selected the generated code in STM32CUBEMX, and then added a few sentences to the thread to easily achieve it:
/* USER CODE END Header_StartDefaultTask */
void StartDefaultTask(void const * argument)
{
/* USER CODE BEGIN 5 */
/* Infinite loop */
for(;;)
{
HAL_UART_Transmit(&huart2,TxData,16,0xffff);//把TxData的内容通过uart2发送出去,长度是10,timeout的时间是最大值0xffff
osDelay(10);
}
/* USER CODE END 5 */
}
/* USER CODE BEGIN Header_StartTask02 */
/**
* @brief Function implementing the myTask02 thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartTask02 */
void StartTask02(void const * argument)
{
/* USER CODE BEGIN StartTask02 */
/* Infinite loop */
for(;;)
{
HAL_GPIO_WritePin(LD4_GPIO_Port, LD4_Pin, GPIO_PIN_RESET);
osDelay(100);
HAL_GPIO_WritePin(LD4_GPIO_Port, LD4_Pin, GPIO_PIN_SET);
osDelay(100);
}
/* USER CODE END StartTask02 */
}
Here are the results of sending the thread:
At this time, the flashing light was also running, and FREERTOS was successfully run with NUCLEO for the first time.
To sum up, the reason why I was a little prejudiced against RTOS before was that it had to be ported. You know, it had to be assembled, and I was tired of assembling it back and forth, because if I was not careful, the program would be disabled when it started (there was something wrong with the assembly). So I didn't like all RTOS. Anyway, I didn't use it, but I could still live. Gradually, I became interested in KEIL RXT because it didn't need to be ported. But through this evaluation, I realized that after learning STM32CUBEMX well, FREERTOS also means no need for porting.
For an old stubborn person like me who only uses standard libraries for programming, this review has had a huge impact on me. I want to reconsider my future path.