Questions tagged [libopencm3]

This tag is for questions about using libopencm3 library. This includes coding using libopencm3 library and library code itself.

libopencm3 is a library written in C. It provides framework for abstracting hardware interfaces of various ARM Cortex-M3 controllers. So it's in some way a HAL (Hardware Abstraction Layer) for creating more unified firmwares code that can be easily ported to another Cortex-M3 controllers. This library also simplifies programming, providing high-level API to hardware.

libopencm3 replaces CMSIS and STM32 Standard Peripheral Library.

Links:

[1] Official site

[2] Git repository

[3] Examples

[4] Documentation

[5] Wiki page

40 questions
7
votes
2 answers

Global variables between C and C++

I'm developing a mixed C/C++ program for an ARM STM32F4, but I have problems in accessing global variables defined in the C part. Here is a simple test code to reproduce the problem. test.h: #ifndef TEST_H_ #define TEST_H_ #ifdef __cplusplus extern…
apalazzi
  • 73
  • 6
6
votes
1 answer

How to detect button press on stm32f4discover?

I like to detect a button press to switch through the 4 LEDs on the board, like Click-1 --> LED 1 on Click-2 --> LED 2 on Click-3 --> LED 3 on Click-4 --> LED 4 on Click-5 --> LED 1 off Click-6 --> LED 2 off Click-7 --> LED 3 off Click-8 --> LED 4…
David Gölzhäuser
  • 3,525
  • 8
  • 50
  • 98
5
votes
0 answers

STM32 USB OTG: how does one properly flush the Tx FIFO?

STM32 manual for the F4xx series chips says that the application writes TXFFLSH bit in the OTG_FS_GRSTCTL register to flush the TxFIFO. As a note it mentions that ...application must write this bit only after checking that the core is neither…
alexsh
  • 1,121
  • 8
  • 12
4
votes
1 answer

"expected a declaration" in QtCreator on valid code

I'm working in a C project with QtCreator (yes it's primarily for C++, but so far it worked OK for C). Now I'm getting a red underline on a valid code that compiles fine: It's basically this unchanged libopencm3 example project for a Virtual COM…
MightyPork
  • 18,270
  • 10
  • 79
  • 133
3
votes
2 answers

Direct memory access RX for the STM32L1

I've been trying for a while now to transmit a block of data from my computer to an STM32L100C-DISCO over USART. For performance reasons, this is to be done using DMA. So far, however, I have not been able to get it to work. As I cannot seem to…
Joost
  • 4,094
  • 3
  • 27
  • 58
3
votes
1 answer

Using operators for I2c operations

I have a STM32F2 controller and a FRAM device FM24V10-G connected to it via I2C. Usually, in order to communicate with I2C devices I use a library, based on libopencm3. However, using FRAM requires a slightly different order of I2C actions(like…
Egor
  • 401
  • 1
  • 7
  • 14
2
votes
1 answer

organizing code into modular, self contained blocks

I am seeking help from the wisdomous. :-) This is less of a technical help about testing itself and more of a code organization issue. I m working on a project with an STM32 using the libopencm3 HAL and ceedling as the test suite. I m keeping the…
2
votes
1 answer

Libopencm3 interrupt table on STM32F4

I'm using libopenCM3 for my project on STM32F4. I've used previously Standard Peripheral Library and newer Hardware Abstraction Layer developed by ST. In these libraries you have assembly file (startup file) with the definition of vector table. This…
phodina
  • 1,341
  • 1
  • 12
  • 25
2
votes
1 answer

STM32 DMA: bytes remaining in buffer, encoded?

For quite a while now I've been struggling with DMA communication with two STM32 boards in some form or another. My current issue is as follows. I have a host (a Raspberry Pi) running the following code, waiting for the board to initialise…
Joost
  • 4,094
  • 3
  • 27
  • 58
2
votes
2 answers

Generating sine wave on STM32F3 with DMA - garbled output

I am trying to generate a waveform using a const table, DMA and DAC. This is the STM32F303VCT on a Discovery F3 board. I am using libopencm3, but I hope you'll clearly see what is happening - it's all just functions to set the control…
MightyPork
  • 18,270
  • 10
  • 79
  • 133
2
votes
1 answer

C++ Makefile LD Error

I'm programming an ARM in C++ with libopencm3. But my Makefile contains errors. Like you can see now! I have following Makefile: Q = @ RM = @rm -f MAKE = make CC = arm-none-eabi-gcc CPP =…
Martin Fischer
  • 697
  • 1
  • 6
  • 27
2
votes
2 answers

How to find the device id of a STM32F103RET

I have been told that each STM32F103RET devices carry a unique device id.If so what is the procedure to retrieve the ID?I am running a system wherein I communicate with more than one STM borads. To differentiate each STM board I can use this unique…
bislinux
  • 193
  • 2
  • 3
  • 12
1
vote
0 answers

nvim clangd problem with #define, #ifdef, and BEGIN_DECLS

This is a minimal stm32 project based on libopencm3 library. The problem is clangd language server in neovim, does not detect definitions in some header files and throws errors. For example if you open the header file libopencm3/stm32/dma.h which is…
mehdi
  • 167
  • 11
1
vote
0 answers

How to build with OpenCM3 + FreeRTOS + CMake to ARM CM4?

I am trying to program an ARM STM32F407 on an STM32F4Discovery board. First, I built a project with OpenCM3 + CMakeLists.txt. It worked! The LED flashed. ;-) Now, I'm trying to make the same project with OpenCM3 + FreeRTOS + CMakeLists.txt. Is not…
1
vote
1 answer

Blackpill STM32F411CEU6 - PWM with libopencm3 not working

I'm trying to get PWM working with timer 3, I've followed the reference manual and believe i have everything correct but i get nothing on the output. My code is below, I must be missing something rcc_periph_clock_enable(RCC_GPIOB); …
IAMCB
  • 13
  • 3
1
2 3