2025-01-08 01:56 AM - last edited on 2025-01-08 02:04 AM by Andrew Neil
2025-01-08 02:06 AM
Note that the Blue Pill (and other colours) is not an ST product, and almost certainly does not contain a genuine STM32.
Need some more details on what, exactly, your doing, what tools you're using, etc:
2025-01-08 02:09 AM
I am using Stm32CubeIDE. Below is the simple code that I am trying to run.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
uint32_t l_i_ui32 = 0;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
l_i_ui32++;
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
HAL_Delay(100);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
2025-01-08 02:21 AM
what happens if you single-step through that code?
2025-01-08 02:26 AM
When I single step, the LED turns OFF from ON condition. HAL_Delay() -> HAL_GetTick() are the last set of functions that I am able to single step. I have further debugged and it seems the uwtick variable is not getting updated. It always remains zero. I am using SysTick for Timebase.
2025-01-08 07:17 AM
Just wild guess, maybe incorrect: your BluePill may contain F103C6 chip and your project was created for F103C8. Check what happens if you set the RAM size in the linker script (.LD file in main project folder) to 10K instead of 20K.
Another idea: try to set the breakpoint in SysTick_Handler and check if it is called.
2025-01-08 07:48 AM - edited 2025-01-08 07:50 AM
It is indeed a F103C6 and I had created a completely new project with F103C6. However, the stack is still the same. Additionally, I have placed the breakpoint in SysTick_Handler and the PC never jumps to that address. Is there any other setting in CubeMx that has to be done for SysTick apart from Timebase source : SysTick? Nvic_Systick is by default enabled and cannot be disabled which seems correct and we should get IRQ.
2025-01-08 07:57 AM
Found the problem: The Boot0 pin had to be kept at 0 even for debugging and then it worked. I don't know whether such setting is as expected.
2025-01-08 08:09 AM
@ronaksm wrote:Found the problem
Great - so please mark that as the solution:
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256
@ronaksm wrote:I don't know whether such setting is as expected.
You'd have to seek out the actual manufacturer of the chip (unlikely to be genuine ST), and ask them.
This might help you with identifying the chip:
https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diagnostics-v1.6.html#diags-1-6