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! I am trying to learn about interfacing with an stm32f405 as a USB Mass Storage Device. My (homemade) development board has an onboard microSD card slot, and so I would like to present the card as my mass storage. I'm running into some problems with this, however, and here are my symptoms:If I set aside the SDIO component of things temporarily, and just try to present the Stm32's 1kb of internal memory as my mass storage, I see a nice "New accessory detected" popup on my mac, and see the stm32 enumerated in Disk Utility. My mac complains the disk is unformatted, and so it is not mounted. But overall this seems to suggest that the USB Mass Storage bit of things is working. When I try to use 1-wire SDIO (and modify usbd_storage_if.c accordingly) I can see the Mass Storage device enumerated in Disk Utility, and it is listed as a fat filesystem, but I cannot mount the drive. I am unsure why. When I try to use 4-wire SDIO, the system isn't recognized at all by my mac. Step
Hi!I have a project that will not compile due to "error: 'HAL_StatusTypeDef' does not name a type".The project uses STM32H563 and includes file stm32h5xx_hal_conf.h.The HAL_RCC_MODULE_ENABLED and HAL_GPIO_MODULE_ENABLED are defined.When looking into it, I see circular dependency in the includes of header files from this stm32h5xx_hal_conf.hstm32h5xx_hal_conf.h stm32h5xx_hal_rcc.h stm32h5xx_hal_def.h stm32h5xx.h math.h stm32h563xx.h core_cm33.h system_stm32h5xx.h stm32h5xx_hal.h --> (Here function declarations use HAL_StatusTypeDef) <-- stm32h5xx_hal_conf.h Legacy/stm32_hal_legacy.h stddef.h math.h --> (Here in stm32h5xx_hal_def.h is the definition of HAL_StatusTypeDef) <-- stm32h5xx_hal_rcc_ex.h stm32h5xx_hal_def.h stm32h5xx_hal_gpio.h stm32h5xx_hal_def.h ...
I'm using STM32U083C-DK which contains STM32U083MCT6 MCU. I want to use W25Q32 NOR Flash using standard SPI protocol. For implementing the file system, for my MCU -> Middleware doesn't have FATFS instead it has FileX, LevelX and ThreadX. I couldn't find any relevant reference to implement the file system according to my requirements (STM32U0XX + W25QXX NOR FLASH + SPI) using FileX. I tried by taking some github repos as reference.... like, Fx_NoR_Write_Read_File which uses ThreadX as well & it uses OSPI (I tried to replicate it for my requirements but it didn't work) and then Fx_SRAM_File_Edit_Standalone (I tried to replicate this also, like FileX Standalone + NOR SPI, but didn't work).So, then I saw SPI_Flash_Uart_Led_Polling_V1.0 which uses FatFS for W25QXX uisng stm32f429igt6 MCU. I tried to replicate this but f_mount() is returning FR_NO_FILESYSTEM error. Anyone know how to fix it?Or it would be really great if anyone guide me how to use F
Hello,I am facing an issue while implementing USB UVC (Uncompressed) on the STM32U5G9J-DK2 board.The setup works fine with USBD_VIDEO_EPIN_HS_MPS set to 1400U, and I can achieve image output. However, increasing the endpoint packet size beyond 1400U (e.g., up to 4000U) causes the device to stop being recognized in Device Manager.The issue appears during the initialization process, where the ux_device_stack_class_register function in MX_USBX_Device_Init() returns UX_ERROR.This results in the code getting stuck in the following loop:status = MX_USBX_Device_Init(memory_ptr);if (status != UX_SUCCESS){ while(1) { }}For my application, I need to achieve a higher data rate, which requires increasing the endpoint packet size. If I can increase the value of USBD_VIDEO_EPIN_HS_MPS, it would allow me to send larger packets, which is essential for achieving my data rate goal.I’ve attached a ZIP file containing my code for reference, along wi
I have an application using STM32L475, threadx, filex.Functions in the filex API work well when called from a specific thread: the same thread that initialized and mounted the file system. If I call the same functions from a different thread, the system crashes. I have seen the calls to FX_PROTECT and it looks like the filex API should be working across multiple threads, however, something is not working here. However the documentation does not tell much.Just asking if someone has encounterd the same problems I have.
I am trying to interface a SPI flash from Winbond (W25Q64JV) with FATFSI have no previous experience with FATFS.I initialize FATFS in CubeMX with the option "used-defined" and modified the MAXIMUM and MINIMUM Sector Size to 4096, as it is the smallest possible erase sector dimension.I also have a library with function to read, write, erase and other stuff in my Flash with the SPI which works fine.I know that I only have then to completed the file "user_diskio.c" generated by CubeMX to interface my flash library with the FATFS library. Specially the functions:DSTATUS USER_initialize (BYTE pdrv);DSTATUS USER_status (BYTE pdrv);DRESULT USER_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count); DRESULT USER_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count); DRESULT USER_ioctl (BYTE pdrv, BYTE cmd, void *buff);As I don't see any erase function to complete, one of my question is to know if I need to erase the sector before writing in it in the USER_write function ?Tha
Hi All,By mistake the default debug target got deleted and our development/testing target got created using the release target. I was looking at what are the exact options in which the debug and release target differs so I can create the debug target again. I tried to create the debug target from the "create new configuration" menu using the default debug target there, but it does not seems to work. The current development target have already lots of updates for our custom project so I rather not create a new project but instead update it with the debug configurations to be able to step in the debug mode, also I think this post might be useful for other people if we get the answer.
I am using an STM32F767ZI dev board and trying to set it up as a TCP Server. After initializing LWIP and FREERTOS, I am having problems with pinging the board. After checking my gateway, it seems that the gateway is able to sendt packets to the stm32, but it does not receive the packets. help
Hello!I need to set up an STM32H745 to make an HTTPS request. In the last few weeks, I have configured LWIP using this example (https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308) and set up the code for making PATCH requests to a server over HTTP(https://community.st.com/t5/stm32-mcus-embedded-software/http-client-lwip-stm32h745-disco/m-p/766598#M59443). Yesterday, I began exploring which options are better for HTTPS communication.I've seen that there are two main options: mbedtls and wolfSSL. Mbedtls is integrated by default in STM32CubeMX (6.13.0). The version of mbedtls in CubeMX is 2.16.2, while the latest version on the mbedtls website is 3.6.2. Could it be that mbedtls is no longer supported?On the other hand, the version of wolfSSL available for download in CubeMX is 5.7.4, and the latest version on the wolfSSL website is 5.7.6. It is more up-to-date. Besides these considerations, I haven't found any
I have a Sensor Tile.Box pro and I want to communicate using I2C to an external peripheral using the PG7 and PG8 pins, which are the I2C3 SCL and SDA pins. However I am unable to get as much as basic GPIO working on those two pins, let alone I2C.I have created a small standalone project for the ST32U585 chip, and using that project I can get I2C and GPIO working without any issues. But when I copy over the working code for initializing the clock and GPIO pins from the standalone project over to the SDDataLogFileX project (which I got from here, and uses the Azure RTOS) the GPIO pins no longer work. Below is the relevant code I'm using. int main(void) { /* USER CODE BEGIN 1 */ /* 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_Conf
I'm trying uart loopback and checking if I'm receiving the transmitted data on the receive buffer, I'm using nucleo-u575zi board , uart2 I'm using , baudrate is 57600 , the tx pin & rx pin are configured as shown below GPIO_InitStruct.Pin = GPIO_PIN_2; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); I'm using receive in interrupt mode and in ISR function I'm trying to receive byte by byte, And also, before going to receive callback it goes error callback function where the error-code is 4 and then it goes rxcallback where byte by byte reception happens,
Moved from the Feedback forum. Please don't post product questions in the Feedback forum. Recently I have been working on a simple gamepad-like controller using stm32 (link) since this is a hobby project I wanted to learn how to use USB from first principles, given that I only have some basic understanding on how USB works and wanted to improve on that.Unfortunately I have run into, what seems like, a massive drought of information regarding this topic (implementing usb from scratch on embedded), yes, there's this fantastic example I found (link) and was able to follow while referencing the manual and learning more about USB on embedded, unfortunately I have run into issues regarding Windows OS not being able to read/recognize the USB device. I don't know what exactly is the problem with my usb code (link), but I think I have narrowed it down, it seems to be something with the packets, device request is being sent 4 times, all with different sizes (64, 64, 18,
I am developing in C++ on a STM32U5, with HAL and was trying to figure how to embed interrupt handling in a class.So I've questioned ChatGPT and DeepSeek for a solution and both gave an answer using pUserData field for storing object reference.pUserData is a field provided by any handler (like UART_HandleTypeDef) and ... I do not have such field with my version of HAL that CubeIDE used for building my project.I've pinpointed that problem to DeepSeek that gave me this answer:Okay, the user mentioned that the HAL handlers don't have a pUserData field. Hmm, I need to recall which STM32 HAL versions include that. Oh right, older versions might not have it, especially before HAL introduced the MSP layer with user data pointers.So, is there a version of HAL with that field ? My version of HAL seems not so old (and U5 family is rather new), so how much recent should be HAL version to have this field ? Or both AI are totally dumb ?
Hi Experts,We are building a battery based product based STM32G030F6 MCU. We are using Arduino environment as we need multiple Arduino libraries for the project.Well our software is working fine, however we are facing issue with the current consumption. It has to wakeup every 5 seconds and send some data. We are able to put microcontroller in DeepSleep mode using STM32LowPower Library In deepSleep mode it takes around 175uA current. We need to further reduce the current consumption to less 20-25uA. So we are trying to use shutdown mode but not able to use it.When we use shutdown mode, it still takes 175 uA. When analyzed the code we found that it is falling back to deep sleep mode when it does not found LSE. When LSE is available it tries to call function HAL_PWREx_EnterSHUTDOWNMode() It is available in Arduino core for STM32. File name stm32g0xx_hal_pwr_ex.c We tried to call this function (with LSI enabled) in library'sLowPower_shutdown() function instead of f
I am developing a project with STM32 using the STM32G473CET6 chip and working on a CAN bus system. In this project, the STM32 sends messages to the bus, processes the received messages, and responds accordingly. For example, the message 10170001 queries the I/Os states of device 01, and the response consists of 8 messages containing the I/Os,dev states, PWM values, etc. However, if there are multiple devices on the bus, when I query device 02 with the message 10170002, it seems to print some of the responses from the previously sent message 10170001 (e.g., 2 out of the 8 messages). Then, on the third query, it finally sends the correct I/O states of device 02. It feels like there is some kind of overflow or buffering issue within the STM32, but when I check the FIFO levels, everything seems fine. My termination resistors are also properly configured. What could be causing this strange behavior? thank you1 - My termination resistors are correctly placed at both ends of the bus. 2 - I ha
write successfully but read not working . and show fail to find file in fatfs spi flash using stmcube and w25q64 void test_fatfs(void) { printf("Mounting filesystem...\n"); fres = f_mount(&fs, "0:", 1); if (fres != FR_OK) { printf("Failed to mount filesystem: %d\n", fres); return; } printf("Filesystem mounted successfully\n"); // Open file for writing fres = f_open(&file, "test.txt", FA_WRITE | FA_OPEN_ALWAYS); if (fres != FR_OK) { printf("Failed to open file for writing: %d\n", fres); return; } printf("File opened for writing\n"); // Write to file UINT bytes_written; fres = f_write(&file, "text\r\n", 6, &bytes_written); if (fres != FR_OK || bytes_written < 6) { printf("Failed to write to file: %d\n", fres); f_close(&file); return; } printf("Data written to file successfully\n"); // Synchronize filesystem fres = f_sync(&file); if (fres != FR_OK) { printf("Failed to sync filesystem after writing: %d\n", fres); f_close(&am
Hello!I need to implement a task in FreeRTOS for my project that makes GET, POST, and PATCH requests to a server. So far, I have managed to send a UDP message to a specific port on a PC thanks to the following post:https://community.st.com/t5/stm32-mcus/how-to-create-a-project-for-stm32h7-with-ethernet-and-lwip-stack/ta-p/49308 Now, I would like to implement the task to send the requests. I have searched the forum but haven't found a clear conclusion. What catches my attention is that in the project I created with STM32CubeMX, there is the file http_client.h in Middleware -> Third_Party -> LwIP -> src -> include -> apps, but I can't find the http_client.c file with the functions.I have found in the following link (https://github.com/yarrick/lwip/blob/master/src/apps/http/http_client.c) I have copy the http folder in Middleware -> Third_Party -> LwIP -> src -> apps.And I have tried with the following code: void http_get_task(void const *pvParam
"We are facing a hard fault issue in our code when sending a large amount of data. Occasionally, it runs properly, but most of the time, it goes into a hard fault after sending approximately 10,000 bytes. The image data we are sending is around 40 KB. Interestingly, sending 'Hello World' in a loop works successfully without any faults. I have also tried increasing the lwIP options sizes through a trial-and-error approach, but the issue persists. I have been struggling with this problem for the past 20 days and have not been able to resolve it. I am using the STM32H723VGT6 microcontroller. Please help me resolve this issue."
Originally a reply in this thread - split as a separate question.Hello My blocking mode is working with "HAL_UART_Receive(&huart4, temp, 1, 100);"Nonblocking mode is not workingCan you suggest anything to check?I have defined as said /* USER CODE BEGIN 2 */ HAL_UART_Receive_IT(&huart4, temp, 1); /* USER CODE END 2 */ and /* USER CODE BEGIN 4 */ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { HAL_UART_Receive_IT(&huart4, temp, 1); HAL_UART_Transmit(&huart4, temp, 1, 100); } /* USER CODE END 4 */
Hi All,I've had the external SPI Flash driver working on the STM32H745_M7, using Zephyr SDK 4.0.0.But when I setup it up on the M4 side the driver initialization is failing with error:[1;31m<err> spi_ll_stm32: Could not select SPI domain clockFurther investigation shows that stm32_clock_control_configure(), is called from spi_stm32_init(), and fails to setup the clock path. In particular it is seeing that PLL_Q clock is not enabled. PLL 1 is setup on the M7 side and it doesn't look like I should be enabling it again in the M4's device tree again.How do I get the correct clock path setup for the SPI driver on the M4 side? I need to run the external SPI flash from the M4. Thanks,Simon
I don't know if libopencm3 code is allowed to post here but really isn't that different at all...I am getting wrong frequencies trying to measure a sine wave of 1.5v amplitude through adc of stm32f411, when 82hz I am getting 7.81, 110hz = 23.44... but when I simulate an 82hz sine wave with the code below, I am getting satisfactory results: for (int i = 0; i < BUFFER_SIZE; i++) { adc_buffer[i] = (uint16_t)(2048 + 2047 * sinf(2 * PI * 82.41 * i / SAMPLE_RATE)); } , I am really FFT noob and probably doing something very ***, anyway here is some important parts of my code: #include "arm_math.h" #include "arm_const_structs.h" #include <stdint.h> #include <stdlib.h> #include <math.h> #include <stdio.h> #define SAMPLE_RATE 8000 #define BUFFER_SIZE 1024 uint16_t adc_buffer[BUFFER_SIZE]; float fft_input[BUFFER_SIZE * 2]; // Interleaved real and imaginary parts float fft_output[BUFFER_SIZE]; void compute_fft(float *input, float *out
I have a project that uses the nBOOT pin for GPIO output and cannot pull it in any direction during POR. Therefore, the nSWBOOT0 bit needs to be programmed to 0 (its default is 1) before the code will function properly.What is the recommended practice for programming option bits in a production environment?I can't rely on, e.g., someone digging through menus in CubeProgrammer for each unit.I could have my code test for the proper bits at startup and program them if needed (the accepted answer to this similar question), but that does not strike me as an ideal solution because:It's wasteful (permanent code in the firmware that only operates once in the device's lifetime)With nBOOT floating at boot, device behavior is unpredictable before nSWBOOT0 is programmedIs there perhaps some sort of automation available in CubeProgrammer that would require minimal user interaction?
I have been using a NUCLEO-F413 board to try and understand how to program to user FLASH using the example code in the STMicro repository and STM32Cube to program. However when I now try and program the board I get the below error: Has me trying to write to the FLASH damaged the program space? If so is it possible to restore it or is the board now dead?
Hi,I am working on BlueNRG-2 and I need a funcion "hal_i2c_isdeviceready()" to confirm NFC eeprom IIC ready. In ST BlueNRG-2 demo, it used LL library of IIC.Could you give me some demo like "hal_i2c_isdeviceready()" in LL library.Thanks a lot.
we are working on a project where an STM32F4 microcontroller is used as a host to connect with an external device. we are considering using the USB interface for this purpose. Can we refer to the following example to implement USB host functionality on the STM32F4, and are there any specific considerations or configurations we should be aware of for proper communication and integration?https://controllerstech.com/usb-cdc-device-and-host-in-stm32/
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.