cancel
Showing results for 
Search instead for 
Did you mean: 

Blinking LED

pmamatsis
Associate II
Posted on May 15, 2015 at 08:02

Hello everyone,

   i would like to ask for your knowledge. I am new in Cortex programming (my only experience is on Adruino platform) and i have managed to blink the LEDs on my Cortex device (it's an STM32 conStick from HiTex using the STM32F107VC micro controller) but there is something i cannot quite understand. My question is why since we just want to blink a LED we need to setup the clock on the GPIO port ?

I can understand that the LED is just one of the pins that belong to the same GPIO port but since i am using only the LED why the chip does not allow me to just enable it through RCC and forget about the clock ?

I know that my question might be dump but please bear with me...i am trying to learn here. My background is software engineering so i am completely new (except the Arduino) in the micro controller programming.

Best regards and

thank you in advance,

Panos.

2 REPLIES 2
RomainR.
ST Employee
Posted on May 15, 2015 at 09:12

Panos,

The reason is that on all architectures ARM Cortex-M, every peripherals are clocked by a specific bus (see datasheet RCC domain)

For this reason, to use a pin or more of a GPIO port (or any other peripherals as Timer, ADC or USART...) it's imperative that the peripheral concerned is clocked.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

pmamatsis
Associate II
Posted on May 15, 2015 at 13:51

Hi @rrom and thank you so much for your quick reply,

   in your message you mean because all the GPIO ports (including other pieces) are connected to the APB2 and because of that the system must know how to send receive data from/to all various pieces (regardless if it's a blinking LED or a timer) that's why we must clock the whole port ? Again excuse me if my questions are dumb.

Best regards,

Panos.