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 am devoloping a low-power motion detector device using the STM32L071 mcu.The PIR sensor wakes up the system through wake-up pin, and after completing the RF packet transmission, the system goes back to sleep. In other words, I have a system that continuously switches between standby and run modes.How should I implement the watchdog in such a system ?I don't want the watchdog to keep counting while the MCU is in standby mode. I only it to run during run mode.My code like this (bare metal): int main(void) { /* USER CODE BEGIN 1 */ config_getresetflags(); /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ ws_register_sensor_driver(&ws_door_driver); ws_init_mx(); ws_wkp_src(); ws_init_se
Hello,In this file, the line:USBx_HC((uint32_t)ch_num)->HCSPLT |= USB_OTG_HCSPLT_XACTPOS_Pos;wrongly alters bits 1 to 3 of register HCSPLTThat can be fixed simply by removing this line, since middle payload is encoded by bits 00 in the XACTPOS field.
I am using STM32CubeMX 6.16.1 to configure a project for STM32F415.I use the FATFS on SD card and set it up as:According to FATFS documentation (https://elm-chan.org/fsw/ff/doc/config.html#lfn_unicode), the data type TCHAR should translate to char in this case. However, CubeMX generates Middlewares/Third_Party/FatFs/src/ff.h in which TCHAR is defined as WCHAR, i.e. a 16-bit type:The _STRF_ENCODE is correctly defined as 3 in FATFS/Target/ffconf.h, which corresponds to UTF-8:Is this a bug? How can I ensure that UTF-8 uses the 8-bit data type correctly?
Hello, I am working on an application that uses the SDMMC peripheral to read the contents alternating audio files every 150ms. The buffers i have to store the data are large enough to store the entire file in a single burst within RAM. The problem I am running into is that intermittently, the sound "loops" indicating a lockup on the sound subsytem. I've added a small timer in SysTick in order to quantify how long and often this lockup occurs as the logic is running in a lower priority interrupt. I find that the system locks up between 300ms-1200ms. When I listen for this audibly and stop the code, I find that the code is stuck in:if(BSP_SD_ReadBlocks_DMA((uint32_t*)buff, (uint32_t) (sector), count) == MSD_OK) { ReadStatus = 0; /* Wait that the reading process is completed or a timeout occurs */ timeout = HAL_GetTick(); while((ReadStatus == 0) && ((HAL_GetTick() - timeout) < SD_TIMEOUT)) { } /* in case of a timeout return error */ if (ReadStatus == 0) { res
On line 1695 of stm32h5xx_hal_eth.c ETH_MACTSCR_TSUPDT is used to set the timestamp counter, however page 2934 of RM0481 says this bit is used to add or subtract from the timestamp counter instead:Based on the description of this function, and its use elsewhere, this function should instead use ETH_MACTSCR_TSINIT to overwrite the timestamp counter. As it is at the moment, the current time is added to the counter every time there is a PTP sync meaning the time fluctuates wildly over a century and a half span, and the time is never close enough to use fine adjustment methods.Also consider adding a line to enable PLL1Q's output to the HAL Ethernet init function, that was another fun bug to track down...
So along time ago I created a very helpful program using an STm32H743ZI nucelo board. Then - STM discontinued that board -- GRRRR The recommended solution was:NUCELO-H755ZI-Q - so I purchased 4 of these. PROBLEM there are no usable examples in the STM32 cube suite that works with this board. I need to port my old STM32H743 code to this new chip GRRR Ok that should be easy. Turns out there is a huge problem with using this board because of the power supply, the key feature I need is exactly the ETHERNET interface. BUT - cubesuite does not have a ETHERNET example I can start from.. ie: that properly initializes the board to run at "some fast speed (i do not really care, speed is not important, I just need the 100mbit ethernet to work). The specific problem I had was I programed my board and evidently it locks the board up hard, jtag no longer works. The solution is to use a jumper force the chip into "BOOTLOADER MODE" then JTAG works again and I can flash-erase the chip via JTAG. I do no
I am working on an STM32F746G-Discovery board using LwIP (2.1.2) and FreeRTOS (CMSIS-RTOS V1) generated via STM32CubeMX. I am facing a persistent issue where the gnetif.ip_addr.addr field is populated with a garbage/static value before DHCP can complete, specifically 0xf44fd102. The Issue: Even after performing a memset(&gnetif, 0, sizeof(struct netif)) before MX_LWIP_Init(), the debugger consistently reports the following for the IP address variable: Hex: 0xf44fd102 Decimal: -196095742 Translated IP: 244.79.209.2 (Multicast) It appears the Ethernet DMA is writing multicast network traffic into the memory space allocated for gnetif, or I am facing a D-Cache coherency issue where the CPU is reading "stale" data from a previous boot/session. Current Configuration: CPU: STM32F746NGH6 (Cortex-M7) Cache: I-Cache and D-Cache enabled in main.c. PHY: LAN8742A (RMII mode). Clock: 216MHz (HSE used as source). MPU: I have attempted to configure the MPU to set the SRAM1 regio
Hello,i did the OEMiROT examples following How to start with OEMiRoT on STM32C5 using CMake by converting the EWARM project config. I would like to give that CMake config back as well as some fixes to the provisioning script / example_config. Where/How do I that?I know the GitHub Repo, however since there are no open/close tickets, I wounder if that is the right place.
Hello, I ran into an issue when testing a UART application on a STM32C562RE in loopback mode with RTS and CTS enabled. The app does the following:1. Start receiving 1 character at a time by using HAL_UART_Receive_IT.2. Send a string 3. After the received character is printed out I issue another call HAL_UART_Receive_IT.Everything works fine; the app prints out the string I sent. I wanted to make sure the hardware flow control was running correctly so I placed a HAL_Delay(1) after I print out the character received and before I issue a new call to HAL_UART_Receive_IT. This should stop the transmitter due to the CTS -> 1 (no more room in the Rx buffer) and it should restart it after I issue the HAL_UART_Receive_IT CTS -> 0 due to available room in the Rx buffer; and, it does. All the characters are received as expected however HAL_UART_Receive_IT returns HAL_ERROR. Everything seems normal except the error returned by HAL_UART_Receive_IT.I de
I have troubles using SPI3 on STM32U575VG. After some time the transfer hangs and it is not possible to amend it until whole reset.Configuration: Only transmit, is feeds LCD display, 240 lines, 54 bytes each.APB3 clock 48 MHz. Manual CS handling, SCLK 1.5 MHz.Everything looks ok, it works, but after some time and on some boards only it hangs. The problem appeared in the start of production. Symptoms: after configuration and LL_SPI_Enable(), the DMA transfers 16 bytes to the FIFO. That's ok, DMA works. But after LL_SPI_StartMasterTransfer(), the transfer doesn't start.Looking at the pins, SCLK remains low and MOSI contains some data, but very slow, one bit interval seems to be 8 ms. Reset of the SPI doesn't help. Reinit of the whole MCU after STOP2 (without reset), including all clocks doesn't help. The only thing that works is the reset of the whole MCU. I have no idea where to look at more. The SPI is not overclocked, it doesn't wait for any external signal. It happens sometimes
Hi,I am using one ADC with multiple channels on an STM32 device. I configured a timer trigger (external trigger) for the ADC, but I noticed that the trigger seems to apply to all channels of the same ADC, not just the selected channel.I would like to confirm:Is it true that one ADC has only one trigger source, and all configured channels share that trigger?Is it possible to configure different sampling/trigger properties per channel, or is the external trigger common for the entire ADC conversion sequence?My goal is to use different trigger timing per channel, but I am using only one ADC peripheral.Thank you.
Hi,I am building a program that can flash new firmware onto a STM32H743ZIT6 via CAN. It does so by utilizing the dual bank feature and ping-ponging between bank 1 and bank 2. It receives the firmware via CAN and buffers it. Before writing it to the inactive bank it first erases said bank.When running form bank 1 this works just fine and it is able to reboot to the newly flashed bank. When going from bank 2 back to bank 1 however, it encounters an issue. It crashes in the erase step and will not restart.After I manually disable the SWAP_BANK bit using STM32CubeProgrammer it runs again on bank 1 without flashing again. This (I think) tells me it is deleting bank 2 while also running on it.Attached you find the function in question, do you have any idea where i went wrong? void foc_erase_inactive_bank() { // Determine inactive bank from SWAP_BANK bit uint8_t inactive_bank = (FLASH->OPTCR & FLASH_OPTCR_SWAP_BANK) ? 1 : 2; uint32_t bank_to_erase = (inactive_bank == 1) ? FLASH
Hello All,On the STM32U575 is there any guidance regarding use of external resistors? I don't see any on the reference design so I didn't put it on my board either. USB data rates are fairly slow, is impedance matching even required?We are using TinyUSB so that we can avoid the RTOS and it works fine mostly, but occasional USB disconnects. We discovered by accident using a longer cable seems to resolve this. I am wondering if it is a fluke or if there is some rational reason for this.Thanks!
I am experiencing an issue with ADC3 multi-channel scan mode on a custom STM32H745 board (LDO power supply). The same code works perfectly on the Nucleo-H745ZI reference board (SMPS power supply), but fails on my custom design. Problem Summary: ADC3 configured for 6-channel continuous scan with DMA circular mode Only channels 1-3 receive invalid data (changing values) Channels 4-6 are stuck at 0 (no change) When using single-channel with interrupt (polling mode), the ADC works fine All GPIO pins are correctly routed; multimeter confirms good analog signals on all 6 input pins Expected Behavior: All 6 ADC channels should update continuously via DMA circular buffer. Actual Behavior: adcValues[0] = 2604660662 // PF6 (IN8) - CHANGING ✓ adcValues[1] = 1343977801 // PF7 (IN3) - CHANGING ✓ adcValues[2] = 4294918112 // PF8 (IN7) - CHANGING ✓ adcValues[3] = 0 // PF9 (IN2) - STUCK ✗ adcValues[4] = 0 // PF10 (IN6) - STUCK ✗ adcValues[5] = 0 // PC0 (IN10) - STUCK ✗ HARDWARE CONFIGURATION
Hi everyone,I'm working on a project based on the following STM32H7 LwIP example:https://github.com/stm32-hotspot/STM32H7-LwIP-Examples/tree/main/STM32H747_Disco_M7_ETHIn addition to the Ethernet functionality, I’ve enabled the SAI peripheral with DMA to transmit audio via I2S. I’ve noticed a problem:When I run the SAI with DMA on the Cortex-M7 core using FreeRTOS, the audio stream contains gaps or dropouts.However, when I move the exact same SAI/DMA initialization and logic to the Cortex-M4 core, the audio output is perfect with no gaps.Has anyone experienced similar issues when using DMA for audio on the M7 core with FreeRTOS?Any suggestions would be greatly appreciated.Thanks in advance!TG808
There is a bug in the FW package V1.6.3 where the UART and DMA doesn't work correctly.I've been using FW package V1.6.2 for awhile with UART in DMA circular mode and it has never had an issue. I've recently made a copy of the project to make an A and B comparison because we needed to make some subtle changes. I migrated to the latest FW Package V1.6.3 for the B project.With V1.6.3, when receiving a string command, i only receive a few character from the beginning of the string and the last few characters from the end of the string. A bunch of characters are missed from the middle of the string. I decided to go back to FW package V1.6.2 in CubeMX because that is the only thing that really changed and generated the code. The project works correctly. What i see in V1.6.3 are a lot of missing huart->TxXferCount = 0U; and huart->RxXferCount = 0U; throughout the stm32g0xx_hal_uart.c file compared to V1.6.2In WinMerge you can see in the lef
Hello,I am using the STM32H7B3I-EVAL board with STM32H7B3LIH6Q controller.The board revision I am using is MB1370-lcd-b02 a254300030.I downloaded the official demo package from the ST website:STM32H7B3I-EVAL → Tools & Software → Demo Code Package.After extracting the ZIP file, I tried flashing the provided .hex demo file into the controller using STM32CubeProgrammer.However, programming fails with the following errors:Error: failed to download Sector[0]Error: failed to download the FileThe board is detected correctly through ST-LINK, and connection is successful. I already tried:Reducing SWD frequencyFull chip eraseHardware reset / Under reset modeBut the issue still occurs.Could anyone please suggest:Whether the provided demo .hex file is directly compatible with STM32H7B3LIH6Q?If any special option bytes or external memory configuration is required?Whether the demo depends on external QSPI/OSPI memory or specific boot settings?Thank you.
I was wondering what is that. I created a custom bootloader firmware and application firmware. But once I successfully uploaded. When I send application firmware resquest I do not receive application firmware responses. Why is that? what is that? do you recognize that? The AA 01 00 00 BB is the application firmware request frame. 0xAA is the begining 0x01 is the length 0x00 is the frame request ID 0x00 is the checksum 0xBB is the end of the frame Thanks for all.
Hi everyone,I am working on a project using the STM32H753ZI Nucleo-144 board. My goal is to save data to an external USB thumb drive via the CN13 (USB OTG FS) port.My Environment:RTOS Stack: ThreadX, NetXDuo (Ethernet is working), USBX (Host/Storage Class), and FileX.Tools: STM32CubeMX v6.12/6.17 and IAR Embedded Workbench.Clocking: Using HSI48 for USB, stabilized by the CRS (Source: LSE).Hardware Configuration:VBUS: Manually controlled via PD10 (STMPS2141). I have confirmed with a multimeter that 5V is present on the port when the software runs.VBUS Sensing: Disabled in CubeMX (since I am driving power manually).USB_OTG_FS Settings:Mode: Host_Only.Speed: Full Speed (12 MBit/s).DMA: Disabled.Interrupts: USB OTG FS global interrupt enabled (Priority 15).The Issue: Despite the drive having power, the USBX stack does not seem to trigger the device insertion callback. I suspect the issue lies in the registration of the Host Controller Driver (HCD) or the link between the HAL interrup
Hi Everyone,We are developing a Sub-GHz/LoRa device based on STM32WLE5CCU6 and have encountered an issue relatedto the Sub-GHz Radio BUSY state. We would like to ask for possible root causes and the recommendedrecovery procedure.The observed behavior is as follows:1. After MCU peripheral initialization, we call MX_SubGHz_Phy_Init() and then Radio.Init() /Radio.Sleep().2. We then try to execute HAL_SUBGHZ_ExecGetCmd(&hsubghz, RADIO_GET_ERROR, ...).3. The command keeps returning HAL_ERROR, and HAL_SUBGHZ_GetError(&hsubghz) returns 0x00000002, whichcorresponds to HAL_SUBGHZ_ERROR_RF_BUSY.4. We poll this command once per second for 10 seconds, and all attempts fail with the same error.5. We also checked the PWR flags before. PWR_FLAG_RFBUSYS remains active, which indicates that thecurrent RF BUSY signal stays high.6. PWR_FLAG_WRFBUSY can be cleared, but RFBUSYS remains high. Therefore, this does not look like apending wakeup/event flag issue, but rather the actual RF BUSY hardware
Hello Everyone,I am working on a custom USB bootloader project on STM32H743 using:USB Host MSCFATFSExternal QSPI FlashInternal Flash updateIAR WorkbenchHAL driversMy bootloader detects USB pendrive successfully and I can see:Appli_state == APPLICATION_READYf_mount() returns FR_OKBut the system gets stuck / deadlocked when calling:DIR dir; if(f_opendir(&dir, "0:/") != FR_OK) { return UPDATE_NONE; }The MCU hangs inside f_opendir() and never returns.Current flow:MX_USB_HOST_Init(); while(1) { MX_USB_HOST_Process(); if(Appli_state == APPLICATION_READY) { HAL_Delay(500); update_flags = ver_check(); break; } }Inside ver_check():if(f_mount(&USB_FatFs, USBHPath, 0) != FR_OK) { return UPDATE_NONE; } if(f_opendir(&dir, USBHPath) != FR_OK) { return UPDATE_NONE; }Additional Information:USB Host MSC works until f_opendir()No FreeRTOS usedUSB drive detected properlyf_mount() succeedsDeadlock occurs specifically at f_opendir()Tried both "0:/" and USBHPathTried adding delay
I have a project where a STM32U575VGT must convert a SSI multiturn encoder value into a parallel single turn value for GPIO output. The SSI values are 3 bytes long, and it would be best if the CPU is only interrupted when the last 2 values differ. I have set up SPI2 to have GPDMA channels for TX and RX (although only RX is needed). DMA transfers work, but when I try to enable autonomous mode with LPTIM1 Channel 1 as a trigger, there are no interrupts for SPI2 or the DMA channels. How do I trigger the SPI read every ~1ms? Is this something only achievable with the LL libraries rather than HAL? Is it possible to interrupt the CPU only if the 3 bytes read from the SPI differ from the previous value?
Hello,I would like to add Aliro compatibility to my access control device.My device uses the STM32WB55 MCU with an ST25R3911B NFC front-end.It seems that the X-Cube-Aliro package is designed to work with the new STM32WBA MCUs along with different NFC front-ends (such as ST25R200).As I understands it, I can implement the Aliro protocol on STM32WB55.1. Are there any such examples of adapting the X-Cube-Aliro package to work with such an MCU?2. Does using the X-Cube-Aliro package also require running a comm stack that the STM32WB55 doesn't support?3. Are there examples of implementing the Aliro protocol without using the X-Cube-Aliro package on STM32 devices?Thanks,Tal
Hi everyone,I am working on STM32H723 (H7 series) using HAL, and I am facing an issue with ADC1 + ADC2 dual regular simultaneous mode.Configuration DetailsMCU: STM32H723HAL based projectADC1 = MasterADC2 = SlaveMode: ADC_DUALMODE_REGSIMULTDualModeData: ADC_DUALMODEDATAFORMAT_32_10_BITSResolution: 12-bitScan mode: DisabledContinuous mode: DisabledTrigger source: TIM2_TRGO (rising edge)DMA: Circular modeADC3 runs independently (also TIM2 triggered) and works perfectlyDual mode started using:HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)g_adc12_packed_buffer, TP_DMA_BUFFER_SIZE); Buffer unpacking: uint32_t packed = g_adc12_packed_buffer[i]; uint16_t adc1_raw = packed & 0xFFFF; uint16_t adc2_raw = packed >> 16; Observed BehaviourWhen I apply voltage to ADC1 input:Both ADC1 and ADC2 values changeBoth show identical values (mirrored)When I apply voltage to ADC2 input:No change in readingsADC2 does not respondWhen inputs are floating (level shifted mid-sca
Hello I've been trying to recreate the DCMIPP_SnapshotDecimation example with STM32CubeIDE, I have been running into several issues. I have solved most of them, I am encountering a memory error while debugging my code. I was able to flash and debug the original example successfully on the STM32N6570-DK. However, when I try to read a value from the AXISRAM address (0x34200000), it fails: (address does not exist and unable to reconnect to target device). AXISRAM3 which it should be the address 0x3420000 is activated and initialized in the main. Initialization of the signal processor and starting the DCMIPP pipeline was passed without any problem:if( ISP_Init(&hcamera_isp, &hdcmipp, 0, &appliHelpers, ISP_IQParamCacheInit[0] ) != ISP_OK ) { Error_Handler(); } if( HAL_DCMIPP_CSI_PIPE_Start(&hdcmipp, DCMIPP_PIPE1, DCMIPP_VIRTUAL_CHANNEL0, BUFFER_ADDRESS, DCMIPP_MODE_CONTINUOUS ) != HAL_OK ) { Error_Handler(); }But, trying to access the buffer addr
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.