Ask questions and find answers on STM32Cube packages, including HAL, LL and middleware, and expansion software.
Most recent activity
Dear community,i'm trying to use tinysub for WebUSB application.My device is already see as a HID device....In copy, my USB_descriptor.c #include "tusb.h" #include "usb_descriptors.h" #include <string.h> // Identifiants USB #define USB_VID 0xCAFE #define USB_PID 0x4001 #define USB_BCD 0x0100 // UUID WebUSB (nécessaire pour Chrome) en little-endian #define WEBUSB_UUID \ { 0x38, 0xB6, 0x08, 0x34, /* Little-endian */ \ 0xA9, 0x09, /* Little-endian */ \ 0xA0, 0x47, /* Little-endian */ \ 0x8B, 0xFD, /* Big-endian */ \ 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65 } /* Big-endian */ // Descripteur principal du périphérique USB const tusb_desc_device_t desc_device = { .bLength = sizeof(tusb_desc_device_t), .bDescriptorType = TUSB_DESC_DEVICE, .bcdUSB = 0x0200, // USB 2.0 .bDeviceClass = TUSB_CLASS_VENDOR_SPECIFIC, .bDeviceSubClass = 0x00, .bDeviceProtocol = 0x00, .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, .idVendor = USB_VID, .idProduct = USB_PID, .bcdDevice = USB_BCD,
Hello everyone,I am writing my own "LL" for the OCTOSPI of the STM32H5 Series. (Because it seems there is only the HAL for it)And I noticed that in the reference manual that the bitfield SIOO in the CCR register is written as "Reserved, must be kept at reset value", but is used by the HAL.Bellow, taken from "XSPI_ConfigCmd" /* Configure the CCR register with DQS and SIOO modes */ *ccr_reg = (pCmd->DQSMode | pCmd->SIOOMode);#define XSPI_CCR_SIOO_Pos (31U) #define XSPI_CCR_SIOO_Msk (0x1UL << XSPI_CCR_SIOO_Pos) /*!< 0x80000000 */ #define XSPI_CCR_SIOO XSPI_CCR_SIOO_Msk /*!< Send Instruction Only Once Mode */Reference manual is RM0481 Rev 3 from March 2025 and the HAL is the V1.5.0 from the 05 February 2025. Is this a mistake in the RM? Can I use this SIOO bitfield? Thank you in advance.
Now, I am using the NUCLEO-H755ZI-Q board, Could you share how to solve the issue of using the same (shared) variable in across different cores?when I try to debug the code of freertos ,It is not going to debug after it enter this line osKernelStart(); how to debug further. how to know my code is correctly working or not. (i am useing stm32cubeIDE)
I'm not sure how I did it, but my Blue Pill STM32F103C8T6 doesn't respond to st-info --probe any more. This has happened twice in a row with identical devices. It seems that if I Ctrl-D out of GDB (an old bad habit) the device seems to brick itself and won't respond to programming or STLINK probes. I'm using an STLINK/V2 programmer attached to the SWIO/SWCLK pins. I can still set the BOOT0 pin to boot the system ROM bootloader and get proper responses from the STLINK/V2 programmer. So, I'm wondering where I can download the original flash bootloader and what address I'd need to use with st-flash to flash it back onto the device so that I can return to a nice wholesome flash bootloader.
Hi all,after working with Arduinos for some time now, I am currently trying to get stuff to work using a blue pill (stm32f1). I've managed to get some code working that turnes on the builit-in LED when a button is pressed using the Arduino IDE.With that milestone achieved, I am now trying to get the STM32 to communicate with my 64bit win7 PC via serial / USB. When I plug in the STM, no connection is established. The win device manager shows an "unknown device" and under details error code 43 is given.I've searched the net for quite some time now but haven't found a solution to my problem. I've tried a couple of drivers from this website, but noting worked. I added a 1.8kOhm resistor between PA12 and 3V3 to compensate for the wrong resistor on most blue pills (10kOhm insted of 1.5kOhm)Maybe some of you can point me into the right direction. Should the blue pill connect automatically for serial communication via USB like other µ-controller / USB devices? If no: What do I have to do to m
Hi there, I am currently working on power optimization for my application. My code runs at 80MHz HSI, so in order to implement sleep mode I am dynamically changing the clock to 2MHz. After system changes to 2MHz, I am disabling the systick using the function "HAL_SuspendTick()", and i am using the function "HAL_PWRex_EnterSTOP2Mode(PWR_STOPENTRY_WFI)". Outside the main I am using the EXTI callback associated with pin pc13 i.e. exti13, to wake system from stop-2 mode. The issue I am facing is in stop-2 mode ideally it has to consume 1.1uA- 1.4uA, but for me using the above approach my current consumption is 200uA which is very high. Kindly help me out sorting this issue. @Piranha
So, a month or two ago, I had an issue where my USB 2.0 wouldn't connect and kept giving an error that the device descriptor wasn't detected. I found out at the time, that it wasn't properly generated, added it and all was fixed. Well, more problems started a week or so ago. My old STM board had damage done to it, and thus I had to swap to a new one. Luckily, the add-ons (ADC and USB 2.0) were undamaged. I have a problem though. The exact same code I used for the original board does not appear to be working on this new board. The boards are close to identical, going from an STM32 h745 to a h755. I have no idea why it wouldn't work, considering it worked fine on the old board. I've tried going back in versions and so dice. It keeps either simply not showing up in the device manager when connected or gives the same old error of device descriptor wasn't detected. I'm kind of stumped and have no idea why it would be doing this. If anyone has any ideas on things to try, I'm all ears an
Good morning everyone,I'm currently trying to implement a SPI slave in full duplex mode on a STM32F469IDISCOVERY in order to interface with an external Master that is working at 10Mbit/s (the master cannot be modified). What I need to do is a full duplex communication by receiving a packet of 32 bits and at the same time responding with 32 bits that correspond the answer to the previous packet. Those transaction happens in a "burst" of 6 transaction each every 25us , then some idle time in the order of ms and the transactions restart. During each transaction, 3 messages are sent by the master (0xA3000007,0xB3000006 and 0x93000004). My idea was to use SPI in full duplex with Interrupt mode by relying on the HAL function HAL_SPI_TransmitReceive_IT(), since later I will be needing to add some elaboration in the meantime and I cannot keep the microcontroller halted for communications. I first started testing only the reception and everything works fine. Once I started trasmitting
We have a problem converting our running USB VCP application (RTOS) to a working RNDIS version.We replaced the regular variants of usbd_cdc.* and usbd_cdc_if.* by their RNDIS variants.The USB OTG HS clock is enabled.We adapted the initialization: if (USBD_RegisterClass(&hUsbDeviceHS, &USBD_CDC_RNDIS) != USBD_OK) { while (1) { } } hUsbDeviceHS.pClassData = USBD_malloc(sizeof(USBD_CDC_RNDIS_HandleTypeDef)); if (USBD_CDC_RNDIS_RegisterInterface(&hUsbDeviceHS, &USBD_CDC_RNDIS_fops) != USBD_OK) { while (1) { } } We adapted the device descriptor (bDeviceClass=0xef instead of 0x02 and bDeviceProtocol=0x01 instead of 0x00)The USB transfer is working for 1-2 seconds, but at the end the code stucks with an ISR queue overflow error.Did anyone ever hear about such a problem? Or what do we miss in our initialization?
Hello,I stumbled upon a cubemx generation issue for sdmmc2 for the stm32u5g9zjt6q (I didn't have this issue with some other stm32u5xx).For a basic cubemx configuration of sdmmc2, the HAL_SD_MspInit is wrongly generated. It is a bit annoying as I have to manually edit the file for each code generation or create my own overload function (not a huge effort I concede).In the Src/stm32u5xx_hal_msp.c, void HAL_SD_MspInit(SD_HandleTypeDef* hsd) calls __HAL_RCC_SDMMC1_CLK_ENABLE();instead of __HAL_RCC_SDMMC2_CLK_ENABLE();Same for void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd) with the __HAL_RCC_SDMMC1_CLK_DISABLE()I might be the only one to experience it but I put it here just in case.
phy芯片设置百兆全双工自协商连接千兆交换机时网络ping不通,连接百兆交换机正常 P1连接千兆交换机phy寄存器 P2连接百兆交换机寄存器 P3主控关键寄存器 Translation: When the Ethernet PHY chip is set to 100M full-duplex auto-negotiation and connected to a gigabit switch, the network ping fails, but it works normally when connected to a 100M switch. P1 connects to the gigabit switch phy register. P2 connects to the 100M switch register. P3 master control key register.
When using the register callbacks feature ( USE_HAL_UART_REGISTER_CALLBACKS = 1) , the BSP does not register the default callback, causing the serial port not to work. Fix: diff --git a/Drivers/BSP/STM32G4xx_Nucleo/stm32g4xx_nucleo.c b/Drivers/BSP/STM32G4xx_Nucleo/stm32g4xx_nucleo.c index 89b0837..bd2dd97 100644 --- a/Drivers/BSP/STM32G4xx_Nucleo/stm32g4xx_nucleo.c +++ b/Drivers/BSP/STM32G4xx_Nucleo/stm32g4xx_nucleo.c @@ -384,7 +384,7 @@ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init) /* Init the UART Msp */ COM1_MspInit(&hcom_uart[COM]); #else - if(IsComMspCbValid == 0U) + if(IsComMspCbValid[COM] == 0U) { if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE) {
On STM32G0 is it faster to disable and enable interrupts using the functions __STATIC_FORCEINLINE void __enable_irq(void) { __ASM volatile ("cpsie i" : : : "memory"); } __STATIC_FORCEINLINE void __disable_irq(void) { __ASM volatile ("cpsid i" : : : "memory"); }I'm not sure what "memory" does in the above. or is the code below faster__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) { if ((int32_t)(IRQn) >= 0) { NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); __DSB(); __ISB(); } } __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) { if ((int32_t)(IRQn) >= 0) { __COMPILER_BARRIER(); NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); __COMPILER_BARRIER(); } }I realize using the NVIC is more fine grained but just wondering what the memory behaviors differences are of these two and if one is heavier than the other.Thanks! xxx
I took the following code example from STM32h747 discovery git. Even though I have specified the number of channels as "2". The data at location 1, soon is zero which means R right channel data is always zero. Please let me know if something is wrong. Thanks,Haresh E.L. ALIGN_32BYTES (uint16_t inpBuf[AUDIO_IN_BUFFER_SIZE]) __attribute__((section(".RAM_D2")));ALIGN_32BYTES (uint16_t outBuf[AUDIO_IN_BUFFER_SIZE]) __attribute__((section(".RAM_D2"))); uint32_t channel_nbr = 2; AudioFreq_Ptr = AudioFreq+2; /* AUDIO_FREQUENCY_16K; */ AnalogAudioOutInit.Device = AUDIO_OUT_DEVICE_AUTO;AnalogAudioOutInit.ChannelsNbr = channel_nbr;AnalogAudioOutInit.SampleRate = *AudioFreq_Ptr;AnalogAudioOutInit.BitsPerSample = AUDIO_RESOLUTION_16B;AnalogAudioOutInit.Volume = AnalogVolumeLevel; AnalogAudioInInit.Device = AUDIO_IN_DEVICE_ANALOG_MIC;AnalogAudioInInit.ChannelsNbr = 2;AnalogAudioInInit.SampleRate = *AudioFreq_Ptr;AnalogAudioInInit.BitsPerSample = AUDIO_
Hello,I am listing files on the SD card using fileX. My issue that some of the files contain Czech Characters (eg. č,ž,ě,š and few more). It seems that files with czech characters are read with shortened file names. (FX_MAX_LONG_NAME_LEN is set to 256). For example file "113---Kočka ze Záběhlic.dat" is read as "113---~1.DAT". File with almost the same name length "112---Dejte mu zahrát.dat" is read correctly.So my theory is it has something to do with the character encoding.I used to read all the names correctly with fatfs in the past however this is first time I am using FileX.Any tips?regards Jeronym
Posted on June 09, 2017 at 20:41[reposting after 30 days of no responses]Hello all,I have been making great progress using CubeMX and HAL for lots of things, now I want to try ethernet. My application is very simple, I only want to send and receive raw ethernet frames -- no UDP or TCP at all. I also prefer not to use LWiP for something so basic. Can anyone point me to an example of raw ethernet frame IO using just HAL? I will be using Nucleo F429ZI.My requirements:[ ] send a raw frame (source and destination MAC address, type IP and payload, total less than 1500 bytes)[ ] receive interrupt upon receipt of a raw ethernet frameMy transactions are slow and simple, I do not even need any buffer queuing.Thanks for any tips.#raw-ethernet-frame
Earlier I implemented file transfer using TFTP in which my stm32 module was working as a server. But now I want to make it work as a TFTP client. Is there any example regarding TFTP client.
Hi everybody,I am currently working on an STM32F446REDatasheet I need to save some bytes like 10 for example. I need to save some bytes like 10 for example, in flash memory to save my HMI configuration.I have read articles and done research but I don't understand everything.The memory is divided into sectors. I think I have to write my data to the end of the memory. However, the last sector is 128kB. Do I have to erase 128kB each time? Isn't there a simpler and less resource-intensive method? Can't we just delete a 2KB page?I really need to save only a few variables Thank you to reading me
Dear community,I'm trying to use the tinyUSB librarie for a WEBusb API on my STM32F411.I' have spend many hours without result...One side, the TinyUSB seem be serious, on other hand no example on web.so my question, is do you have already use the tinyUSB for Webusb application ?do you have a simple exemple ?thanks all.
Hello, I am using a STM32G0B1xx MCU with the X-CUBE-TCPP v4.1.0 stack an FreeRTOS. I am trying to setup a USB-c port with OTG-functionality. I am having some problems understanding your X-CUBE-TCPP-stack.Some background info:I am initializing the software with MX_UCPD1_Init() and MX_USBPD_Init() provided by the original stack/CubeMX. I am testing the connection with several USB-devices an -hosts. We tested a previous version of our software on a NUCLEO-G071RB in combination with a X-NUCLEO-DRP1M1 with your Tool "STM32CubeMonitor-UCPD", which was working fine. 1. The DPM_Params[0].PE_DataRole is always defined as USBPD_PORTDATAROLE_UFP, no matter what i connect to the USB-c port. Is this intended? 2. I do not get a Notification for USBPD_NOTIFY_DATAROLESWAP_UFP or for USBPD_NOTIFY_DATAROLESWAP_DFP in here, no matter what I connect to the USB-c port:/** * @brief Callback function called by PE to inform DPM about PE event. * @PAra
Hi to all, I am developing a product with the STM32H523VET6. This product must have USB 2.0 used as MSC Host (a USB-C connector is used but both communication and power management are of type 2.0). I would like to use the libraries in bare metal, without an operating system.For the configuration of the USB peripheral and the Middleware (bare metal) I used the CubeMX but when connecting a USB pen drive no event is generated (I inserted two breakpoints respectively on the functions ux_host_event_callback and ux_host_error_callback of the app_usbx_host.c file).The USB pen drive used is this one and is formatted FAT32: https://amzn.eu/d/cHLLlJ6I checked the power supplies and signals and they seem ok. I repeated the same test using the NUCLEO-H563ZI demoboard (I don't have the demoboard for the micro used on the product) shorting SB7, putting the JP2 jumper in the USB USER position, powering the board with 5V from the CN8 connector and inserting only the USB part (always bare met
Hello@STTwo-32 @Remi QUINTIN , We are using STM32WB55RG MCU for our development. From the examples I came to know that the BLE device initially starts advertising as peripheral and the mobile device as central will be able to scan the device and initiate the connection. Once connected the device advertising is stopped. But, I came through the BLE stack document and find out it is possible to have simultaneous connections with the BLE peripheral device upto 8. I have been trying to have multiple connections of the BLE, like I want the device to be connected as well as advertiser so that it is possible to connect to with other central devices.Do we have any examples in the STM32WB SDK which shows this behavior of connecting with multiple devices?If yes, please let me know. I have tried my side, changing few lines of code in the software as shown belowFirstly, In app_conf.h, i changed maximum number of simultaneous connections that the device will support to
hi,Previously i was using STM32L010K8TX which has 8K memory. I did OTA update in this device via Uart with help of external controller which receive hex file from User. Currently am using STM32L010R8Tx which has 64K memory. And i tried the same OTA program to update the application in this new device but after OTA update the user application is running proper.The external device which receive hex file has a debug communication port to monitor STM32L0 device by communicating in UART. After updating the application the UART communication not at all responding to external device.After completing the OTA update am using GO command to run application (0x08000000) and making Boot Pin Low ( which is making HIGH When Entering to OTA mode). Am using same OTA file commands flow to update which was used for previous device (stm32L010K8Tx) including the memory locations. but in new device after updating the OTA it stops working Uart peripheral. I am not sure about other peripherals
Hello ST Community, I am currently working on a project using the STM32U5G9ZJT6Q MCU. My application involves sending data over USB using CDC-ACM mode. While the code appears to be working correctly, I am encountering an issue where the execution gets stuck in the scheduler.However, during runtime, the code halts, and the debugger points to _tx_thread_schedule(); I suspect there might be an issue with middleware integration or clock settings, but I am unable to pinpoint the root cause. The code I am using is sourced from this link: https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/STM32U5G9J-DK2/Applications/USBX/Ux_Device_CDC_ACM Has anyone encountered a similar issue or have any insights into what could be causing this? Any guidance or suggestions for debugging would be greatly appreciated. Thank you in advance for your support!
Posted on February 03, 2017 at 17:57I'm trying to implement an XMODEM file transfer through the USB CDC Interface on an STM32L4 processor in Full-Speed and seem to be having issues with XMODEM 132 byte packets getting split up and one of the middle packets getting resubmitted. I need to be able to NAK/ACK the XMODEM packets to keep the transfer going but this seems to sometimes mess up the submitting of the sub-packets causing me to get invalid data. Is there anyway to only trigger the CDC_Receive_FS function once all 132 bytes are received at the end point? Handling the separate packets from within the CDC_Receive_FS is causing problems because sometimes the broken up packets are being sent multiple times and there is no easy way of detecting a repeat.I generated my code using the latest STM32 firmware for STM32CubeMX and am working in Keil.#stm32-usb #usb-fs #usb-cdc #usb-vcp-stm32_usb-fs-device_lib #stm32l4
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.