FAQ Database Discussion Community

Software SPI Implementation

I'm thinking about creating my own pure-C software SPI library because there are none available (as far as I can tell). Which also worries me - why aren't there any software SPI libraries? Is there some hardware limitation I'm not considering? EDIT: I've decided to write my own library due...

What are the steps to setup an RTOS application on STM32 using Linux and Makefiles instead of using Windows based IDEs?

I am using STM32F4 Discovery board to develop a simple application to on-board accelerometer while simultaneously lighting respective LEDs mounted around the accelerometer device. I want to use any RTOS but I am unable to decide which one since I am new to using RTOS. If anyone could elaborate the...

STM32 flashing disabled after flashing a code without R/W protection

I have some experience of StdPeriph libraries usage for programming stm32. But now I tried STM32Cube HAL with STM32CubeMX code generator. I generated a project with this options: Middleware: FreeRTOS and FatFS via SDIO Compiler is GCC stm32f103ret6 MCU I imported generated code to Eclipse environment. I made a binary...

How do you jump to the bootloader (DFU mode) in software on the STM32 F072?

The STM32 App Note 2606 discusses this, but there is no simple code example.

Pointer to peripheral hardware as template parameter

I want to access STM32F0 peripheral register through C++ templates. A GPIO Port is defined as follows by vendor header file: excerpt stm32f0xx.h #define __IO volatile //!< Defines 'read / write' permissions typedef struct { __IO uint32_t MODER; __IO uint16_t OTYPER; uint16_t RESERVED0; __IO uint32_t OSPEEDR; __IO uint32_t PUPDR; __IO...

Allocating memory in Flash for user data (STM32F4 HAL)

I'm trying to use the internal flash of an STM32F405 to store a bunch of user settable bytes that remain after rebooting. I'm using: uint8_t userConfig[64] __attribute__((at(0x0800C000))); to allocate memory for the data I want to store. When the program starts, I check to see if the first byte is...

What responsibilities are to comply C\C++ standard?

Little bit stupid question. For example I've read, that in C11 was added support of threads. Then, for example GCC compiler for my STM32F4 said, that it supports C11 standard. So, does it mean now, that without OS I'll achieve threading support??? But how it can be? Another example -...

STM32F103 hangs on page update with USART enabled

I am currently working on a STM32F103, and I want to program the flash. However, it appear that programming the flash with an USART device receiving bytes in the same time make it hangs: FLASH_BASE->CR |= FLASH_CR_PER; while (FLASH_BASE->SR & FLASH_SR_BSY); FLASH_BASE->AR = pageAddr; FLASH_BASE->CR |= FLASH_CR_STRT; // Hangs forever...

UART over USB for STM32 Micro-controller

I'm trying to implement UART over a USB interface on the STM324x9I-EVAL development board. The purpose is to send commands to a servo controller (or other hardware, for that matter) serially. I've successfully implemented the USB_Device_CDC example on the development board but am unsure exactly how this works without a...

STM32 Large binary created when using malloc

SOLVED. SEE THE SOLUTION SECTION BELOW. I've got a problem where my build environment is outputting a large binary file, and I'm hoping that someone can help get me moving again. I'm using an STM32F105 processor, Eclipse, FreeRTOS, and CodeSourcery compiler to try to get some AHRS evaluation code running...

ADC single conversion on STM32

I'm studying ADC programming on STM32 F103x and starting with the simplest case - single conversion. The internal temperature sensor (connected to ADC1) value is measured and sending it to COM port by using USART. A target seems clear but when I try to download source code to flash, it...

STM32 STM32CubeF4 USB CDC operation

I built the code from the STM32CubeF4 for the USB CDC example. I added the missing receive code for CDC_Receive_FS() in usbd_cdc_if.c. I loaded this into my STM32F4 Discovery and it works. A character typed on Tera Term returns and is displayed on Tera Term. I am hoping that someone...

STM32 boot from user flash

The STM32 gives options to boot from user Flash, system memory and embedded SRAM. On the firmware side does "boot from user Flash" means executing a custom bootloader?

STM32F4 - can I use delays in interrupt routines?

I'm using an STM32F4 discovery board for a project and am wondering if I'm approaching the problem correctly. When I press a button, an external interrupt is triggered which runs a routine; without using a delay, this part works fine. As the routine moves a servo then returns it to...

STM32F0-Discovery: no tty

I am currently trying to send data to my STM32F0308 board via USART. The data is supposed to be sent by a Python script using PySerial. However, when I plug in the board, I cannot find the corresponding /dev/ttyXXXX. The board is branched and I can flash code on it...

What is the effect of ' \n'?

I have caused an effect which I really don't understand: char buffer[6]; UINT i = adc_getADCValue(6); int j = 0; for ( j = 0 ;j <4;j++){ buffer[3-j] = (UINT) ((i%10UL)+'0'); i /=10; } buffer[4] = '\n'; buffer[5] = '\0'; localprint(buffer); // print messages on terminal using COM port it...

How can I align stack to the end of SRAM?

I have a STM32F103VCT6 microcontroller with 48kb of SRAM, and recently i've got a memory collision: I have some static variable (lets call it A) located in heap with size of 0x7000 and I wrote some simple function to get info about stack and heap: void check(int depth) { char...

Issues with converting int to char in C

I've wrote a small function for debug purpose which sends string via USB to a terminal : void localprint(char* msg){ if(strlen(msg) > 60){ usb_sendData(msg,60); } else usb_sendData(msg,strlen(msg)); } the function works fine for strings like : localprint(" I'm a test" ), the message is displayed on terminal. Now I want...

STM32: Booting and fetching vector table from SRAM

I would like to run my program from the SRAM region of the device. It seemed quite clear to me, that I have to perform following steps: Modify the vector table offset register SCB->VTOR (located at 0xE000ED08) to point to the beginning of the SRAM region, as that is where...

Converting bits of a byte to single bits and back

I have the struct below typedef struct fpButtons { /** BYTE 0 **/ uint8_t button_1:1; uint8_t button_2:1; uint8_t button_3:1; uint8_t button_4:1; uint8_t button_5:1; uint8_t button_6:1; uint8_t button_7:1; uint8_t button_8:1; /** And BYTE 2 which I didn't paste to save SO's space lol **/ // button_9:1 to button_16:1 } FP_BUTTONS; And...