Questions tagged [stm32]

1

votes
1

answer
3.2k

Views

Strategies to develop STM32 in application programming

I'm looking for ideas about how to develop a In Application Programming module. We've developed in 'C' a STM32F2xx connection box for our android system. In essence this is only an multi-device to bluetooth information bridge. Now I'm thinking in how to provide a 'in application programming' module...
rpr
1

votes
2

answer
48

Views

Disable dynamic memory allocation?

I'm trying to disable dynamic memory allocation altogether in a low-resource application. I don't ever use malloc/free etc and as far as I can tell neither do any of my dependencies. I've tried zero-ing out the heap in the linker file LinkerScript.ld: _Min_Heap_Size = 0x000; /* required amount of...
tarabyte
1

votes
0

answer
8

Views

MDMA & internal FLASH R/W on STM32H7

Good morning, We're using an STM32H7 to acquire simoultaneously 3 ADC channels 16-bit @ 5MSPS, and we store data in an external eMMC. Everything worth seamlessly as follow : 3 slave-SPI with 3 DMA to internal flip/flop buffers ; MDMA to interleave data to 2 flip flop eMMC buffers ; IDMA of SDMMC per...
Clément G.
0

votes
0

answer
2

Views

STM32L0 Freeze on setting NVIC/GPIO

I'm working with an STM32L073RZ CPU running MbedOS 5.11.2. Eventually I aim to get this working in a very low-power mode (STOP mode) that will be awoken with either an RTC interrupt or an interrupt from a peripheral device on pin PA_0 (WAKEUP_PIN_1). At the moment I am simply attempting to setup PA_...
Adam Mitchell
1

votes
1

answer
1.2k

Views

STM32F4 ADC DMA config not working

I'm trying to get ADC with DMA working on my STM32F411RE nucleo board. the signal is connected to the PC0 pin (ADC channel 10, DMA2), but whenever I check, the uhADC1ConvertedValue is 0. Am I missing something? Is my config wrong? __IO uint32_t uhADC1ConvertedValue; unsigned int getADCVal(){ retur...
prawdziwy-sok
1

votes
2

answer
727

Views

SPI loopback with DMA

Am using STM32F4 discovery board and I am attempting to get SPI loopback with DMA. I have succesfully get an 'SPI-only' loopback running, but now i want use DMA in addition with the SPI, here are the functions am using: Initialisation of SPI [EDIT] void init_SPI1(void){ NVIC_InitTypeDef NVIC_Ini...
fedi
1

votes
2

answer
972

Views

STM32L1x Stop mode + RTC too much current

I am able to put my stm32L1xDiscovery board in STOP mode with RTC running. according to the datasheet this should draw about 1.3 µA. But my application draws 3.3 µA. I noticed I did not put the FLASH in a low power mode during sleep. But when I did this, nothing changed. This is what I use to go...
MartijnJonkers
1

votes
1

answer
1.1k

Views

FreeRTOS debugging with openOCD

I'm trying to understand what is needed to have kernel aware debugging with openOCD and debug FreeRTOS. My setup is the following: stm32f401c discovery board, eclipse, openOCD 0.10, gdb. Basically, the SW4STM32 1.8.0 package. I've already done the following: added $_TARGETNAME configure -rtos auto t...
G. Ko
1

votes
2

answer
136

Views

Conditional statements based on #define's name

I just started doing some C (coming from Java). I'm trying to figure out what the language's approach to a conditional based on a define's name is. e.g. I have a huge header file that I can't(shouldn't) edit with a lot of defines. #define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001)...
Enders
1

votes
1

answer
446

Views

STM32F4 DMA seems to be overflowing

I'm having a problem in with STM32F4 DMA. I have set up my DMA config as follows in circular mode: hdma_usart1_rx.Instance = DMA2_Stream2; hdma_usart1_rx.Init.Channel = DMA_CHANNEL_4; hdma_usart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY; hdma_usart1_rx.Init.PeriphInc = DMA_PINC_DISABLE; hdma_usart1_...
Gilberto Melo Jr
1

votes
3

answer
815

Views

STM32F405 bxCan does not leave init mode

When I try to init bxCan on STM32F405 MCU, it does not set CAN_MSR_INAK after leaving request. Here is my code: rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_CAN2EN); nvic_enable_irq(NVIC_CAN2_RX0_IRQ); can_reset(CAN2); if (can_init(CAN2, // Can false, // Time triggere...
popzxc
1

votes
2

answer
173

Views

Speed up blinking leds after 2 seconds

In my ST32L c application I want to speed up the blinking LEDs. With the code below I can press the button and the LEDs will blink faster. When I release, the LEDs will blink normal. How can I check if a button is pressed for minimal 2 seconds and after that speed up the LEDs? int i = 0; while (1)...
Mees van Z
1

votes
1

answer
3.3k

Views

freeRTOS: How to pass data between tasks? [closed]

I am looking for an example that present a proper way to pass data between tasks: Lets say I have a display, keyboard and some sensors eg. internal ADCs. I would like to show values from all sensors at some time on a display. After pressing a button, changing a view and presenting some text. After p...
user3700538
1

votes
1

answer
2.4k

Views

What is the correct way to format data to send by HAL SPI in STM32?

I am trying to read/write data from ST EEPROM M95640-W Acording to datasheet, for read operations data command must be formated like: First is 8-bit instruction 'Read from Memory Array': 0x03 (B00000011) Second is 16-bit address. But when I send command and data I got this: Address 0x0001 (B00000001...
Bulkin
1

votes
1

answer
750

Views

stm32f4 CAN receiver_IT issue

Next in my little project(stm32f407vg) is to receive can messages from another hardware(PIC 18L25K80) I currently have working an UART to my computer so I can easily debug the chip via UART. The problem is that I receive the message, the interruption gets triggered but what I read from rxMessage is...
taquionbcn
1

votes
1

answer
462

Views

How to create a function for configuring defined ports on a stm32f4xx platform?

I am using stm32f4xx with HAL library and I have configured some ports like this: #define Led1 GPIO_PIN_1 #define Led1_Port GPIOC #define Led2 GPIO_PIN_2 #define Led2_PoRT GPIOE GPIO_InitStruct.Pin = Led1; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStr...
O.Blue
1

votes
2

answer
7.4k

Views

stm32f103 ADC sampling rate

I set adc sample time cycles here : ADC_RegularChannelConfig(ADC1, ADC_Channel_17, 1, ADC_SampleTime_71Cycles5); How to calculate sampling rate of ADC from that in stm32f103 ?
Radek23445
1

votes
1

answer
1.4k

Views

STM32F0 SPI receive interrupt not firing

I have a simple project, created using CubeMX for the peripheral initialisation. SPI is in slave mode, and appears to be initialised correctly, but when I clock 8 bits of data, the interrupt doesn't get called. Here's the code /* SPI1 init function */ static void MX_SPI1_Init(void) { hspi1.Instance...
OXO
1

votes
2

answer
318

Views

STM32L073 freeze when I use __WFI()

With my STM32 I'm trying to configure a deepSleep mode and use RTC to generate interruption (actually each 30 seconds). When my STM start, this one configure the RTC and directly go in Stop mode. After 30 seconds the board is waking up and use Serial to configure LoRa Radio module RN2483 with the Se...
Simon NOWAK
1

votes
1

answer
1.7k

Views

STM32 DMA Memory to memory transfer only fires once

I am using an STM32F103, attempting to copy from one array to another using DMA. The transfer works the first time and a breakpoint in DMA1_Channel1_IRQHandler is hit, but subsequent calls to DMA_Cmd(DMA1_Channel1, ENABLE) have no effect and the breakpoint is not hit. Error flag DMA1_FLAG_TE1 is not...
Batperson
1

votes
2

answer
300

Views

STM32F103C8/CoIDE/ST-LinkV2 Can't update registers

I'm new to STM32, not to embedded development (experience with PIC, dsPIC, MSP430). Environment CooCox CoIDE arm-none-eabi-gcc ST-LINK V2 (have encountered same with Segger J-Link) over SWD Problem Description I am trying to write a basic library using direct register manipulations (STMCube HAL is c...
slightlynybbled
1

votes
1

answer
1.3k

Views

Handling multiple LwIP connections at the same time using netconn

I try to establish several simultaneous connections using LwIP netconn API (on stm32f4 discovery board). All of them are in their own threads and work perfectly. But for some reason only one connection can be established at the same time. My code is based on ST echo server example and looks like thi...
Logen Sand
1

votes
1

answer
286

Views

IAR error with ST link code

I'm trying to use the Sensor Tile from ST. I downloaded the project, but when I tried to rebuild it in ST it issues this error: Error[Li005]: no definition for '__iar_FSin' [referenced from motion_fx.o(MotionFX200_CM4F_IAR_ot.a)] Does someone know?
alan
1

votes
1

answer
98

Views

Why do I have more flash (STM32F103RCT6) than what my datasheet says?

I'm writing a firmware to a STM32F103RCT6 microcontroller that has a flash of 256KB according to the datasheet. Because of a mistake of mine, I was writing some data at 0x0807F800 that according to the reference manual is the last page of a high density device. (The ref. manual make no distinction o...
J. Santos
1

votes
1

answer
57

Views

Defining value according a specific value at memory location

I have an issue with defining value according a specific value at memory location. Basically I want to read a value at specific memory location and create a define from this value. And then use this same define to define again a new value according the first define value when compiling the code. Her...
LOSnel
1

votes
2

answer
745

Views

Keil ARM compiler for eclipse

I am trying to go 'all free' regarding the price for the software. So I decided to develop my code for STM32F0 in Eclipse and in Ubuntu. I tried with different options regarding adding ARM toolchain to Eclipse. The best I find is to download the special Eclipse version http://www.openstm32.org. But...
Nibelung26
1

votes
1

answer
61

Views

SPI configuation as master

I need to configure SPI_1 as master in Nucleo STM32F103RB. Here's what I did so far (Keil uvision 4). // Configuring GPIOs // SPI_SCK GPIOA_CRL |= 0x00A00000; //Alternate function push-pull // SPI_MOSI GPIOA_CRL |= 0xA0000000; //Alternate function push-pull // SPI_MISO GPIOA_CRL |= 0x04000000; //Inp...
Muzahir Hussain
1

votes
1

answer
331

Views

Why doesn't this simple STM32F756 timer code work?

Sourced to internal clock at APB1=96 MHz, I want to start a count up from zero via software command and generate a timer interrupt when the auto-reload register value is reached. I can only get the interrupt to fire if I use the HAL function HAL_TIM_Base_Start_IT that both activates the UPDATE inter...
michaelm700
1

votes
2

answer
37

Views

How to used delays when using debugger with STM32?

I am using ST Link debugger on STM32F407 MCU. I have issues relating to data not loading in correct manner in between differnt circular buffers, used to extract bytes from USART. I wanted to see how thread which extracts frames from the serial [4000] array behaves with added delay. Below code plays...
mega_creamery
1

votes
0

answer
4

Views

Connect Android Device as a USB Device with STM32 as a USB Host

I want to connect the Android device as a USB Device to an STM32 board which acts as a host device. My application code for Android looks like: Android Manifest So when I am trying to get the connected USB device details, the USB Device list is always null : UsbManager manager = (UsbManager) getSys...
Vasu Patel
1

votes
4

answer
99

Views

How to use formatting strings in user-defined functions?

I want to write a function to print characters on an LCD in a similar way that printf/sprintf does using formatting strings.
sixter
1

votes
1

answer
97

Views

Why can't I read interrupt flag from my main loop?

I'm writing code for stm32l011 MCU and it have to do one basic task for now - wait for a specific byte(predefined by me) from the UART and following '\r\n' or '\n\r' sequence. If it receives that, it set's a null pointer to the address of the predefined char, which is read and handled in the main lo...
Hristo Mitrev
1

votes
1

answer
316

Views

How to trigger interrupts from a GPIO [closed]

I'm porting a toy app to the RTFM framework, and have a hard time figuring out how to trigger an interrupt via GPIO. fn init(p: init::Peripherals, _r: init::Resources) -> init::LateResources { let dp: stm32f103xx::Peripherals = p.device; let mut rcc = dp.RCC.constrain(); let mut gpioa = dp.GPIOA.spl...
Michael Böckling
1

votes
2

answer
125

Views

Count Cycles not matching on STM32F103C8? Prefetch buffer not working as I think?

I have been fighting this subject for a while. I am using STM32F103C8 with the ST-Link V2 on Atollic. I made some delay functions on assembly. I have been testing this piece of code using a oscilloscope on ATSAM (84 MHz and work perfectly) and on STM32 I also use a CPU register to see the exact amou...
1

votes
2

answer
1.6k

Views

Reading STM32 timer value

I am using a STM32F103 chip and I am trying to configure and use one of the timers. I have used STM32CubeMX to generation code which initializes Timer 2. I start the timer by calling HAL_TIM_Base_Start. Then, in a loop, I print out the current timer value via a call to htim2.Instance->CNT, or altern...
John Gaby
1

votes
1

answer
414

Views

STOP2 mode with FreeRTOS in STM32

I am developing a low power application with STM32L476 (with FreeRTOS). I am using SW4STM32 and STM32CubeMx. I have gone through the Tickless idle mode example which uses sleep mode. I need more power saving, so i am planning to use STOP2 mode. Is it possible to use STOP2 mode along with FreeRTOS?
Nithin Kurian
1

votes
1

answer
526

Views

Formulae to calculate PWM output Timer (Counter settings) for STM32

Need formulae to calculate Prescaler,Counter Period and a Pulse value of each channel on a Timer with given values of Input clock frequency (APB) Output Frequency (PWM) Duty cycle (for each channel)
TonyP
1

votes
1

answer
242

Views

STM32 SPI dropping data while using interrupt

I'm trying to send a variable size array of bytes over SPI using interrupts. The system is composed by two nucleo STM32L432 boards. The sender board works fine, but I'm having issue with the receiver board. Specifically, I noticed that very often some bytes are dropped. Beyond the default initializa...
Alek
1

votes
2

answer
170

Views

Cannot Blink JTDI pin

I am using STM32F103RCT6 to blink a LED which is connected to PA15 - JTDI in PU. My GPIO Configuration is like this GPIOA->CRH |= GPIO_CRH_MODE15; //Output mode, max speed 50 MHz. GPIOA->CRH &= ~GPIO_CRH_CNF15; //General purpose output push-pull\ And I am trying to Blink Like this #define...
Devjeet Mandal
1

votes
3

answer
356

Views

STM32 code uploads successfully but doesn't run

I'm new to STM32 and I followed the instructions here in order to program my first stm32f103c8t6 board in Ubuntu. Here is the code which I added to the source code: int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------...
Yashar

View additional questions