P
P
pixik2015-08-13 15:00:26
linux
pixik, 2015-08-13 15:00:26

How to blink a diode on stm32l152 DISCO under Linux?

Hello!
I bought the STM32L152 DISCOVERY board to broaden my horizons. The first problem is how to blink the diode, namely, how to set up the environment in order to compile the written code and flash the board. I work under linux.
I found this tutorial , but there all the configs and cmaks are written under stm32F4, and this is a completely different processor.
I installed the GNU/ARM toolchain and STLink, found libraries and examples for my board (but they are for complex environments like keil, aim, etc.) but I don't know how to compile them from the command line and upload them to the board.
Kick please in the right direction, I will be very grateful.
Thanks to all!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-08-16
@pixik

Install at least a demo version of Keil. The 32kB code limit is more than enough to get you started.
Ready-made examples can also be found online.
Minimum - GPIO setting, and change the state of the pin through a timer.
For example, like this:

int main(void) {
  RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
  GPIOA->MODER |= 1;	// GPIOA.0.MODE -> out mode
  GPIOA->OSPEEDR |= 3;	// GPIOA.0.SPEED -> MAX SPEED
  while(1) {
    for (uint32_t i=0;i<1000000;i++) {};		// Пауза
    GPIOA->ODR ^= 1;	// Toggle GPIOA.0
  };
};

This code will flash pin PA0.

A
Armenian Radio, 2015-08-13
@gbg

It is advisable to start flashing the diode on something simpler, such as AVR. When you distinguish the translator from the compiler, then you can take the STM32.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question