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 use STM32L431 to enter STOP1 mode, the original power consumption is 53uA. Before entering stop mode, I call HAL_ADC_DeInit(&hadc1) to disable ADC, and call MX_ADC1_Init() to re-enable ADC after exiting STOP1 mode. The measured power consumption is 66uA, which is about 10uA more. Why? If I do not call MX_ADC1_Init() after exiting STOP1 mode, the power consumption is still 53uA. Is it because ADC will generate power consumption?Below is my code to enter and exit STOP1:void EnterStop2ModeRTC(void) { HAL_RCCEx_WakeUpStopCLKConfig(RCC_STOP_WAKEUPCLOCK_MSI); __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF); __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG(); __HAL_RTC_TIMESTAMP_CLEAR_FLAG(&hrtc, RTC_FLAG_TSF); __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG(); HAL_ADC_DeInit(&hadc1); HAL_SuspendTick(); // __HAL_RCC_DMA1_CLK_DISABLE(); cpuStopFlg = true; SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk; __HAL_RCC_PWR_C
Moved from https://community.st.com/t5/stm32-mcus/stm32-arduino-stm32duino-tutorial/ta-p/49649 After you have finished the arduino project, how do you then remove everything from the MCU and use it again for normal STM32 projects in CubeMX and so on?
Good morning everyone!I have a question regarding a USB to UART IC. I’ve seen that the FT231XQ is used in ESP32s to program and communicate via UART. Is it possible to do the same with STM32s?
Microcontroller : STM32L476RG, External flash : AT45DB041E (4Mbit, 256 bytes of page, 2048 bytes of block),SPI2 communication protocol, using HAL.I am not able to use the LittleFS library in order to read a file that is written into the flash or any way I cannot even mount the flash. Every time I am getting the same error : (LFS_ERR_CORRUPT and after format it returns LFS_ERR_NOSPC, which is No space left on device). I don't know what it the problem I have configured some function based on the datasheet of the external flash in order to read, write and erase. I have imported the 4 basic files for littlefs into STM32CubeIDE and I don't know how to configure the cfg properly. My approach is this: /***** LittleFS functions *****/ int block_device_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) { /*Find the physical address*/ uint32_t address = (block * c->block_size) + off + FLASH_BASE; /*Perform a
I am new to Arm but old to assembly coding (inc Toshiba 32 bit CISC - now extinct).. Just completed RCC startup code for a STM32F344 chip by looking at the 1124 pages (!) of the RM0364 manual and the CUBE LL start up code (!!!). The CUBE code has waits for: Flash latency/HSI clk/LSI clk/PLL clk/Sysclk ready (at min). As all the waits involve the CPU in reading flash correctly to perform the wait loop, I wondered why wait?? The CPU might as well be doing something useful while it is waiting - and save some space while doing it. So I cut out all the waits. Works fine- amd code a lot smaller/neater. Yes of course everything has to settle down by the time the UART starts up and reads 250,000 baud sensibly but that is a long way down the track.So why wait?? .
Hello, we have Custom PCB Board which Build's around Stm32F4 Series Micro Controller.In which we have Two USB Port, One Connected with External ULPI (High Speed 480mb/s) Another Connected with internal ULPI (full Speed 12mb/s). And we are Using CDC workspace for Configuring Host and Device on Different Different Port with Different Workspace.So Now we have Requirement to Develop the Software for Both USB as HOST and USB as Device with There Respective Port.We want External ULPI as HOST (480 Mb/s) and Internal ULPI as Device(12 Mb/s) but right now For HOST there is Different workspace and for Device there is Different workspace with their Default Configuration of High Speed and Full Speed. So how we can Handle Both Condition in Single Workspace with their Respective Port Configuration.Thank You Aman
Hi,I am new to DMA interfacing on the STM32 Nucleo C031C6T6 board. I am trying to send ADC conversion data to UART using DMA. I have tested the code in debugging mode, and after calling the HAL_ADC_Start_DMA() function, the program control seems to go elsewhere, preventing further function calls from being executed.However, if I perform an arithmetic operation or an assignment instead of calling a function after invoking HAL_ADC_Start_DMA(), the program execution continues as expected. This suggests that the program doesn't allow function calls immediately after HAL_ADC_Start_DMA() is invoked.Below is the code I'm working with: Development Board: STM32 Nucleo C031C6T6CubeIDE Version: 1.15.1 Best RegardsReebin Code: /* USER CODE BEGIN Header *//********************************************************************************* @file : main.c* @brief : Main program body******************************************************************************* @attention** Copyright
I am trying to use STM32H747IGT6 as a USB device. I want to sent data using CDC. Below you can find my configuration and code. The MX_USB_DEVICE_Init() is successful. Although when I call the CDC_Transmit_FS, it never returns USB_OK and I wasn't able to find the USB device through my laptop. The only thing I found is that after the initialization done by the ST Generated code, the struct with the device configuration is still NULL and it seems that nothing is actually initialised and I assume that this is a problem. Although the initialization function returns USB_OK. Does anyone have any ideas about this problem?If you need further information about the project please let me know.
Hello,I want to teach kids programming at the block level using STM32, which is similar to Makecode for Microbit.Please suggest an IDE for programming the STM32 microcontroller using block-level programmingThanks
Hallo to everybody.Still working on SPI&Display adapting a code for M4 (see Different data after the 1st transfer using SPI via DMA ).I need to write only one byte at a time due to control pins of display.Starting from a NUCLEO-H563ZI and LL example "SPI_OneBoard_HalfDuplex_IT_Init" (it work!) I'trying to do it without interrupt. So, the code is like this:Spoiler (Highlight to read) LL_SPI_SetFIFOThreshold(SPI1, LL_SPI_FIFO_TH_01DATA);LL_SPI_SetFIFOThreshold(SPI2, LL_SPI_FIFO_TH_01DATA);LL_SPI_Enable(SPI1);LL_SPI_Enable(SPI2);while(!LL_SPI_IsActiveFlag_TXP(SPI1)) {}LL_SPI_TransmitData8 (SPI1, 0x55);LL_SPI_StartMasterTransfer(SPI1);//(wait for RXP flag)val = LL_SPI_ReceiveData8(SPI2); //or belowwhile (!LL_SPI_IsActiveFlag_TXC(SPI1)) {}val = LL_SPI_ReceiveData8(SPI2); //other place! LL_SPI_SetFIFOThreshold(SPI1, LL_SPI_FIFO_TH_01DATA);LL_SPI_SetFIFOThreshold(SPI2, LL_SPI_FIFO_TH_01DATA);LL_SPI_Enable(SPI1);LL_SPI_Enable(SPI2);
Current working deviceFor a client we developed a device using stm32F469 that writes sensor data to an sd-card periodically. Later the data are read out from sd-card by connecting it via USB to a computer, using USBD_MSC_CLASS. The system uses FreeRTOS, FatFS, ST USB driver. This works well (using blocking write and read commands to SDIO). The two paths to access the sd-card (from the MCU software using FatFS and the access from Windows using USB driver from ST) is separated by the MCU software, using init and de-init functions of the modules. New approachNow I wanted to transfer it to Azure RTOS using ThreadX, FileX, UsbX. The access to SDIO shall be done with DMA (fx_stm32_sd_write_blocks() calls BSP_SD_WriteBlocks_DMA()). The interrupt callbacks from SDIO (transfer completed) are rerouted with callback functions, depending on who (FileX or UsbX) accesses the sd-card. However this does not work with the following issues:UsbX and FileX worke fine when I disable all FileX wri
Hello everyone, I have enabled an spi1 port on a STM32G473CET6 as a slave and am using a raspberry pi as a master.I have verified with known packets to ensure I have implemented the correct crc algorithm on the raspberry pi both in transmission and reception. It's quite confusing because they are correct, in both directions the calculated and expected crc is the same. However, no matter what the stm32 is calling HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi) for a crc error. I verified thoroughly the CRCs and even echoed the same packet to check. This is printed by the stm32.I also checked this website for the crc implementation. The only the potential lead I can find (here) is that I have to flush the buffer which is reading the registers RXCRC and DR as I understand.I have tried this and still without fail I get a crc error. Between transactions I also reset the SPI port so that it doesn't get stuck in error. Does anyone have an idea? I will also leave the registers below t
case PWR_KEY_Pin: if (HAL_GPIO_ReadPin(PWR_KEY_GPIO_Port, PWR_KEY_Pin) == GPIO_PIN_RESET) { HAL_TIM_IC_Start_IT(&htim16, TIM_CHANNEL_1); captureStart = HAL_TIM_ReadCapturedValue(&htim16, TIM_CHANNEL_1); UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_DISABLE); } else { HAL_TIM_IC_Stop_IT(&htim16, TIM_CHANNEL_1); captureEnd = HAL_TIM_ReadCapturedValue(&htim16, TIM_CHANNEL_1); pressDuration = captureEnd - captureStart; UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_ENABLE); After LPM enabled #define CFG_LPM_SUPPORTED 1 Long press the button for 5 secs, pressDuration will output ~2000 only.The application was base on BLE_p2pServer and I'm sure PWR_EnterStopMode was not called by add "UTIL_LPM_SetStopMode(1 << CFG_LPM_HTIM16, UTIL_LPM_DISABLE);"
I read the "STM32WB09KEVX_FLASH.ld" of STM32WB09KE, could anyone tell me what's the meaning of these period sign in this file? /******************************************************************************* * STM32WB09 generic linker file for GCC * Main linker variables to control it are: * * MEMORY_FLASH_APP_SIZE: define the size of the application in case not all the flash is needed. * Default value is: 508KB when no OTA firmware upgrade is supported * * MEMORY_FLASH_APP_OFFSET: define the offset of the application. * Default value is: 0 offset * * MEMORY_RAM_APP_OFFSET: define the offset in RAM from which variables can be * allocated. * *******************************************************************************/ /******************************************************************************* * Memory Definitions *******************************************************************************/ /* STM32WB09 memory map +-----------------------+ 0x2000FFFF | RAM (64K) | +-----
I have downlaoded package for STM32U575 controller and going through its example projects.I want to know where I can find documentation for the HAL drivers for this controller? Any Wiki site for it?As an example, I see below DMA2D strcture in the initialization code. Where to find documentation for this structure DMA2D_HandleTypeDef? What does DMA2D_R2M mode means? Similar question for all HAL drivers.static void MX_DMA2D_Init(void) { /* USER CODE BEGIN DMA2D_Init 0 */ /* USER CODE END DMA2D_Init 0 */ /* USER CODE BEGIN DMA2D_Init 1 */ /* USER CODE END DMA2D_Init 1 */ hdma2d.Instance = DMA2D; hdma2d.Init.Mode = DMA2D_R2M; hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB565; hdma2d.Init.OutputOffset = 0; hdma2d.Init.BytesSwap = DMA2D_BYTES_REGULAR; hdma2d.Init.LineOffsetMode = DMA2D_LOM_PIXELS; if (HAL_DMA2D_Init(&hdma2d) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN DMA2D_Init 2 */ /* USER CODE END DMA2D_Init 2 */ }DMA2D_HandleTypeDef
Hello, I'm developing a power meter board.I'm using an STM32F427VIT6 and I need to read the analog values of 4 different channels (PA0 - PA3).Since I need to calculate the RMS value of the measurement and i need the data points to be evenly spaced in time I decided to do use DMA and trigger the conversion using a timer.- Configured the ADC in Scan Conversion Mode- Set it 4 Conversions and changed Rank 1 to Channel 0, Rank 2 to Channel 1, etc...- Set it to 28 Cycles per conversion- Set it to be triggered by the Out event of TIM2Then I enabled the DMA of ADC1 to be in normal mode, I want to do a bunch of conversions at a time but only when I fire them, not all the time. Then I configured TIM2 to fire at the rate I want. I decided I want to store around 200ms of data using around of 128KB of buffer, because that's like 65% of my ram.I may have calculated wrong, but the timer clock is 160Mhz with a Prescaler of 1 and a Counter Period of 1951 I get a frequency of around 41Khz ----
I've been trying to use the Hal_Delay function and found it not working. Looking into it, it appears that the sysTick interrupt is not going off to increment the count. Any ideas what is causing this? Is it possible that the interrupt vector is set up wrong? I've tried making sure that interrupts are enabled and that systick is set on highest priority, still nothing. Any help is appreciated
Hello, I'm trying to find more information regarding ThreadX's on-the-fly properties update feature. In the ST Wiki article, there is mention of this feature, but none of the links and webpages seem to provide any details regarding what this feature is or how to use it. Introduction to THREADX - stm32mcu Is the on the fly update the same as 'over the air' updates? Are there any articles about this feature? Have there been any coding examples showing how this feature is implemented?Thanks
I have used this method many times on this board (Nucleo-H743ZI) to transmit printf() to usart3 using the following: int __io_putchar(int ch) { /* e.g. write a character to the USART3 and Loop until the end of transmission */ HAL_UART_Transmit(&huart3, (uint8_t*) &ch, 1, 0xFFFF); return ch; } [...] printf("hello world\n") However, it has now stopped working in my project. HAL_UART_Transmit() still works fine but printf never seems to call __ioputchar.This same thing is working on my project with the STM32H7B3I-DK, using usart1.Any Ideas what could've happened?
Hello, good afternoon.I have two Nucleo boards STM32G071RB that I have written an I2C interface for. It is basically a command interface, where Master sends a command, and polls the slave later to get the response. I have tested my application thoroughly, it is working great between these two Dev Boards.Now for the actual work, I am replacing the slave with an internally developed board based on STM32G0B1, running FreeRTOS (I am fairly new to RTOS). Between the RTOS G0B1 Slave and the G071 Master, I see the Master send the slave address; The slave reads its address and holds the clock line low permanently; It does not trigger AddressCpltCallback, allowing me to receive the data. Sometimes the Oscilloscope would show 16-20 bits on the SDA/SCL lines instead of the usual 8-9 (not sure what setting i messed with to get that), but end result remains the same, after these bits, Slave will hold the SCL low indefinitely. Any ideas where I went wrong could help, thanks. MASTER BOARD:
I am using a Nucleo-H743ZI as a SPI slave device for the following coms method: Master Pulls SS low, Delay 1ms. Master Transmit/Receive 1 Byte (Wait for high busy line) Slave RXP Interrupt-> Lower Busy Line Slave Transmit/Receive 1 Byte Slave Process Byte, Set next transmit byte Slave Raise Busy Line Master Transmit/Receive 1 Byte Repeat untilldata is done Master Raises SS The Master is acting properly and the slave receive is correct; however, the slave transmit is two bytes behind. For now I have hard coded the transmit to send 5. All the data is received correctly by the slave in this time but the slave does not transmit 5 until the third byte is received.SLAVE SETUP: hspi1.Instance = SPI1; hspi1.Init.Mode = SPI_MODE_SLAVE; hspi1.Init.Direction = SPI_DIRECTION_2LINES; hspi1.Init.DataSize = SPI_DATASIZE_8BIT; hspi1.Init.CLKPolarity = SPI_POLARITY_LOW; hspi1.Init.CLKPhase = SPI_PHASE_2EDGE; hspi1.Init.NSS = SPI_NSS_SOFT; hspi1.Init.FirstBit = SPI_FIRSTBIT
I am having issues with my slave responding to my master. I am trying to lessen complexity by only using RXP on the slave, without TXP. The slave (Nucleo-H743ZI) responds one byte late.On the CS interrupt I send 0 for the first byte and enable RXP.*((__IO uint8_t *)&hspi1.Instance->TXDR) = 0; __HAL_SPI_ENABLE_IT(&hspi1, SPI_IT_RXP); __HAL_SPI_ENABLE(&hspi1);I then receive a byte and set the next transmit byte. I use FPint so the master does not send data when it is low (used for later implementation). void spiISRSTM(SPI_HandleTypeDef *hspi) { //Receive if ready if (hspi->Instance->SR & SPI_FLAG_RXP) { HAL_GPIO_WritePin(nFPINT_GPIO_Port, nFPINT_Pin, GPIO_PIN_RESET); rxBuffer = (*(__IO uint8_t *)&hspi->Instance->RXDR); (*(__IO uint8_t *)&hspi->Instance->TXDR) = 1; HAL_GPIO_WritePin(nFPINT_GPIO_Port, nFPINT_Pin, GPIO_PIN_SET); } __HAL_SPI_CLEAR_UDRFLAG(hspi); __HAL_SPI_CLEAR_OVRFLAG(hspi); __HAL_SPI_CLEAR_EOTFLA
I am trying to get the Ux_Device_CDC_ACM application working on the NUCLEO-U5A5ZJ-Q development board. I see the VCOM port activated on the PC but how do I get the UART port? It appears that the application writes from the UART port to the VCOM port and vice-versa, but it is not clear how to connect the UART. Do I use an FTDI cable somehow? Or is it on the USB-C connector?
Hi All!I'm trying to use USB high speed in STM32h723 with an external phy usb3300.I started the program from the CubeMx Ux_Device_CDC_ACM which uses the internal phy.I modified the clocks and the USB module to use an external phy USB3300 and so far it works fine in Full Speed.My problem is that when I try to use it at High Speed, the enumeration is not going well and the device is not recognised by the PC (win10).With a USB protocol analyser, I got this when High speed is set: Got stuck in with device configurationChirp, passation of data with address setting and device descriptor seems to workAnd This is Full Speed: Works fineWith an oscilloscope, I check the 60M clock, and the timing of DIR, NEXT, and STP signals relative to the CLK.Even though they are not very clean signals there are within the data sheet limitations.My questions:1. Anyone with the idea of what I Should do?2. Where in the program can I look to debug the functions handling the enumeration of the USB?I have USBX, Thr
Hello Techies, We are using STM32H743, we would like to run mcuboot on stm32h743, but we haven't find the example for stm32h7xx devices, Is there any specific reason not to provide mcuboot example for h7 devices?
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.