Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Recently, I discovered that the chip I had on hand was a counterfeit STM32, which couldn’t be programmed. Following solutions found online, I imported a library for a certain chip and was able to program it using STlink, but I still encountered many issues.
Since my project required using C8T6 to deploy FreeRTOS, and I only had this chip, I chose to run RTOS on it. I thought that if I could program it, running RTOS shouldn’t be a problem.
However, I found that once my RTOS tasks started scheduling, the system would crash.

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Initially, I thought it was a stack overflow issue with C8T6. I searched for many solutions, but none resolved my problem.

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Even the simplest RTOS with just one task couldn’t start. It was evident that this was no longer a simple stack overflow issue.
So, I borrowed a genuine STM32F103C8T6 from a junior in the lab, which had a much clearer silk screen compared to the previous C8T6.

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

Moreover, the IDCODE read by STlink also starts with 0x1B.

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

It is not like the previous counterfeit chip that started with 0x2B.
After initializing with CubeMX, I flipped the LED in the default task.
void StartDefaultTask(void *argument){  /* USER CODE BEGIN StartDefaultTask */  /* Infinite loop */  for(;;)  {    HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_13);    osDelay(1000);  }  /* USER CODE END StartDefaultTask */}
The code also runs normally, and the previous issue of the code freezing does not occur.
So it should be the counterfeit STM32 chip that caused the RTOS to fail to start, and there are significant issues with the timer’s startup as well.

Running FreeRTOS on STM32F103C8T6: A Guide to Overcoming Issues with Counterfeit Chips

I originally planned to release a practical project on FreeRTOS for STM32F103C8T6 in the past few days, but due to the issue with the counterfeit chip, the tasks have been unable to run, which has delayed me for several days.

Leave a Comment

Your email address will not be published. Required fields are marked *