Sunday, May 20th 2018, 5:45pm UTC+2

You are not logged in.

  • Login
  • Register

squonk

Beginner

Date of registration: Apr 21st 2018

Posts: 1

1

Thursday, April 26th 2018, 12:21pm

Getting Started Embedded Studio & Nucleo STM32F103

Hello,

currently I'm trying to getting started with the Nucleo board and Embedded Studio. Therefor I installed the J-Link firmware on my Nucleo board. As far as I can tell the board is recognized as J-Link. Then I wrote a small blinky program trying to set Pin PC10 as output:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
void main(void)
{
  
  RCC->APB2ENR |= (1 << 4);  //IOPCEN=1
  GPIOC->CRH |= 0x500;     	   	//CONF1=0, CONF0=1, MODE1=0, MODE0=1 	
  GPIOC -> ODR |=  (1<<10);    //Set Pin PC10 high

  while(1)
  {

  }
}


For starting the program I hit F5.

The pin shows no action, but I can tell that the uC is running because when I set a breakpoint on the koop it get's hit.

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 1,048

2

Thursday, May 3rd 2018, 9:54am

Hello,

Thank you for your inquiry.
The source you posted does not result in a blinking LED as your while(1) is empty so there is no toggle of the LED pin.
Which eval board are you using exactly? The NUCLEO-F103RB board does not have any LED connected to PC10.
If you are using an external LED make sure you wire it correctly and use a series resistor to limit the current.

As a starting project for blinky LED we suggest using the Embedded Studio pacakge manager. Download the STM32F1xx support package.
Open Tools-> Show Installed Packages-> STMicroelectronics STM32F1xx CPU Support Package-> STM32F1xx Samples Solution

There you will find a SysTick Interrupt example project.
This example will print a message every second. Instead of printing the message you can replace the printf with the toggle of your LED pin (e.g. using XOR).
Now you should have a quick setup of a timed blinky example.

Best regards,
Nino
Please read the forum rules before posting: Forum Rules

Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
Should you be entitled to support contact us per e-mail.
The following contact form can be used for this: https://www.segger.com/about-us/contact-us/