Associate II
January 22, 2016
Question
STM32F103CBT using code from Cube doesn't turn led on
- January 22, 2016
- 5 replies
- 928 views
Posted on January 22, 2016 at 03:27
Steps:
- Create new project on STM32CubeMx (v4.0)
- Set PB3 as GPIO_Output
- Generate code (for Atollic TrueStudio)
- Import the generated files (project)
- Use the following code to try blink the led
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3,GPIO_PIN_SET);
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3,GPIO_PIN_RESET);
HAL_Delay(500); 6. Compile and upload
Result: nothing happens, led stays off.
Note: I'm testing on a custom made board with an STM32F103CBT, and a led correctly connected to PB3. USART works correctly if I add it so chip is ok.
I also tested with init code from
(none Cube generated) and the led blinks successfully, so the problem lies in Cube generated init code or I'm missing something?
Attached a zip with the files (generated by Cube) and my 4 lines added
#stm32f103-gpio-cube