Developer support experience survey - We value your feedback
Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hello,I am using a STM32F427 to read and write data to EEPROM Serial 256-Kb SPICAT25256. I use LL API, and DMA full-duplex over SPI. I manage myself the Chip Slect signal.I can see with logic analyser that datas are sent and received to/from EEPROM correctly.But I do not have interruption from DMA, neither input or outputstream.I do not understand why.The only way to detect the end of the transfer is to look at the BSY flag LL_SPI_IsActiveFlag_BSY(pSPI_Instance). Could-you help me to find where is the problem?Thank you for help.Best regards, FWX.I
HiI have a project using lwIP, created by STM32Cube.It works fine, but I really want to shut OFF the debug messages.I have searched and tried a bunch of different things, but nothing seems to be able to stop it. Example of error/debug message: "netif is not up, old style port?" failed at line 744 in C:\..." Thanks
Hello,I am new to STM32 and I am trying to write into FLASH memory using some reference code I found in internet. Here is my write function:uint32_t Flash_Write_Data (uint32_t StartPageAddress, uint32_t *Data, uint16_t numberofwords){ static FLASH_EraseInitTypeDef EraseInitStruct;uint32_t PAGEError;int sofar=0; /* Unlock the Flash to enable the flash control register access *************/HAL_FLASH_Unlock(); /* Erase the user Flash area*/ uint32_t StartPage = GetPage(StartPageAddress);uint32_t EndPageAdress = StartPageAddress + numberofwords*32;uint32_t EndPage = GetPage(EndPageAdress); /* Fill EraseInit structure*/EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;EraseInitStruct.Page = page_indx;EraseInitStruct.NbPages = ((EndPage - StartPage)/FLASH_PAGE_SIZE) +1; if (HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError) != HAL_OK){/*Error occurred while page erase.*/return HAL_FLASH_GetError ();} /* Program the user Flash area word by word*/ w
Im trying to communicate between nucleof446re board with other processor board using UART.Communication works fine when I connect my nucleo board with USB power supply but when I connect nucleo with external 3.3V or 5V supply the communication does not happen.Can I know what might be the reason. I have connect Tx Rx and GND of both the boards. Thank You
Hello I have a Nucleo-H723ZG and I'm trying to build a custom bootloader with CMSIS v2 that need a TCP connection. Since it needs to receive 1KB of data through TCP I've made the receive array long 1024 bytes, but this size crashes the whole LWIP making the TCP connection impossible and unable to respond to ping.#include <stdint.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "lwip/opt.h" #include "lwip/api.h" #include "lwip/sys.h" #include "lwip/sockets.h" #include "cmsis_os.h" #include "cmsis_os2.h" #include "main.h" #include "my_tcp.h" static osThreadId_t my_tcp_task = NULL; const osThreadAttr_t my_tcp_task_attr = { .name = "my_TCP_task", .stack_size = 128 * 26, //128 * 26 .priority = (osPriority_t) osPriorityNormal, }; uint8_t tcp_received_data[PACKET_SIZE]; //Works only with 1012 instead of 1024 const char go_data = 'Y'; const char stop_data = 'N'; static void my_tcp_task(void *args); void TCP_init(void) { memset(tcp_recei
Hi,I want to compare a couple of different ways to implement the same functionality in an ISR to see which one leads to the smallest/fastest code. Is there a way - after compiling but without running a debug session - to see the disassembly code after each instruction? Also - regardless of whether there is such way or not - what other ways can you see the number of cycles it takes for a chunk of code to execute, again, without running a debug session on the micro. Thank you
Hello, all. I am currently trying to program a black pill board to print out the output from a sound sensor, for which I use the Arduino IDE 2.3.2. Used components:- STM32F411CEU6 black pill- KY-037 sound sensorCurrent connections:- the "G" pin from the sensor is connected to the "GND" pin on the black pill- the "+" pin from the sensor is connected to the "3v3" pin on the black pill- the "A0" pin from the sensor is connected to the "A9" pin on the black pillThe code: #define DIGITAL_INPUT PA9 void setup() { Serial.begin(9600); pinMode(DIGITAL_INPUT, INPUT); } void loop() { Serial.println(analogRead(DIGITAL_INPUT)); } This code prints out values around 270-290 and it doesn't seem like creating any loud noises has any effect on the output, and neither does changing the potentiometer on the sensor itself. What I am trying to get is an output that has a clear and visible change between different amounts of noise. I am starting to think that the current outpu
Hi,I am using a STM32L452RET6 (without any RTOS) and I would like to use the same timer for both:- drive a sounder on PWM at 4KHz (but ideally also other changing frequencies above and below 1ms time period so it can make more elaborate sounds which)- generate and also 1ms interrupt to check other tasks. What would be the best way to configure and use the micro to implement that? Thank you as always :)
Hi,during implementation of a bootloader I have encountered a problem.I'm using stm32 standard peripheral library.During writing to flash, for example at address: 0x0800C000 or 0x08010000 when the 18th line: FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data) { FLASH_Status status = FLASH_COMPLETE; /* Check the parameters */ assert_param(IS_FLASH_ADDRESS(Address)); /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(); if(status == FLASH_COMPLETE) { /* if the previous operation is completed, proceed to program the new data */ FLASH->CR &= CR_PSIZE_MASK; FLASH->CR |= FLASH_PSIZE_WORD; FLASH->CR |= FLASH_CR_PG; *(__IO uint32_t*)Address = Data; /* Wait for last operation to be completed */ status = FLASH_WaitForLastOperation(); /* if the program operation is completed, disable the PG Bit */ FLASH->CR &= (~FLASH_CR_PG); } /* Return the Program Status */ return status; } static void flashPage(vo
Hi everyone,I have written class that handles U(S)ART communication on top of HAL. In my application I have several objects of that class, e.g. one for USART2, another for LPUART1,...Currently, I have my own way of registering callbacks: I have static method that stores, which UART handle (UART_HandleTypeDef) belongs to which of my object. The callback function then looks up what object is responsible for the handle passed to it. E.g.: void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) { UartComm* uc = UartComm::get_object_by_UART_Handle(huart); if (uc == nullptr) { return; } uc->RxEventCallback_(Size); } If understand correctly, the HAL provides HAL_*_RegisterCallback, which would allow a similar registration directly. Having "ordinary" functions this should be straight forward but in my case I would need binding to an object method.Is there a clean / preferred way of doing so? Or better stick with the current solution :\I am
Hi all, i decided to write a simple program on my stm32 board (B-L475E-IOT01A), here are some of the setting of my peripheral: i read input data from channel 2 sampling data on rising edge The clock frequency at which the microphone is outputting PDM bits is 80 Mhz (by clock tree) divided by 40 using the internal prescalerfor the filtering on pdm signal i choose (by using the table) sinc3 with FOSR = 32, so that my output data is represented on a 16 bit signed integer.the dma mode is circular and i use one bufffer for dma and the other buffer for pcm samples, the samples are mono so the audio buffer contains only one channel sampleshere is a snippet of my code, i didnt include half buffer and full buffer callbacks, they just update the associated flags. The problem with this program is that, the audio buf data is always negative (which i suppose is wrong because we are talking about some pcm waveform). What am i doing wrong?
Hello everyone, thanks for your help.I have a problem regarding the states of inputs that were set exactly the same way.After powering all 10 inputs simultaneously, inputs IN4, IN5, IN6 and IN7 are not in SET, the others are in SET. Relevant data:Using STM32U535RCT6Q, Azure RTOS, IAR/* Private defines -----------------------------------------------------------*/#define IN1_Pin GPIO_PIN_0#define IN1_GPIO_Port GPIOB#define IN2_Pin GPIO_PIN_1#define IN2_GPIO_Port GPIOB#define IN3_Pin GPIO_PIN_2#define IN3_GPIO_Port GPIOB#define IN4_Pin GPIO_PIN_10#define IN4_GPIO_Port GPIOB#define IN5_Pin GPIO_PIN_13#define IN5_GPIO_Port GPIOB#define IN6_Pin GPIO_PIN_14#define IN6_GPIO_Port GPIOB#define IN7_Pin GPIO_PIN_15#define IN7_GPIO_Port GPIOB#define IN8_Pin GPIO_PIN_6#define IN8_GPIO_Port GPIOC#define IN9_Pin GPIO_PIN_7#define IN9_GPIO_Port GPIOC#define IN10_Pin GPIO_PIN_8#define IN10_GPIO_Port GPIOCSummary code for reading the pins used: typedef struct{ GPIO_TypeDef* Port;&nb
I am using an STM32 Nucleo H563ZI board for stm32CubeIDE and I am trying to send AT commands to a Telit LE910C4-WWX threadx modem over usb using the usbx host and threadx middleware. My program should be able to detect the modem as a cdc acm device, but it's failing to enumerate. When I connect a usb mouse to the Nucleo, it can enumerate properly as an hid mouse, which leads me to believe that the modem might not be properly configured. When I connect the modem with the configuration AT#USBCFG=1, it steps through the _ux_host_class_cdc_acm_entry() function 7 times, and the last time, it is able to check for IAD presence, but the IAD class is 2, and the IAD subclass is 0, so it still fails. Is there some other configuration for the modem I need to do, or do I need to modify the usbx driver or the ioc file?
Hi,I have an STM32L412RBT6P microcontroller and a CFAG12864T3-NFH LCD which uses an ST7565 controller. I want to use SPI to communicate with the LCD and leverage DMA to efficiently transfer data with lowest current consumption possible. Could someone provide an example code or any helping notes on how to set this up? Specifically, I'm looking for:1. Initializing the SPI peripheral on the STM32L412RBT6P for communication with the ST7565 controller.2. Configuring DMA to handle data transfers from memory to the SPI peripheral.3. Sending initialization commands and data to the LCD with ST7565.Any help would be greatly appreciated!
I have a high-resolution timer configured at some frequency. This master timer has three other timers associated to it, where each timer also runs at the same frequency. But the trigger events of these timers are compare values from the master timer, that generate update event to trigger the reset of these timers.This works and all and I am using LL APIs but I need now at some point to change the period of these timers to a lower frequency. I know I can change the period using LL APIs while running. But can I do so without causing any glitches?I have 6 outputs (2 for each timer) set to 50% duty cycle.My approach would be to use the functions as follows, but instead of doing a jump in the period, I do in a ramped fashion. Which means each run of the mainLoop I changed the period and then apply the code shown for all timers.Then after 10 mainLoop runs, the change of frequency is completedLL_HRTIM_TIM_SetPeriod(HRTIM1, LL_HRTIM_TIMER_MASTER, NEW_PERIOD); LL_HRTIM_TIM_SetPeriod(HRTIM1, LL_
Hello @ST Community I am using STM32F769I-disco to save real time data in SD card with SDMMC2 & FATFS. The sensor value are type float. The problem is that there are saving data in the file of SD card but the screen freeze.this is the code that i am using: static void MX_SDMMC2_SD_Init(void) { /* USER CODE BEGIN SDMMC2_Init 0 */ /* USER CODE END SDMMC2_Init 0 */ /* USER CODE BEGIN SDMMC2_Init 1 */ /* USER CODE END SDMMC2_Init 1 */ hsd2.Instance = SDMMC2; hsd2.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING; hsd2.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE; hsd2.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE; hsd2.Init.BusWide = SDMMC_BUS_WIDE_1B; hsd2.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE; hsd2.Init.ClockDiv = 0; /* USER CODE BEGIN SDMMC2_Init 2 */ /* USER CODE END SDMMC2_Init 2 */ } char wGlobalText[500]; char rtext[512]; void init_sd_card(void) { // Initialiser le chemin de la carte SD s
Hello,Because there are negative side effects of using FatFS in my program to write logs to an SD Card, I am trying LittleFS library with an implementation of the HAL library.When I mount the filesystem &lfs I get a result of -84 which indicates that the fielsystem is corrupt. I made sure I tested and formatted the sd card.I believe that my implementation of the device block operations is not complete. see attachment.extern const struct lfs_config cfg = { // Block device operations .read = user_provided_block_device_read, .prog = user_provided_block_device_prog, .erase = user_provided_block_device_erase, .sync = user_provided_block_device_sync, // Block device configuration .read_size = 16, .prog_size = 16, .block_size = 4096, .block_count = 128, .cache_size = 16, .lookahead_size =
Hii I am using STM32F103C8T6 controller and i want to initialize UART 7-Bit mode as per this configurations none Partiy Bit and 1 stop Bit. But in the controller has these two parameters UART_WORDLENGTH_8B & UART_WORDLENGTH_9B. Then how to init UART in 7-Bit mode. Please Help me to Complete this task.
Hi all,We want to make an application where users can update their devices. We want to rollback if the update failed. For this, we initially took a dual boot bank MCU, the STM32L471RG. But after being busy building a bootloader for it, I don't know if I really need dual boot banks.I think I can get away with a single boot bank, and defining two blocks of memory as two possible app locations. The bootloader will decide which is the newest, and if it passes CRC check. Or does dual boot banks really makes this easier?Some questions:My bootloader lives at the start of the memory, should it live in both banks, if I would use dual boot bank?How to swap banks?What about memory offsets? Can we just flash a .bin file with any offset?Does dual boot bank supports flashing the same .bin file in both banks without changing offsets?
hello, I use STM32CubeIDE 1.16.0 and working on a custom bootloader to jump to application at address 0x08100000, here're the jump code below: void jump_to_application(uint32_t flash_address) { void (*app_reset_handler)(void); uint32_t main_stack_pointer_value = *(volatile uint32_t *)flash_address; __HAL_RCC_GPIOC_CLK_DISABLE();__HAL_RCC_GPIOD_CLK_DISABLE();__HAL_RCC_GPIOB_CLK_DISABLE();__HAL_RCC_GPIOA_CLK_DISABLE();HAL_RCC_DeInit();HAL_DeInit();SysTick->CTRL = 0;SysTick->LOAD = 0;SysTick->VAL = 0; /*** Step: Disable all interrupts*/__disable_irq(); __set_MSP(main_stack_pointer_value); uint32_t reset_handler = *(volatile uint32_t *)(flash_address + 4); app_reset_handler = (void*) reset_handler; app_reset_handler(); }And I change the ld file of application:MEMORY{ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64KFLASH (rx) : ORIGIN = 0x08100000, LENGTH = 2048KDTCMRAM1 (xrw) : ORIGIN
Hi Guys, I'm working on a personal project. I have experience with the use of STM Nucleo and this time I don't know how to get out of my problem. Previously I have already used the UART peripheral in the same way that I am using it now, but now it has a really strange behavior. I loaded the software on the nucleo I open Hercules (Program to send data to the uart) and everything works perfectly when sending the message "prova" I see that everything has been received correctly because I receive the same message sent plus a confirmation "provaOKKKK". Now I remove the USB from the Nucleus and turn the card back on, now it works differently... when I send "prova" I receive "aprov", in fact if I look at the char array before removing the power supply it contained data[0]=112, data[1]=114, data[2]=111, data[3]=118, data[4]=97 now instead I find data[0]=97, data[1]=112, data[2]=114, data[3]=111, data[4]=118. How is it possible that the operation has changed once the USB was removed from the PC
NUCLEO-G474REMy design uses two timers, one in master mode(TIM20) and one in slave mode(TIM1).To have the master timer generate an update signal in the trigger output, I set its TRGO event selection as "Update Event". the CR2 value 0x200020 confirms MMS is set to 2. I confirm TIM20 is running by probing its PWM output channel routed to an GPIO.The trigger source for the slave-mode TIM1 is ITR9, which comes from TIM20(my master-mode TIM).TIM1 is in "Combined reset + trigger mode". The design goal is to have a UEV(update settings from pre-loaded registers) and trigger(my understanding on the concept of trigger here is that the CEN bit is set by hardware automatically).I want the TIM1 to produce one PWM output per UEV from TIM20, therefore OPM is enabled in TIM1(Given my Repetition setting is 1, by the end of the TIM period, CEN will be 0 automatically, waiting for next trigger from master TIM20).The TIM1 PWM parameter is a sequence of known values, therefore I enabled a DMA channel to tr
The hardware is configured, initialization passes (fails if no card is inserted).The card is 8GB micro SD formatted on Windows with exFAT, contains 1 file "test.txt" with content "HELLO".The exFAT option is enabled for the FATFS.Here's my code:FATFS fs; FRESULT fr = f_mount(&fs, (TCHAR*)"0:/", (BYTE)1);In the next line the debugger shows "fr = FR_NO_FILESYSTEM".It behaved the same with SD card formatted with FAT32. Since the card is 8GB it can't be formatted with FAT16.My question is very similar to:https://community.st.com/s/question/0D50X00009Xkf5gSAB/frnofilesystem-fatfs4pins-sdcard-with-nucleol476rgEDIT:OK, I've found why it happens and the workaround for it, check my answer below.
Over the last couple of years it appears that ST pivoted towards Azure RTOS / ThreadX as the default RTOS for newer STM32s like the STM32U5. This seems in part to be because of the more cohesive set of packages like USBX, FileX, etc. on top of the basic RTOS. I understand that FreeRTOS is still a viable option as well, but things like USB library support currently only seem to be provided by downloading the Classic CoreMW from GitHub (not supported in CubeMX).If you're embarking on a new project at this point, is there an RTOS that is a better choice for an STM32U5-based system with requirements for USB and a File System? Has the recent move of ThreadX from Microsoft to the Eclipse Foundation changed the roadmap for ST support of FreeRTOS vs. ThreadX?Zephyr seems like an attractive option as well, but I'm not sure about the added complexity, or whether community-contributed bug fixes could potentially lag behind ST-provided HAL updates, etc.I know there are lots of go
Is it possible to disable a specific GPIO interrupt in my code and re-enable it after some time. HAL_NVIC_DisableIRQ(EXTI4_15_IRQn) this function will help but this will disable all the GPIO pins connected to that particular EXTI line. Any other possible ways I can implement?
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.