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
Hi ST Community,I am working on a project using the STM32H723 MCU and the KSZ8863 Ethernet switch. I initially encountered issues while using a modified TCP echo server example, but after reverting to the unmodified example, the same issue persists. Communication is functional, but the system eventually crashes with the following assertion:Assertion "mem_free: illegal memory: non-linked: double free" failed at line 661 in ../Middlewares/Third_Party/LwIP/src/core/mem.cSystem Details:MCU: STM32H723Switch: KSZ8863 (connected via RMII for Ethernet data and SPI for control)Middleware: LwIP (as provided in STM32Cube firmware package)Example Used: Modified tcpecho server example from LwIP.Peripheral Interface:RMII for Ethernet data.SPI for KSZ8863 switch configuration.SMI is not used.Observed Behavior:The application works correctly for some time, and the TCP echo functionality responds as expected.Under moderate network load or over time, the system crashes with the above assertion in LwIP’s
Hello,I am new to the STM environment and need to test if one M7 core is sufficient for my project. I need to use Ethernet (simple GET, POST, and PATCH requests), an LCD touch panel, and a peripheral that requires EXTI interrupts approximately every 10ms.I believe it would be better to use FreeRTOS in order to manage the different tasks. I am wondering which option is the least time-consuming and most reliable: using FreeRTOS with its own TCP stack, or using FreeRTOS with LWIP.I am using an STM32H745-DISCO and plan to use only the M7 core. If it is not enough for my application, I will test with both cores.Does my reasoning make sense? Can someone give me some advice?Thanks, best regards.
Hi everyone,During developing applications with STM32l476, using HSI16, I choose STOP1 or STOP2 mode to reduce power consumption , and wake up with RTC Alarm.if (HAL_RTC_SetAlarm_IT(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK) { Error_Handler(); } HAL_SuspendTick(); HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI); //HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);Documentation states that RCC clocks (and most peripherals) are stopped during Stop mode, thus clock re-init is essential for proper wake up.Do I have to also re-init peripherals used before entering Stop mode ? For example//Not only SystemClock_Config(); HAL_ResumeTick(); //But also HAL_UART_Init(&htim3); HAL_TIM_Base_Start_IT(&htim16); ... In the same spirit, do I have to De-Init peripherals before entering Stop mode ?I have tested both init/DeInit and not, and both ways seem working, but is it safe to leave peripherals "as they were" before sleeping ? Is Init/Deinit for sleep "lost" cycles ?
Hi,For FreeRTOS we can choose using CMSIS OS wrapper in the CubeIDE. But there is not such options for ThreadX. So, how to enable it? Thanks.
Hello STM Community,I am working with the STM32G431 microcontroller and have encountered a discrepancy between the practical and theoretical ADC sampling rates. Here's my setup:ADC Input: PA0 configured as ADC1_IN1 (single-ended mode).ADC Parameters:Mode: IN1 Single EndedADC Prescaler: Synchronous Clock Mode Divided by 4Resolution: 12 bitsData Alignment: RightContinuous Conversion Mode: EnabledSample Time: 2.4 ADC CyclesSystem Clock Frequency: 170 MHzI have toggled a GPIO pin after ADC conversion to observe the sampling rate on an oscilloscope. The measured sampling rate is approximately 142 kHz, while my theoretical calculation suggests it should be around 11.33 MHz.The theoretical calculation considers the formula:Sampling Rate=fADC /{ [sampling time(in cycles)] + [resolution (in bits)] +(0.5)}Substituting the values:Sampling Rate=170 MHz / (2.4+12+0.5) ≈ 11.33 MHzI am unable to identify why there is such a significant difference between the calcula
Hi Community,I came a cross with a strange error that I can not understand the reason.As I search the read me file of the example project which is shared by ST.It is written as below.2. load the image into the target3. Execute the code- LED4 toggles regularly : all the tests are executed correctly (each toggle signalizes flash test completion)- LED4 single short flash appears once per 2 seconds: one of the tests FAILED (FailSafe_Handler keeps fail code)- LED4 single short flash appears once per 4 seconds: one of the tests FAILED by defense programming.When I run the code without changing any part of code. Led blink as section 1 (Toggle regularly). But the funny thing is so strange.When I even only define a variable in main file like as uint16_t Error_Code;The led blinks like section 2 (LED4 single short flash appears once per 2 seconds.)And when I try to debug Error_Code shows 0(like it restart itself )when I stop the debugging it turns error code 13(TMF_ERR_CODE).I coul
Hello everyone,I’m encountering an issue with the srand() function in my STM32H747 project, and I would appreciate your insights on what might be causing this problem.Hardware:MCU: STM32H747IIT6Custom boardSoftware setup:CubeMX-generated projectCube CLT version: 1.17Firmware version: 1.12.1Problem DescriptionWhenever I call the srand() function, my code immediately ends up in the exit handler.To troubleshoot, I created a minimal project with no additional middleware (bare minimum setup), and in that setup, the srand() function works without any issues.However, in my main project where I need both lwIP and FreeRTOS, calling srand() causes an exit. The project was created following this guide:How to Create a Project for STM32H7 with Ethernet and lwIP Stack.I made one modification to the guide: instead of using the default OS wrapper, I selected CMSIS_V2.Currently, I am only using the M7 core.What I’ve Tried So FarMinimal project without lwIP and FreeRTOS -> srand(12345) works fine.Pro
I am using the STM32H743VITX MCU and TouchGFX with the display (800x480px) in a single buffer format with RGB565. The framebuffer size is calculated to be 750KB; however, the MCU does not have a contiguous 750KB region in RAM. I am exploring ways to utilize this resolution without adding external memory, such as SDRAM.While I have looked into partial framebuffer rendering, this option does not appear to be available in CubeMX, and I am unsure why. Does anyone know any other workarounds for this issue or why PartialFrame is greyed out for me in CubeMX?
Hello,I am testing UART via a loopback test. This shows that the expected data is being sent on TX and received on RX, but the receive function always times out.This post stated to clear the OVR and RXNE flags before calling the receive function, but that did not fix the issue.My program gets stuck in the while loop while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)inside stm32l4xx_hal_uart.c, where Flag = RXNE. While RXNE is set before calling HAL_UART_Receive, it gets reset on the line if (huart->RxState == HAL_UART_STATE_READY), so the while loop never exits. I am not sure why this line resets RXNE.I have tried different UART peripherals (USART1,2,3) as well as different pins. I also tried using interrupts with UART. Doing this did not fix the issue either.Any possible solutions would be appreciated. Thanks.int main(void){ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_USART3_UART_Init(); while (1) { uint8_t arr[3] = {2,4,6}; uint8_t buffer[3]; if(__HAL_UART
Hello,I'd like to set up a log management system that would allow me to write to both the UART and a file (NOR flash).However, I'm encountering data architecture difficulties that I can't resolve.I'll typical want to write in my file only after buffering few lines to write a the same times to limit the number of write operation. I based my design around message queue.The idea, the call function: mytrace(CRITICAL, “my trace message that can be longer than 64 bytes”) The function definition. Since my trace buffer can be bigger that 64 bytes which is the limit for messages queue in Azure RTOS, I've to : allocates byte memory pool, and queues the pointer : void mytrace(const char* buffer) { char* queue_buffer; if (tx_byte_allocate(&m_trace_byte_pool, (VOID**)&queue_buffer, MAX_TRACE_SIZE, TX_NO_WAIT) == TX_SUCCESS) { // buffer successfully allocated snprintf(queue_buffer, MAX_TRACE_SIZE, "%s\n\r", buffer); if (tx_queue_send(&m_qTr
I'm working on an STM32 project where I'm jumping to code in external QSPI flash (address 0x90000000) after booting from internal flash. I've configured the QSPI memory-mapped mode correctly, and the jump to the external flash works. The interrupt vector table is set up at the beginning of my external flash memory, and the linker script is configured to place the code in external flash, with VTOR set to the start of external flash memory. The MPU is currently disabled.When the code is running from external flash, HAL_Delay() causes my program to stall. However, if I replace HAL_Delay() with a simple custom delay loop, the code runs correctly. This strongly indicates that there is an issue with how HAL_Delay() is interacting with the hardware or the HAL itself when the code is running from external memory. I've verified that the clock settings are consistent in both internal and external flash.I need help in understanding what could be causing HAL
Source code formatted - please see How to insert source code for future referenceFor example, I want to send NTS(net status): Dspic33 will send Hex string 4E 54 53 12 00 03 10 00 00 06 10 00 00 01 10 00 00 96 90 00 0D 0A (this is correct Hex data string should be received in stable). But I will get a Hex string in the wrong position on RxBuffer of lora-e5 chip like this: 02 10 00 00 96 90 00 0D 0A 4E 54 53 12 00 03 10 00 00 05 10 00 00, or sometimes it will be like this 00 96 90 00 0D 0A 4E 54 53 12 00 03 10 00 00 05 10 00 00 02 10 00 The Hex strings received by lora will not be consistent in order even if I use DMA or send via regular UARTIn main.c of lora-e5 chip i write in while loop and interrupt uart callback like this: while (1) { HAL_UART_Receive_DMA(&huart1, RxBuffer1, sizeof(RxBuffer1)); MX_LoRaWAN_Process(); } void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { //stop DMA HAL_UART_DMAStop(&huart1); //process data and send the copy to TTN for (i
I have an older STM32 Nucleo-F746ZG and I want to try and send some serial over the ST-Link. I am in Ubuntu with VS Code. I have successfully built the project and it appears to be running in debug mode. However when I try to connect and read the serial output via Screen, Putty or even the Serial Monitor extension nothing is showing up on the serial port. I have found the ST-Link is at /dev/ttyACM0 and I have added my user to the dialout group, but nothing shows up. I am using UART2 in Asynchronous mode, added interrupt and using VS Code in debug mode. I suspect that this is OS related, but wanted to know if anyone had any suggestions on where to look. I have done other projects with STM32-Nucleo and VS Code so I believe this is a simple error on my part related to the ST-Link usb in Linux. Doug
I am using STMicroelectronics.X-CUBE-AZRTOS-F4 and STM32CubeIDE to make an NetXDuo HTTP server serve a web page POST from the MCU. The sample: "rtos-docs/netx-duo/netx-duo-http/Chapter2" is a minimal implementation. It is not an ST project, and does not adequately explain how to load the HTML from FLASH (I know how to write the binary web page to FLASH.), but does detail the minimum HTTP server for the application. I read through the excellent STM paper: "How to implement a webserver in STM32 using NetXDuo" and reviewed the STM NX_WEBSERVER NUCLEO-F429ZI sample. I know how to write the binary web page to FLASH. The literature said to use TIM6 as a Time base Source instead of SysTick. When I run the app, I get a hard fault in the entry to the SystemTimerThread, which seems to be automatically created. Does anyone know how to work around this fault? I am simply looking for the "minimum
I've tried to disable the XferHalfCpltCallback when using UART DMA transmit without any luck. I believe that you cannot change the callbacks, or disable them. Observations:When you call HAL_UART_Transmit_DMA(), the callbacks are set to predefined UART functions. This happens right before HAL_DMA_Start_IT() which then checks for NULL callbacks and decides whether to enable/disable the interrupts. The interrupts always get enabled and callbacks always get called. The HAL has code to disable the interrupt if a NULL callback is found, but they are never NULL per item 1.Calling HAL_DMA_UnRegisterCallback() is moot.Ideas?
HelloThis is my first post on the forum, always a happy reader in the past and happy STM32 user as well!Now I want to go a bit further then the standard IO and control. I want to implement LWIP + FreeRTOS with a STM32F7. And yes, the fresh generated code doesn’t work out the BOX, surprise. After debugging and reading a lot of posts I was able to get a ping from my bord! Yes!Well after creating 2 threads and try to do some UDP socket handling, it was again broken! (Only setup the connection, no traffic yet.)What is the status for ST to support LWIP on there hardware? When I search on the forum my PC is exploding how many topics are created and bug reports are made some of them already years ago without any solution or implementation in newer releases from Cube MX.What is the roadmap, ST + LWIP (+ FreeRTOS)? I know your goal is to sell silicon, but if the software is well written and the basic stuff is working out of the box, you will sell more silicon!
Hello Forum, I have a question regarding OTA and toggling between flash banks on a STM32L496. I have read many forum posts on here relating to this and I have reached a point where I need assistance as debugging iteratively is taking a lot of time. I am developing a firmware update process that has the update code as part of the application, not as part of the bootloader. Serial messages are received containing the binary data (derived from a *.bin image) and are written to the flash bank which is currently not in use. The part has a flash memory layout as follows: Flash Area Memory start address Size Name BANK 1 0x0800 0000 2k page 0 0x0800 0800 2k page 1 0x0800 1000 2k page 2 ... 0x0807 F800 2k page 255 BANK 2 0x0808 0000 2k page 256 0x0808 0800 2k page 257 0x0808 1000 2k page 258 ... 0x080F F800 2k page 511 If I have freshly reprog
Hi guys,unfortunately I am not able to find an example on how to use/configure the STM32F769I-DISCO with FatFS and USB-Mass Storage to be able to stick a USB-Stick into the board and read/write files. Can someone of you point me in the right direction?I am getting the HOST_USER_CONNECTION event but not the HOST_USER_CLASS_ACTIVE event when plugging an USB-Stick into the board and have not the slightest idea where to start.In CubeMX I am getting an error that VBUS is not configured correctly before creating the code but there doesn't seem to be a dedicated pin for that on the DISCO board.Cheers,Patrick
Posted on April 15, 2017 at 13:11This bug has been reported before, but has survived a couple of cube version bumps.STM32CubeMX 4.20.1 and f7_cube 1.6.1in stm32f7xx_hal_conf.h it defines the PHY address incorrectly#define LAN8742A_PHY_ADDRESS 1should be#define LAN8742A_PHY_ADDRESS 0A symptom of this bug is HAL_ETH_ReadPHYRegister returning 0xFFFF for literally everything, and your cube-generated ethernet code won't work.
Dear all,I'm running the LWIP on a STM32H723 processor and need to enable the ICache and DCache within CubeMX. I'm also using DHCP which will only work when both caches are enabled. When I disable the ICache DHCP will timeout? UDP stop working after a number of packets without any notification of the reason. This occurs when the ICache is enabled, this is the default configuration. I managed to get bot ICMP and UDP (TCP) working by using the default CubeMX configuration and disable the ICache when DHCP has given an IP address. From then on I can transmit UDP packages without any problem. Is there anyone who can explain what is going on? Why does the LWIP stack need the cache in the first place? Does the Ethernet HAL library use the Cache? Enabling and disabling the ICache depending on the position in the software process really feels like a hack. I would like to understand what the reason is and how to solve it properly. Thanks in advanc
Hello.I'm going to use STM32f207VET and KSZ8863 (3Port Ethernet switch) for custom boards in this project I'm working on.The switch and stm32 are already hardware-connected to the RMII interface on the custom board.Clock used an external crystal and set it at 50 Mhz as below. What I want to set up on these devices is as follows.100Mbps Speed, Full Duplex, Auto Negotiation. I think you can select user PHY among the external PHY configuration options in the tube and then modify the code inside the HAL_ETH_Init() function after making other settings according to the KSZ8863 data sheet.As far as I know, to drive the Ethernet switch, you need to enter the values in each of the two PHY registers according to the MDIO protocol.But I don't know if what I know is right.If what I know is correct, do I just need to set the PHY register using MDIO?If what I know is wrong, please let me know which one is wrong.Also, please let me know how PHY will be initialized.Thank you.
Hello STM Community, I'm working on an STM32 project that involves a custom bootloader and application code. Here's the setup: Bootloader: Located at 0x08000000. Application: Located at 0x08040000. The bootloader successfully jumps to the application using a soft reset or in normal operation. However, after a hard reset (power cycle), the bootloader doesn't jump to the application as expected. Here's the goto_application function I am using in the bootloader: void goto_application(void) { /* Disable all interrupts */ __disable_irq(); /* Set the application's vector table address */ SCB->VTOR = 0x08040000UL; /* Get the application reset handler address */ void (*app_reset_handler)(void) = (void (*)(void))(*((volatile uint32_t*)(0x08040004UL))); /* Set the application's main stack pointer (MSP) */ __set_MSP(*(volatile uint32_t*)(0x08040000UL)); /* Disable SysTick */ SysTick->CTRL = 0; SysTick->LOAD = 0; SysTick->VAL = 0; /* Ensure changes are applied */ __DSB();
Hello, We have noticed communication errors with STM32 that is working in our device. The device includes STM32 (master) and TI's battery monitor BQ76952 (slave).Using the same device and same software we noticed three situations that occur randomly:After boot write commands are not returning any errors and further communication is correct. After boot few initial write commands are returning error and further communication is correct. However, we have noticed that some devices lost communication after longer perdiod (for example two months) and we don't know what is the reason for it. Only after rebooting STM32 communication is correct.Sometimes after boot few initial write commands are returning error and I2C peripheral locks up. In such a case all communication is failing. Only after rebooting STM32 communication is correct.HAL_I2C_GetError() reports following error codes: 0x02 (ARLO), 0x04 (ACKF).There are only two devices on I2C bus: stm32 (master), bq76952 (slave). I2C h
Hi there,I drove 4 SHT4x by STM32G473VE and used the HAL_I2C_Master_Transmit() and HAL_I2C_Master_Receive() to write and read the sensors.Normally, everything is well.However, if Iunplug the sensor;replug the sensor again;(Not the sensor maybe can NOT work normally)reset the MCU;the program will probably run into the following dead loop:I don't know why this happened, and how I can recover from this error state.Thank you!
Hello Team,1.I want to use ADC1 for reading 7 channels with DMA and one channel with Injected mode. total 8 channels for ADC12. One channel for ADC2 with timer1 capture compare event at 62.5Kz frequency.Total 9 ADC channels want to use. please let me know best way to read these many ADC's
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.