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
I'm working on an embedded project using an **ARM Cortex-M4** processor (specifically, an `STM32F4` microcontroller) and I've encountered a peculiar issue related to memory sections defined in my linker script. I'm using the `arm-none-eabi-gcc` toolchain for compilation.I have a binary file that I want to include in my firmware. I've created a custom section (`.rawdata`) in my assembly file to include this binary file, and I've modified my `linker script` to place this section in the `Flash` memory. However, I'm facing an issue with the integrity of the data in the .rawdata section during runtime.When I place the `.rawdata` section within the `.data` section or in the `.text` section in my `linker script`, everything works as expected: the data is correctly allocated in memory, and the actual data is stored correctly. I can access and print the data during runtime without any issues.However, when I try to create a standalone `.rawdata` section (outside of `.data`) or place it within th
Hello everyone.I am working on a project which needs low level access to USB mass storage class such as reading sector size/count of an attached storage device but thus far I could not get anything out of my board which is nucleo-f446re.I have initialized my board as a USB host mass storage class and I am abled to write on specific sectors such as sector number 10 and it DOES write it down using msc_scsi.c functions but I can't find any solution to determine sector count of attached device. I just can't find the appropriate function/data structure for it,Can anyone please help me with it?
I am working on a basic USB FS HID device on an STM32F411 Discovery Board, the USB code is the only code on the board. When I run the code from the STM32CubeIDE, the device fails to enumerate and Windows says "Device Not Recognized". I have no breakpoints, delays or anything else set in the program that would cause a pause. When I plug the device in outside of debug mode, the device works as expected, and I can receive data fine in the desktop application.The device ALWAYs works as expected outside of the IDE even in Windows and Linux on different computers. I changed all of my debug settings for debug connections (connect under reset, etc), but it still has the same issue. I'd like to get this to work as the SWO output is useful to debug the OUT packets the device receives.The only way I can seem to get the device to work properly in Windows is if I change the VID or PID, then it enumerates fine. But if I run it again, it seems to fail, so I'm wondering if this is related to something
I'm running a STM32G474RET6 on a Nucleo G474RE board, and trying to read the internal temperature.I set up ADC1 with 2 ranks (the temperature and the vrefint) like so (not including the error checking and comments for better readability): hadc1.Instance = ADC1; hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2; hadc1.Init.Resolution = ADC_RESOLUTION_12B; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.GainCompensation = 0; hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE; hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; hadc1.Init.LowPowerAutoWait = DISABLE; hadc1.Init.ContinuousConvMode = DISABLE; hadc1.Init.NbrOfConversion = 2; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.DMAContinuousRequests = DISABLE; hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED; hadc1.Init.OversamplingMode = DISABLE; multimode.Mode = ADC_MODE_INDEPENDENT; HAL_ADCEx_MultiModeConfi
Good day!I am using stm32h7 with USB3300. For firm use CUBE MX 5.6.1. USB HS CDC VPC class USB with USB DMA Disable - everything works.As soon as I turn on USB DMA Enable, the device is no longer detected by the PC enumerating failed. Please tell me what could be the problem?
Our Project uses the STM32WB55 with FreeRTOS, using the Systick to context switch. We use both IWDG and WWDG.To power down the unit we set a flag in non-volatile RAM and then force a WWDG reset. At reset, the NV RAM is checked and if it indicates a power-down request we use the following code to put the unit to sleep: // And StopUTIL_LPM_SetStopMode(1U << CFG_LPM_APP_BLE, UTIL_LPM_ENABLE);UTIL_LPM_SetOffMode(1U << CFG_LPM_APP_BLE, UTIL_LPM_DISABLE);__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(LL_RCC_STOP_WAKEUPCLOCK_HSI);STO();UTIL_LPM_EnterLowPower(); // Sleep Here NVIC_SystemReset(); So at wake-up the unit always restarts with a software reset.We use the ST Class B Safety Libraries, so each reset tests both Watchdogs.Sometimes (maybe one time in ten) when we come to run FreeRTOS there is no Systick Interrupt.Other interrupts continue to run, TICKINT and ENABLE are set in the Systick Configuration and the Systick counter is visibly counting down. COUNTFLAG is set showing
Hello everyone,Thanks in advance.I create a .txt file and write data in it. When this .txt file reaches 1GB, I want it to open a new .txt file and write the data to the new .txt file. It should continue from where it left off...I have 2 folders, one with configuration information and the other with data saved.I tried many ways but I could not solve the problem. Which path should I follow?void check_or_create_initial_setting(void) { UINT br; // FRESULT fr; if(f_mount(&SDFatFS, (TCHAR const*)SDPath, 0) != FR_OK) { Error_Handler(); } else { // Check if the "System" folder exists if (f_opendir(&dir, "/System")== FR_OK) { // The "system" folder exists, now check for "config.txt" if (f_open(&SDFile, "/System/Config.txt", FA_READ)== FR_OK) { // The "config.txt" file exists, read and extract the coefficient value while (f_gets(line, sizeof(line), &SDFile)) { if (sscanf(line, "coefficient = %d", &multiplication) == 1) { // Coefficient value found and extr
hey every one .I'm working on SPI and configuring a slave which should answer to the master request . slave reception process work with interrupt after 2 successful reception. THIS IS MY CODE : /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Private includes ---------------------
Where can I find the version of the HOST_USB library I am using? Does the library version depend on the Firmware Package or the version of CubeMX? Thanks Marco
Hello, I m using an STM32F249I DISC1 board. I'm trying to start-off with a basic USB VCP loopback functionality. I generated the code for USBFS as a CDC Device (VCP) using CubeMx. I set the clock to 168MHz (so that USBFS is clocked at 48 MHz). I have also given appropriate Stack and Heap sizes. And I am using Windows 10. However, the board doesn't enumerate as a VCP, in fact it isn't even detected on the bus (i.e. I don't see any activity on my PC). What else can be the issue? Any code examples that I should refer to? Thanks
I am working on NUCLEO-H563ZI evaluation board interfacing with QSPI external memory. I have done below steps,I am able to do read and write.I have created the external loader file.I am able to run application code in external memory with debugger support.Now i am trying to run application code from external memory with bootloader code but i am always ending up with code crash. Could anybody give a clue how to debug this issue? Note: I have flashed the application code in external memory using cube programmer with external loader. I have enabled the memory mapped mode in boot up code and able to see the app code in Ext memory. I have written jump code like below and changed linker script also, /* Disable Systick interrupt */SysTick->CTRL = 0; /* Jump to application */jumpToApplication = (pFunction)(*(__IO uint32_t*)(APPLICATION_ADDRESS + 4));__set_MSP(*(__IO uint32_t*)APPLICATION_ADDRESS);jumpToApplica
I was about to configure the FreeRTOS for my project when I noticed the following: TICK_RATE_HZTICK_RATE_HZ must be between 1 and 1 000.Parameter Description:Sets the tick interrupt frequency. The value is specified in Hz.Warning: The max value is 1000, as higher values generate compilation errors (division by zero) Does it mean 1000Hz is the fastest FreeRTOS can work with, and anything else should follow a bare-metal approach?I found this related topic, but it is not clear to me if that applies to STM32. Hence, I would appreciate the opinion of the experts here.
Hello, I am working on trying to get the SDMMC1 on the stm32h745 to function properly. Currently I have this for my current initialization of the SDMMC and it does not return any errors. hsd1.Instance = SDMMC1;hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B; hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;hsd1.Init.ClockDiv = 0;if (HAL_SD_Init(&hsd1) != HAL_OK) {Error_Handler();}if (HAL_SD_ConfigWideBusOperation(&hsd1, SDMMC_BUS_WIDE_4B) != HAL_OK) {Error_Handler();} After this is done, I try to use the HAL_SD_ReadBlocks_IT(); and also this does not return any errors. The issue I am having is the return data buffer has no data in it when this function finishes. Currently I am not sure what the issue might be, the clocks and appear as they are sending data but I am getting nothing in my return data. Any thoughts or ideas on what might resolve this
In fact I have several questions about reception handling of bxCAN and one of them is demonstrated in the title. I will show my questions by an example. ( All the following discussion is based on Section 32.7.3 in STM32F405/415, STM32F407/417, STM32F427/437 and STM32F429/439 advanced Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual ).The development tools I have are limited, preventing me from conducting experiments to verify these issues by myself. It will be helpful if ST's technical staff can assist in answering my questions, as these details are not included in the reference manual.Suppose 4 CAN data frames arrived and they were all stored into FIFO1. Then CPU wrote 1 to RFOM1 for 4 times. This procedure is showed in figure1. figure 1 We focus on 7 specific
Hello,I am trying to implement a flash erase function, which is based on the reference manual. I am using the STM32L476RG nucleo board. From there the instructions are: To erase a page (2 Kbyte), follow the procedure below: Check that no Flash memory operation is ongoing by checking the BSY bit in the Flashstatus register (FLASH_SR).Check and clear all error programming flags due to a previous programming. If not,PGSERR is set. Set the PER bit and select the page you wish to erase (PNB) with the associated bank(BKER) in the Flash control register (FLASH_CR).Set the STRT bit in the FLASH_CR register.Wait for the BSY bit to be cleared in the FLASH_SR registeSo for that operation I have created a function based on CMSIS which is the following: uint16_t bl_flash_page_erase(uint32_t page, uint16_t bank) { /*Wait if any flash memory operation is ongoing*/ while (READ_BIT(FLASH->SR, FLASH_SR_BSY)) {} /*Check if any error occurs due to previous programming*/ b
HAL Library provide the HAL_Delay() for millisecond delay. I want to use micro second delay in STM32L4 so how I do it? Is it available in HAL library?
Hi all,I config the SDIO & FATFS by cubeMx for my STM32F429BI board.When I config the SDIO to SDIO_BUS_WIDE_1B, everything is work well; Even the generated MX_SDIO_SD_Init() is NOT calling the HAL_SD_Init() function. (Why don't need HAL_SD_Init() , is this some mistake?) void MX_SDIO_SD_Init(void) { HAL_StatusTypeDef hal_sta; hsd.Instance = SDIO; hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; hsd.Init.BusWide = SDIO_BUS_WIDE_1B; hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; hsd.Init.ClockDiv = 0; } However, when I change SDIO_BUS_WIDE_1B to SDIO_BUS_WIDE_4B, the operate to SD card is error.But when I change the code to below, the program works well again: void MX_SDIO_SD_Init(void) { HAL_StatusTypeDef hal_sta; hsd.Instance = SDIO; hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS
Hello Team,I have an STM32F469NIHX and I am trying to implement a use case where I want Timer8_ch1 to be a slave to an external signal that I apply on pin D2 (PG7), which is not a source of timer at all. Upon reading the DS, I understood that I cannot use an external trigger mode, as the ETR pin specific to TIM8_CH1 is not the one that I have my external trigger on. What is the alternate option I have, in order to get this up? Any leads on this would be of help.Thanks,Janani
Hi All, I am trying to generate variable frequency using TIM1 on STM32G070. I use TIM1 in output compare mode and PC8 as an output for channel 1. Pre-scaler is set to 0 and ARR to divider for whatever frequency I want. When checking registers I see CNT changing between 0 and ARR, as expected but nothing happens at the output. I tried to change PC8 directly to rule out electrical problem - it works fine.I need just to toggle the PC8, nothing else, but nothing happens... I went through many examples, but very few are relevant for stm32g0 using only CMSIS. Running out of ideas what could be wrong and looking at it for too long, so there is likely something I cannot see.If anyone has an idea where to look, that would be greatThanks // Enable clock for GPIOCRCC->IOPENR |= RCC_IOPENR_GPIOCEN;// Enable clock for TIM1RCC->APBENR2 |= RCC_APBENR2_TIM1EN; // Disable TIM1TIM1->CR1 &= ~TIM_CR1_CEN;// Configure TIM1 for Output Compare, toggle pinTIM1->SMCR &=
Hi All I working on a data logger code. It is basic at the moment. 1, set a an ISRTimmer for 1sec. 2, When ISR triggered set a read bit in Datalogger register i set up. 3, Next loop thru main i test Datalogger register, if set go to a function and read A0, A1 ports and store back into an array i have set up. Every time i run this code it completes 5 susessful looit always crashes on the 6th loop in the same spot reading A1. The Fault has the same sequence. 1, call A1 read, 2, straight to HardFault_Handler. According to the stack it happen straight after the osKernalStart (see attached pic). I was wondering if this is an ISRtimmer confilct with ADC issue? Any tips would be greatly appreciated Set Up; Portenta H7 (STMH7), VS Code using PIO
Hi.In X-CUBE-USB-AUDIO, You wrote:1. Does it mean that playback and recording can work simultaneously, and at different sampling rates? For example, playback at 44,1k, and recording at 96k?2. Does it mean that playback and recording may by governed by different software (at PC) as separate devices? For example, playing using Foobar2000, and recording using Audacity?3. If 1 and 2 is "yes", does it mean that can we have asynchronous streams?For example, playing at 44.1k, and recording at 44,1k but from different clock domains? For example, playing 44,1k clocked from STM32H7xx, and recording from incoming SPDIF (SPDIF is always clock master, so it forced its own clock, which always is slightly different from STM clock)Questions 3 is general, about UAC2 devices. If it is not yet implemented in X-CUBE-USB-AUDIO, but general possible, please answer anyway. Implementing by myself is not a problem, but I need information if it is possible at all (in UAC2).Thanks in advance!
The HAL_GetUID functions return the same value on different chips of the same series. I am using an STM32L0 series chip. This is my code:uint32_t serialw0 = HAL_GetUIDw0(); uint32_t serialw1 = HAL_GetUIDw1(); uint32_t serialw2 = HAL_GetUIDw2();Which returns these sames values on every chip:205994032, 926167089, 17Searching through the generated files this is code for the above functions:#define UID_BASE (0x1FF80050UL) /*!< Unique device ID register base address */ uint32_t HAL_GetUIDw0(void) { return(READ_REG(*((uint32_t *)UID_BASE))); } uint32_t HAL_GetUIDw1(void) { return(READ_REG(*((uint32_t *)(UID_BASE + 4U)))); } uint32_t HAL_GetUIDw2(void) { return(READ_REG(*((uint32_t *)(UID_BASE + 8U)))); } Now if write my own macro:#define STM32_UUID ((uint32_t *)(0x1FF80050)) uint32_t serialw0 = *(STM32_UUID); uint32_t serialw1 = *(STM32_UUID+4U); uint32_t serialw2 = *(STM32_UUID+8U);I get unique values for each chip but I don't think this is correct either:20
Hello, I hope you are well.I'm working with a project, where the base code is the example "STM32CubeExpansion_Cloud_AWS_H5_V1.0.0", I need the current time somehow. So I thought about SNTP, however, I don't have much knowledge on the subject, I would like to know if there is any simple way to get the time using the connections that the example makes with AWS.Can anyone help me? Thanks in advance!
Hi,I'm encountering several issues with my timers. Firstly, my timers, specifically Timer3 which is connected to APB1, aren't functioning as expected. I've also attempted to use Timer16, which operates on a clock derived from another peripheral communication bus. However, the main issue seems to be with the RCC clock for my communication bus, as it doesn't appear to be functioning properly.I've verified the functionality of Timer3 by testing it with an external interrupt handler, but it still doesn't seem to be working correctly. Additionally, I've implemented PWM (Pulse Width Modulation) functionality, but it hasn't yielded the expected results.Furthermore, I'm encountering difficulties with configuring alternate functions. Specifically, I'm struggling to set the appropriate bits in the AFR (Alternate Function Register). I would greatly appreciate any assistance or guidance as I strive to become proficient in embedded programming. void configPWMPA6(void){RCC -> AHBENR |=
I am using 4 TIMs for updated interrupts functions. in the main while loop, I will call start the timer. and if the timer reaches its full-period and call the callback function. A Flag will be setted in the callback function and print a timeout meassage. The problem I found is the timeout will be triggerred in every powered on. Everytime I click reset MCU, it will first enter the callback function and print the "timeout message". Why this will happen and how to avoid this?Thanks all in advance!
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.