Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
It would be helpfull to have couple of function in addition toHAL_GPIO_WritePin( GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState )for cases when pin state is known in advance (not result of calculation in runtime)void HAL_GPIO_SetPin (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) { assert_param(IS_GPIO_PIN(GPIO_Pin)); GPIOx->BSRR = (uint32_t) GPIO_Pin; } void HAL_GPIO_ClearPin (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) { assert_param(IS_GPIO_PIN(GPIO_Pin)); GPIOx->BRR = (uint32_t) GPIO_Pin; }Props:1 One parameter less2 One assert less3 No condition check4 Less typing5 Less work in runtime6 Better search. One can serach SetPin or ClearPin instead of all HAL_GPIO_WritePin at first and then see pin state value in common list.7 Sense of command in one place instead of combination of command_name + parameter_value8 More uniform with HAL_GPIO_TogglePin. Set, Clear, Toggle have the same signatureEdited to apply source code formatting - please see How to insert
Hello everyone,I already asked similar question but I got no sensible answer yet. I am trying to implement the Custom HID drivers in the STM32UG7VJT microcontroller, in standalone mode, so no RTOS. The only thing that I can find from STM32 is this example https://github.com/STMicroelectronics/stm32-usbx-examples/blob/main/Projects/STM32H743I-EVAL/Applications/USBX/Ux_Device_CustomHID that uses the RTOS. I am trying to remove the RTOS from it but until now I didn't even manage to get the descriptors right. The device is enumerated but not recognized. So does anyone have any idea on how to make this work? I already looked at all the tutorials available, they don't fit my case, all of them are based on the H7 family which seems to have different architecture for the USB. Thank you in advance
Hi,// WM8904.c int32_t WM8904_Init(WM8904_Object_t *pObj, WM8904_Init_t *pInit) // ... if ((WM8904_CurrentDevices & WM8904_OUT_HEADPHONE) == WM8904_OUT_HEADPHONE) { ret += WM8904_SetVolume(pObj, VOLUME_OUTPUT, (uint8_t)pInit->Volume); } // ... /* Store current devices */ WM8904_CurrentDevices = (pInit->OutputDevice | pInit->InputDevice); in line 4, WM8904_CurrentDevices is still 0, so the gain is not set.I'd change the line this way: if ((pInit->OutputDevice & WM8904_OUT_HEADPHONE) == WM8904_OUT_HEADPHONE) { ret += WM8904_SetVolume(pObj, VOLUME_OUTPUT, (uint8_t)pInit->Volume); }
Hi,I'm busy with my own BootLoader. I can erase the flash, required to store the program. But writing to the flash causes a HardFault. (I also write to flash in my application to store the configuration. That seems to work, so (normally) I can write to the flash without any problems).My routine looks as follows (msg.Data is the received information from my PC. The contents look fine): HAL_FLASH_Unlock(); uint64_t* pData = (uint64_t*)&msg.Data; while (m_CurrentAddress < tempEndAddress) { HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, m_CurrentAddress, *pData); m_CurrentAddress += 8; pData++; } HAL_FLASH_Lock(); The debugger shows this information:I do not know how to (further) debug this information.Thanks in advance.Greetings,ErX
Hello, i'm trying to using mce encription for external flash. I have the stm32h7s7-dk eval board.my mce configuration for the external memory init; my mce configuration for the boot main I followed the tutorial series https://www.youtube.com/watch?v=JxhKmVUB2Ws&list=PLnMKNibPkDnFQXYK0ztHV9iMVS6EAtKpD&index=10. And i tried allthing and i applied successfully at my eval board. But the mce is so different. In the tutorial the instructor used different board hence the board is using mce1. But i'm using the mce2 because the xspi2 connected mce2. And the mce2 couldnt support the aes.My memory write and memcopy methods;key and other variablesDecrypted result (wrong values, it must be start from ram base)encripted file; Could you help me ?
Hello guys,I am using Ethernet and USB together. Ethernet in rmii mode without RTOS and Using USB as cdc,after flashing the program it runs normally but when i ping or Access the IP from web :spider_web: it goes to hard fault handler If USB init () is Commented then everything is working fine but when uncommented it goes to hard fault handlerso i want the solution to use USB and Ethernet simultaneously and can it be used without RTOS or should we use RTOS?
I'm trying to develop a basic PDM microphone to PCM audio data application on the NUCLEO-U575ZI-Q development board. I have tried to adapt the ADF_AudioRecorder application designed for the STM32U575I-EV and found at https://github.com/STMicroelectronics/STM32CubeU5/tree/5107fbd316d605704bb4c3ebf2126d4d1ba0e763/Projects/STM32U575I-EV/Examples/MDF/ADF_AudioRecorder I can generate the ADF CCK0 clock output on PE09 (confirmed 1.01 MHz with my oscilloscope) and when connected to my PDM microphone, see the PDM output on its DATA line, also using my oscilloscope, and connect this to PE10. Because I have no SAI and no audio CODEC attached, I just want to save the PCM formatted samples to memory at the moment, with a view to exporting over the VCOM port for verification in future. However, I'm stuck at the point of creating the samples. From the .ioc file attached, you should be able to see my configuration is, aside from the SAI, very similar to the example for the other U5 dev boar
Is it possible to re-trigger HAL_TIM_DMABurst_MultiWriteStart() from software? Currently it works only once (the first time) for me. Using TIM1 freq/duty-cycle:HAL_TIM_DMABurst_MultiWriteStart( &htim1, TIM_DMABASE_ARR, // Base = ARR TIM_DMA_UPDATE, // Trigger = update event (uint32_t*)rampBurst, // Source buffer TIM_DMABURSTLENGTH_3TRANSFERS,// ARR + RCR + CCR1 N_STEPS*3 // Number of bursts ); __HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_UPDATE);This produces a duty-cycle and frequency change over a certain amount of time, let's say 10ms, after the 10ms, I would like to disable the PWM output by setting the duty-cycle to 0:__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, 0);Then, I would like to re-trigger this each 100ms from software. My DMA setting is set to "Normal". The value of RCR is always 0 in the rampBurst array.
Hi,I'm working on a new design using a STM32H523VET6 in which we want to use USB host & device functionality. Whether the board should function as a host or device is determined when it is switched on and will not be changed during operation.As far as I understand I don't need an external crystal for both modes host & device? But what I don't understand is how to configure the clock recovery system CRS. Do I need the SOF signal, but this seems only available when in device mode.So my questions are:1. Is it true that I don't need external crystal for USB host & device modes?2. What is needed from clock recovery system SRS (SOF signal...)?Thanks,Roger
Code Order :1、HAL_FMAC_FilterPreload_DMA。2、HAL_FMAC_FilterStart。3、HAL_FMAC_FilterStop。4、HAL_FMAC_FilterStart。5 HAL_FMAC_AppendFilterData i want ask ,does Fmac X and Y buff will clean when step3: HAL_FMAC_FilterStop function excute ?
Hello STM community, I am working with the STM32N6570-DK Discovery kit and trying to build a pipeline for live camera streaming over Ethernet using NetX Duo, ThreadX and FileX. I am currently using the inbuilt CubeIDE example project Nx_WebServer. My current setup is: STM32N6570-DKAzure RTOS: ThreadX, NetX Duo, FileXEthernet RMII with static IPSD card for web contentHTTP server using NetX DuoGoal: later integrate CSI camera streaming over Ethernet What works: The board gets a static IP successfully.Ethernet link is up.Ping works from PC.SD card is mounted correctly and HTML files are accessible through FileX.HTTP server starts without error. Issue faced: I am unable to move forward toward live camera streaming.There is no reference or example for CSI camera streaming over Ethernet using NetX Duo on STM32N6570.I also faced multiple issues with thread creation order and NetX initialization, which took significant time to debug. My question: Is there any recommended architecture, applicat
I want to make a GUI with C# that I could choose the STM32 microcontroller and the xxx.elf file and programming it without using STM32CubeProgrammer with USB .With the STM32CubeProgrammer it is look like this: What to look for? where should I begin?I saw that there is an API for STM32CubeProgrammer on C++. is there an option to call C++ program to C#?
Greetings,Kindly, I would like to know which USB interface I can use to transfer data between the STM32L552E-EV and the reComputer J4012.I am working with TEE, and my goal is to send plaintext from the reComputer to the STM32L5 so that it can be encrypted on the device. However, when I send data, I do not receive any response.I have tried using both the USB port and ST-Link, but the result is the same. I can see the ST-Link device on the reComputer, but when I use USB CDC, it is not recognized.Could you explain the proper USB connection and how to set up the communication?
Hi, I want to set up the Ethernet peripheral of the STM32H743 microcontroller using lwIP, but I’m facing a problem and I can’t get a ping response. I have reviewed some codes, but they don’t fully explain the cause of the issue. Does anyone have experience with this problem and can provide the correct configuration/settings?
How to implement IGMPV3 in STM32f429ZGT6? Can anyone please guide me with
Hi, I tried to find a solution in the forum, but unfortunately without success.The problem is as follows: I need to generate a PWM signal that changes the period (not the duty cycle) with each iteration. (MCU: STM32F411)I'm setting up the timer to use a PWM output on channel 1:Global interrupts are also active: Then the DMA will be configured to update the ARR register:In the code the DMA will be activated as following:for (int i = 0; i < 32; i++){u32FreqUpdate[i] = 2000 + i*100;}// Activate PWM channel 1:TIM_CCxChannelCmd(htim4.Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);// Activate PWM output:__HAL_TIM_MOE_ENABLE(&htim4);// Activate ARR Update:HAL_TIM_Base_Start_DMA(&htim4, u32FreqUpdate, sizeof(u32FreqUpdate)/sizeof(uint32_t));As a result:The Output updates 3 times (without to change the frequency (period)) and then PWM Stops...Could someone explain me, what I'm doing wrong?
I have a NUCLEO-071RB development board.Is there a ready to run example for this board somewhere?I tried to generate a bare bone example with CubeMX.The code loads and runs but hangs in here:MX_ThreadX_Init => tx_kernel_enter => tx_initiali ze_kernel_enter =>tx_application_defineThe code enters infinite loop here, with the status==255memory_ptr = (VOID *)&ux_device_app_byte_pool;status = MX_USBX_Device_Init(memory_ptr);if (status != UX_SUCCESS){/* USER CODE BEGIN MX_USBX_Device_Init_Error */while(1){}/* USER CODE END MX_USBX_Device_Init_Error */}I can of course debug that further but rather than going down that rabbit hole the first thing with this processors I would be prefer and example code that compiles, loads, runs, initialises and enumerates correctly as HID as a starting point.
Hi Community,I am facing an issue with my custom bootloader not jumping to my main application after firmware upgrade. However, i am able to jump to application during a normal power cycle. The firmware transfer is done through USB CDC using a serial utility.exe and the data is stored in bank 2 of the flash. After this my application sets a value(flag) to a memory location for my bootloader to know firmware copy to be done. My application now jumps to bootloader to do the copy of firmware, clear the flag and jump to updated application. I am sending a response to serial utility before jump. I notice that sometimes the usb state is not ready and it doesn't send the response. But sometimes it is ready and send response, but bootloader sometimes fail to jump to application properly. Please help me out. Thankswhile (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ USBPoll(); if(upgradeStatusFlag == FLAG_SET) { if(copyFirmwareToAppAddress()!= SUCCESS) { Error_Handl
Hello!i'm developing a firmware that use an SD card connected to USBX MSC, and i have a couple of question i want to understand better the ULONG *media_status value returned in the function :UINT USBD_STORAGE_Status(VOID *storage_instance, ULONG lun, ULONG media_id,ULONG *media_status) UINT USBD_STORAGE_Flush(VOID *storage_instance, ULONG lun, ULONG number_blocks, ULONG lba, ULONG *media_status) UINT USBD_STORAGE_Write(VOID *storage_instance, ULONG lun, UCHAR *data_pointer, ULONG number_blocks, ULONG lba, ULONG *media_status) UINT USBD_STORAGE_Read(VOID *storage_instance, ULONG lun, UCHAR *data_pointer, ULONG number_blocks, ULONG lba, ULONG *media_status) i'm hoping that value is related to the SCSI code value that windows need from a USB MSCis it true? beyond UX_SUCCESS which value can i use? for example to indicate the media as changed or is readonly?how can the functions ULONG USBD_STORAGE_GetMediaLastLba(VOID) and ULONG USBD_STORAGE_GetMedi
I am using a Nucelo-429zi board for development and my custom PCB schematic is based on this board. I am experiencing a problem where about 10% - 20% of the time after a hardware reset the PHY will fail auto-negotiation. The green led does not come on and the amber led blinks. This happens even when on the debugger and the MCU is not allowed to run. I only have one Nucleo board so I cannot try another to see if the problem is unique to this board.Is this a known problem? seen before?What could it be? Possibly the clock circuit?
Doing the set up in MXI have four ADC channels on APB2 with PCLK2 at 84 MHz sampling 4 microphones.The recommended audio sampling rate stretch from 44.1 kHz up to 96 kHz, so initially I'm happy anywhere in that range for now. I have set the clock pre-scaler to divide PCLK2 / 4 so the ADC clock is at 21 MHzI have 12 bit resolution which takes 15 ADC cycles but then in the "rank" section of the parameter settings there is a pull down for sampling time for each channel. I'm guessing that the value I pass in the "rank" section is what I would use to get the final sampling rate.e.g. if I chose 84 cycles for each channel then I would have a sample rate of 250 kHz per channel giving a sample rate for all conversions of 62.5 kHz?Or do I add the sample time to the resolution time e.g. 84+15 giving a sample rate of ~212 kHz per channel?
I am using a UX_Device_Audio2.0-based project on H7. When I play a stereo file (actually dual mono), the right channel plays correctly, but the left channel contains a mix of left + right.When I play mono file, the right channel is much louder while the left is extremely quiet.Could this be a codec configuration issue (mixer/settings), a USB audio packet scheduling problem, or something else? I can't seem to find a fix yet.
Hello, I am using the following official example as a reference:https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/STM32U5x9J-DK/Applications/USBX/Ux_Host_HUB_HID_MSC I tried to use the Ux_Host_HUB_HID_MSC project on STM32U5G9J-DK2 as a base and adapt it to my application (ThreadX + USBX + TouchGFX). However, despite using this example, I am still facing compilation errors related to STM32 USB Host initialization. Main errors: _ux_hcd_stm32_initialize not declared hhcd_USB_OTG_HS not declared MX_USB_OTG_HS_HCD_Init() implicitly declared These errors occur in app_usbx_host.c, when calling ux_host_stack_initialize(). This seems to be related to a STM32 USB HCD (USB OTG HS) configuration issue or missing / non-included source files compared to the official example. Could you please advise: which STM32 USB Host source files must be included? whether a specific CubeMX configuration is required for USBX Host on STM32U5G9J-DK2? or if some parts of the official
Hello, I am currently using an STM32U5G9 and would like to connect a microSD card via SDMMC1 to expand data storage. My Zephyr device tree contains the following node: &sdmmc1 { status = "okay"; pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9 &sdmmc1_d2_pc10 &sdmmc1_d3_pc11 &sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>; pinctrl-names = "default"; disk-name = "SD"; bus-width = <1>; clk-div = <8>; }; As shown above, bus-width = <1> indicates 1-bit (1-line) mode. I would like to use 4-bit mode, but after changing this value to <4>, the microSD card can no longer be accessed. How should this issue be resolved, and what additional configuration or considerations are required to enable 4-bit SDMMC operation correctly on STM32U5 with Zephyr?
Hi everyone!Just finished a dual boot system but during testing I bumped into a weird issue. With BFB2 bit unset firmware starts smoothly but when it is set, it ends up in some bootloader loop although it should switch to opposite bank (FB_MODE = 1) and run second firmware code. It looks like bootloader is waiting for update as it initialized I2Cs, CAN1 and USB.System option word for this case is 0xFB7FF8AA (nBoot0 = 1, nSWBoot0 = 0, nBoot1 = 0, BFB2 = 1). Actual Boot0 pin is connected to ground (along with quartz generator). Initial stack values of both bank firmware are within SRAM range (it is mandatory to start firmware correctly).What is most interesting, another board based on the same chip but slightly different on connected periphery works perfectly. It seems, the bootloader somehow disregards options and starts to check periphery to update but catches only noise (induced by unconnected pins or by sensor outputs) so it hangs.Is there something I missed?Regards
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.