Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Hello,I'm working on a custom board with a STM32L451 and an emmc (THGBMNG5D1LBAIL - 4gb). At initialization (using the HAL generated init functions), I get the CID and CSD but not the ExtCSD. I get a CRC error (in polled mode as well as in DMA mode). Since it is at the initialization, I cannot change a lot of settings...(main clock is at 80Mhz but at lower clock value I get the same issue) I've seen that I need to set "half-word" in the DMA settings in order to have a same alignment as in polled mode...But obviously doesn't help since I get the same error in both cases... (with or without misalignment)Do you have any idea on what direction I could look at? Thanks a lot! clock config:SDMMC settings:
I am experiencing an issue with my STM32-based project. All interrupt handlers never invoked, including the SysTick handler and USART1_IRQ_Handler. I try to resolve the problem. here is my trying... 1. Vector Table Offset Register (VTOR) Configuration:I have explicitly set SCB->VTOR = 0x08000000 to ensure the vector table points to the correct memory address. Despite this, the issue persists. 2. SysTick Initialization:The HAL_InitTick function successfully initializes the SysTick, returning HAL_OK. 3. Global Interrupts:I have attempted disabling and re-enabling global interrupts using __disable_irq() and __enable_irq() before initialized, but this had no effect. 4. Real-Time Operating System (RTOS):No RTOS is being used in this project. The setup involves minimal configuration, primarily focusing on clock settings, which have been verified to function correctly. 5. SysTick Control and Status Register:The CTRL register's 16th bit is set to 1, indicating
Hello Guys!Im using STM32H743IITx MCU and W25Q128 QuadSPI. i want to know that how to use MDMA feature for QuadSPI.Thanks.
Hi everyone, I am approaching FMC with NAND FLASH memory and I am looking for tutorials or something like examples of testing. I have seen the built-in example from STM32 which is Fx_Nand_Write_Read_File, and have a question how to configure it with AzureRTOS, if not configure it with the same, how to use NAND FLASH mode? It is difficult to be vague as a beginner like me. I need basic documentation or tutorials. Thanks everyone for watching and giving me answers!!!
The problem ethernet link with NUCLEO-H755ZI-Q.The conditions are as follows:Board: NUCLEO-H755ZI-QEthenet select core: CM4STM32Cube_FW_H7: V1.12.1LWIP: V2.1.2DHCP clientIn this case, the Ack from the DHCP server could not be confirmed as being received.dhcp->pcb_allocated is set to 0 (in function of dhcp_recv()).A similar error has not occurred with CM7.Do you happen to know the reason for this?
I'm working on an STM32 project using X-CUBE-CELLULAR to support both cellular modems: BG96 (or GM01Q). I physically connected both modems (2× STMod+ expansion connectors) to my STM32 board.My main question is: How can I configure my project and steps to allow me to select and switch between controlling either the BG96 or the GM01Q modem at runtime using the X-CUBE-CELLULAR package?If the package already supported, which configuration we should attend ?
I tried to generate code using stm32cube ide to run lwip and tried to ping the board. But it is not working. Is it possible to generate code that runs without any modifications in the generated code?
本人在实践过程中遇到一个问题。项目中需要用到外置flash芯片-W25q128。本人计划用f103C8T6的SPI2、DMA去通讯。用的是cube生成的工程文档。第一次用的是STM32CubeF1 固件包 v1.8.6。串口打印不出flash芯片的ID号,串口发送0x0。花了一天检查,最后用STM32CubeF1 Firmware Package v1.8.5。串口打印成功了,falsh芯片的ID 号为0xEF17. 请问这2个版本的包中对SPI2和DMA有啥异同吗?
I use it to see if R S T is present in 3-phase systems with F072 c8t6 processor. I have defined only R pin as interrupt, the other two are defined as input. When I write the code as below, I cannot check the status of R. I guess it is because of the version or the processor I cannot use HAL_GPIO_EXTI_Rising_CallbackCODE: void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { sPhase_t *rstPhase = &taskPeripheralUnits.phase; if(GPIO_Pin == ioR_Pin) { if (HAL_GPIO_ReadPin(ioR_GPIO_Port, ioR_Pin)) { rstPhase->ucRawPhaseData[ZERO][rstFACTOR_R_PHASE] = ACTIVE; rstPhase->ucRawPhaseData[ZERO][rstFACTOR_S_PHASE] = HAL_GPIO_ReadPin(ioS_GPIO_Port, ioS_Pin); rstPhase->ucRawPhaseData[ZERO][rstFACTOR_T_PHASE] = HAL_GPIO_ReadPin(ioT_GPIO_Port, ioT_Pin); } else { rstPhase->ucRawPhaseData[1u][rstFACTOR_R_PHASE] = PASSIVE; stPhase->ucRawPhaseData[1u][rstFACTOR_S_PHASE] = HAL_GPIO_ReadPin(ioS_GPIO_Port, ioS_Pin); rstPhase->ucRawPhaseData[1u][rstFACTOR_T_PHAS
Hello,With ST Microelectronics advising to move away from ThreadX and back to FreeRTOS, is ST planning to support integration of for FreeRTOS-Plus-TCP into the IDE/Mx?There are minimal examples available for setting up this addon making it extremely frustrating to work with. In other posts, I have seen responses just telling developers to use LwIP instead, but we shouldn't be forced to resort to a single option when we have multiple out there.
Hello,Has anyone used the USBX host code in AzRtos (not standalone)? The system seems very flaky, and when I looked into it, it seems the Variable: _ux_system_host in file ux_host_stack_initialize.c is never initialized./* Defined USBX host variables. */ UX_SYSTEM_HOST *_ux_system_host;So the pointer to this structure = 0, which happens to be pointing at the memory location for the ITCMRAMITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64KWas the intent to run USBX with no cache, and leave the _ux_system_host structure in the ITCM RAM, or am i missing some initialization routine?Obviously, with this data structure in the ITCMRAM, it would explain why the system is flaky when the ICACHE is turned on. However, I'm still not able to get the USB_host up and running properly even with the icache off. (a lot of bus faults due to incorrect callback pointers in this structure)The ST examples don't seem to run either. Any help would be greatly appreciated
Hi,I have designed a custom board using STM32G431CB and TCPP03. I am trying to make as a sink device. I followed this video : https://youtu.be/cbdFHmMOMwk?si=GqcDTJeDxTsrFDiGI have successfully generated and compiled the code. Also, i enabled the GUI interface and TRACE. I am able to get the trace messages in STM32CubeMonUCPD. But unable to see the GUI interface board port, I tried refreshing it several times but no luck . Please help.Thanks in advance.
I'm new to fiddling with MCUs, so I'm looking for some advice, I'm working on a project for my class and I'm trying to emulate a keyboard using the nucleo-F103rb. I have my code written out, I have a usb cable with D+ Connected to PA12 and D- to PA11, GND to GND and VCC to E5V all within CN5. Despite having all the headers in place, my computer doesn't detect any connection whatsoever. If anyone could suggest anything that may help it'd be really appreciated.
I have jump function this like that but this method don't work. Please I need help immedietly void jumpToAddress(uint32_t jump_address) { void (*jumpFunction)(void); static constexpr uint32_t SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER = 4; static constexpr uint8_t NVIC_REGISTER_LENGTH = 8; SCB_DisableDCache(); SCB_DisableICache(); __disable_irq(); SysTick->CTRL = 0; HAL_RCC_DeInit(); for (uint8_t i = 0; i < NVIC_REGISTER_LENGTH; i++) { NVIC->ICER[i] = 0xFFFFFFFF; NVIC->ICPR[i] = 0xFFFFFFFF; } SCB->VTOR = jump_address; __set_MSP(*((uint32_t *)jump_address + SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER)); jumpFunction = (void (*)(void))(*((uint32_t *)((jump_address + SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER)))); __enable_irq(); jumpFunction(); while (1); }
Hello Everyone,We have a requirement to flash firmware from One STM32G0B1 MCU1 to Second STM32G0B1 MCU2 via UART.The STM32_Programmer_CLI will be connected to MCU1 via UART. The MCU1 and MCU2 will be connected together via a different UART for flashing. The MCU1 should act as a mediator between STM32 Programmer and MCU2 for flashing.Is it possible to achieve the above requirement? If It is possible, could anyone share the reference documents or reference software for the same.We really appreciate your support. Thanks in Advance,Best Regards,Naveen
Hi, I am working with STM32U585, I read 10 ADC channel which work perfectly on optimization level O0 and O1.but when I set optimization level O2 or O3, I didn't get some channel's value. we got 0 on that channel. Channel which which not work there values are stable 1.65V on Pin. Some one please help to resolve this issue. Pankaj
Hi All,I am integrating the IMU sensor Using I2C DMA in circular mode on stm32f103c8t6 using Hal Library, so facing an issue reading the address value.In the below code "HAL_I2C_STATE_READY " this flag is not resetting after once function executes so in 2nd execution this HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size) function is not trigering to DMA Handler function. if (hi2c->State == HAL_I2C_STATE_READY) { /* Wait until BUSY flag is reset */ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U); do { count--; if (count == 0U) { hi2c->PreviousState = I2C_STATE_NONE; hi2c->State = HAL_I2C_STATE_READY; hi2c->Mode = HAL_I2C_MODE_NONE; hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT; return HAL_BUSY; } } while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET); /* Process Locked */ __HAL_LOCK(hi2c); /* Check if the I2C is already
I want to initialise ADC in my FreeRTOS task. If I remove/comment out HAL_ADCEx_Calibration_Start function, put a delay (osDelay(1)) between it and HAL_ADC_Start_DMA or place a breakpoint at HAL_ADC_Start_DMA and pause code execution at it during debugging, everything is fine and dmaBuffer gets filled with data from ADC.However, if I do not do any of those things, then __HAL_ADC_ENABLE(hadc) macro inside of ADC_Enable function called by HAL_ADC_Start_DMA won't set ADEN flag in CR register to enable ADC and ADC_Enable will return HAL_ERROR.Is it because calibration requires some time to finish and until then ADC can't be enabled? If so, how can I make sure calibration ended? Thank You for help in advance! My FreeRTOS task initialising ADC:volatile HAL_StatusTypeDef adcCalibrationReturn; volatile HAL_StatusTypeDef adcStartReturn; uint32_t adcTaskTick=0; void startAdcTask(void *argument) { adcCalibrationReturn=HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED)
Hello, I am trying to setup the CM4 core with lwip+mbedtls working. Actually I get this code working on CM7 but I need to migrate it to CM4. When I run the code the CM4 get a ard fault interrupt. Debuging I can see that this happens in HAL_MPU_Enable in the line SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; I thing that this happens because a wrong configuration of memories and/or MPU. I'm not familiar with memory management in microcontrollers and I'm feeling lost. The MPU configuration is: void MPU_Config(void) { MPU_Region_InitTypeDef MPU_InitStruct = {0}; /* Disables the MPU */ HAL_MPU_Disable(); /** Initializes and configures the Region and the memory to be protected */ MPU_InitStruct.Enable = MPU_REGION_ENABLE; MPU_InitStruct.Number = MPU_REGION_NUMBER0; MPU_InitStruct.BaseAddress = 0x0; MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; MPU_InitStruct.SubRegionDisable = 0x87; MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; MPU_InitStruct.AccessPermission = MPU_REGIO
Hi Everyone,It was recently recommended to me that I enable DMA2D on my project to possibly alleviate another problem that I'm having detailed here (Weird horizontal artifacts in touchGFX buttons - STMicroelectronics Community). My question is, how do I properly set it up? I've read several documents on the DMA2D including How to use Chrom-ART Accelerator to refresh an LCD-TFT display on STM32 MCUs - Application note and 8. Hardware acceleration | TouchGFX Documentation but I'm left scratching my head.If I simple enable DMA2D in MX with my current project without making any code changes like this : Then I get weird distortions on some of my text:I'm also confused as to how I should be changing my code to take full advantage of the DMA2D. In My Mind, my flushFrameBuffer function which looks like this right now void TouchGFXHAL::flushFrameBuffer(const touchgfx::Rect& rect){uint16_t* frameBuffer = getTFTFrameBuffer();setLCDwindow(rect.x, rect.y, rect.widt
Hello!I have a STM32F407VET6 with FreeRTOS continuously receiving data, normally 250-300 characters every 4[ms], by UART+DMA, when it receives a '\n' and idle-line sends the data received to a mailbox(8 mails length). Then a receiver task get one mail from the mailbox and sends the data by USB. The problem is that after 3-5 minutes operating I get a HardFault error and the STM32 stucks. The UART+DMA should be OK, I have tested it before and the when I disable the receiver tasks no HardFault error occurs. So, I think the receiver tasks is the problem, but what can be reason of this HardFault? Is the heap size? stack size? memory allocation?Thank you!
I'm writing for stm32f417 MCU. The project is generated using STM32CubeMX with firmware package: STM32Cube FW_F4 V1.26.2 (the latest so far).In the USB Host Library there is a file related to HID class:<my_proj_path>\Middlewares\ST\STM32_USB_Host_Library\Class\HID\Src\usbh_hid_parser.c There is a function: uint32_t HID_ReadItem(HID_Report_ItemTypedef *ri, uint8_t ndx)It parses items of incoming reports. And there is a code in it:/* read data bytes in little endian order */ for (x = 0U; x < ((ri->size & 0x7U) ? (ri->size / 8U) + 1U : (ri->size / 8U)); x++) { val = (uint32_t)((uint32_t)(*data) << (x * 8U)); } val = (val >> shift) & ((1U << ri->size) - 1U);You can see here the multiple type casting. It's just meaningless overhead. But if you iterate through the loop assigning a value to the variable val it'll be overwritten on every iteration. Moreover the data pointer also stays unchanged during the loop.At least this line should b
Hi,I have NUCLEO-F411RE and NUCLEO-U575ZI-Q boards. When trying to implement a sine curve with PWM and a low-pass filter I stumbled into problems with HAL_TIM_PWM_Start_DMA.I store the precomputed sine data in an array and call HAL_TIM_PWM_Start_DMA. ... BEGIN: pseudo codeuint16_t pwmData[PWM_SAMPLES];compute_sine_data(pwmData);HAL_TIM_PWM_Start_DMA(&htimX, TIM_CHANNEL_1, (uint32_t *) pwmData, PWM_SAMPLES);... END: pseudo codeIt works fine on STM32F4, but I noticed only half of the data is present on the STMU575. Apparently HAL_TIM_PWM_Start_DMA has different semantics on the 2 MCUs. On STM32F4 the length seems to be with respect to Data Width in the timers DMA setting, and on STM32U575 it seems to be measured in bytes (regardless of the GPDMA settings).In short:STM32F4: HAL_TIM_PWM_Start_DMA(&htimX, TIM_CHANNEL_1, (uint32_t *) pwmData, PWM_SAMPLES);STM32U5: HAL_TIM_PWM_Start_DMA(&htimX, TIM_CHANNEL_1, (uint32_t *) pwmData, 2*PWM_SAMPLES);
Using STM32L452 and HAL version 1.17.2 with FreeRTOS. I'm new to CAN, and am trying to set up a simple one-to-one communication scheme without filters (only two devices on this CANbus talking to each other). I've implemented the RX FIFO message pending callback such that it simply sends a FreeRTOS notifier:void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan){ BaseType_t xHigherPriorityTaskWoken = pdFALSE; if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) // Be sure CAN RX task is running before we try to wake it { HAL_CAN_DeactivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING); //BDRTEMP Disable this interrupt until the RX task services vTaskNotifyGiveFromISR(CANRxTaskHandle, &xHigherPriorityTaskWoken); // Wake the CAN RX task portYIELD_FROM_ISR(xHigherPriorityTaskWoken); }}The notifier wakes up a FreeRTOS task that reads the CANbus message and processes it:void StartCANRxTask(void const * argument){ /* USER CODE BEGIN StartCanRxTask */ Bas
Hi All,I am struggling with that the maximum DMA buffer size is 64KB. I am currently transferring the data from an ADC to the Buffer using DMA with circular buffering, but I would want the buffer to be around 200KB. I have heard that one can use MDMA to transfer the DMA buffer information to a bigger buffer. I have never used MDMA before, and there is little information online about how to use it in CubeIDE. If someone can help me to configure the MDMA/DMA to do this, and what functions to use it would be very helpful!Best regards,Elso
ST Community highlights – April to June 2026
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.