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
STM32F103 as Interrupt driven I2C slave . in the address callback Master READif (dir == I2C_DIRECTION_RECEIVE) // 0 { data[0] = 0x55; data[1] = 0xAA; HAL_I2C_Slave_Seq_Transmit_IT(hi2c, &data[0], 2, I2C_LAST_FRAME);}On the wire (see picture) the first byte returned to the master is always a duplicate of the address | direction bit. Tested this with several different addresses. Changing the option flag LAST_FRAME) does not matter. Also the error callback is called and the error is 0x0C (AF | OVR) For example: Address 0x30 write , setup = 0x61. 1st data byte = 0x61 (0x30 << 1 | 1), second is 0x55. For address 0x20, setup = 0x31 , first data byte = 0x31, second is 0x55. 0xAA never goes over the wire When receiving data from a master, (MASTER WRITE) HAL_I2C_Slave_Seq_Receive_IT(hi2c, data, 2, I2C_LAST_FRAME); does receive the two correct data bytes.
I'm working on a project where I use the STM32U5A9 microcontroller to control the W25Q128JV flash memory. I wrote a library to interact with this flash memory, but unfortunately I can't get it set up correctly.The problem is that commands are sent incorrectly when this piece of code in the enableQuadMode function is executed: CS_ENABLE(); OSPI_RegularCmdTypeDef sCommand = {0}; uint8_t reg; HAL_StatusTypeDef res; sCommand.OperationType = READ_STATUS_REG_CMD; sCommand.FlashId = HAL_OSPI_FLASH_ID_1; sCommand.DQSMode = HAL_OSPI_DQS_DISABLE; sCommand.SIOOMode = HAL_OSPI_SIOO_INST_EVERY_CMD; sCommand.InstructionMode = HAL_OSPI_INSTRUCTION_1_LINE; sCommand.InstructionSize = HAL_OSPI_INSTRUCTION_8_BITS; sCommand.InstructionDtrMode = HAL_OSPI_INSTRUCTION_DTR_DISABLE; sCommand.Instruction = READ_STATUS_REG2_CMD; sCommand.AddressMode = HAL_OSPI_ADDRESS_NONE; sCommand.AlternateBytesMode = HAL_OSPI_ALTERNATE_BYTES_NONE; sCommand.DataMode = HAL_OSPI_DATA_NONE; sCommand.DataD
IMHO in the file "stm32f3xx_hal_def.h" the section "Exported types" should be moved in front off section "Includes", because some of the types are used in the included files, but "stm32f3xx_hal_def.h" will not be reentered. It produces error like this: In file included from .\Core\Inc/stm32f3xx_hal_conf.h:203,from .\Drivers\STM32F3xx_HAL_Driver\Inc/stm32f3xx_hal.h:29,from .\Drivers\CMSIS\Device\ST\STM32F3xx\Include/stm32f3xx.h:266,from .\Drivers\STM32F3xx_HAL_Driver\Inc/stm32f3xx_hal_def.h:29,from .\Drivers\STM32F3xx_HAL_Driver\Inc/stm32f3xx_hal_rcc.h:27,from Src\setup.cpp:9:.\Drivers\STM32F3xx_HAL_Driver\Inc/stm32f3xx_hal_gpio.h:297:1: error: 'HAL_StatusTypeDef' does not name a type; did you mean 'NOR_StatusTypedef'?
This is a long one, so sit tight around the campfire, and let me tell you the tale of The Futility of EPENA.Several days ago, I began to implement a Mass Storage interface for my own USB stack, equipped with a Bulk IN and OUT endpoint. The first thing I did was wait for the OTEPDIS interrupt ("OUT token received when endpoint disabled"); this lets me know that the host wants to send me a love letter, that is, a Command Block Wrapper. This OTEPDIS interrupt is a little strange, however, as RM0351 (Rev. 10) states that this interrupt only applies to Control OUT endpoints, but nonetheless seems to have effect for non-Control EPs (at least for the STM32L476RG).Anyways, on this interrupt, I then configure the Bulk OUT endpoint to receive a single 8-byte packet in order to get the first 8-bytes of the 31-byte CBW. Of course, I could just have a 64-byte EP so it could be received in-all-one-go, but I wanted to ensure the flexibility of my own USB stack in being able to handle multi-packet tra
Hello, I wanted to share an issue I found with enabling the oversampler for ADC using HAL. I was having issues result not being bit shifted. Further investigation I found that the HAL driver version 1.11 did not write the OVSS bits correctly. Here is the original code found in the stm32h7xx_hal_adc.c lines 760-765MODIFY_REG(hadc->Instance->CFGR2, ADC_CFGR2_FIELDS, ADC_CFGR2_ROVSE | ((hadc->Init.Oversampling.Ratio - 1UL) << ADC_CFGR2_OVSR_Pos) | hadc->Init.Oversampling.RightBitShift | hadc->Init.Oversampling.TriggeredMode | hadc->Init.Oversampling.OversamplingStopReset); I modified the code to thisMODIFY_REG(hadc->Instance->CFGR2, ADC_CFGR2_FIELDS, ADC_CFGR2_ROVSE | ((hadc->Init.Oversampling.Ratio - 1UL) << ADC_CFGR2_OVSR_Pos) | hadc->Init.Oversampling.RightBitShift << ADC_CFGR2_OVSS_Pos | hadc->Init.Oversampling.TriggeredMode << ADC_CFGR2_TROVS_Pos | hadc->Init.Oversampling.OversamplingStopReset) With this modificat
stm32h7xx_hal_uart.c is missing a prompt to enable usart interrupt in the DMA configuration instructions.Other comments have this sentence:(+++) Configure the USARTx interrupt priority and enable the NVIC USART IRQ handle(used for last byte sending completion detection in DMA non circular mode)
I am trying to send a message through UART based on Timer 6 interrupt on STM32L432KC microprocessor. The prescaler is set to 39999 and the auto reload is set to 19999 to get an interrupt every 10 seconds. When i upload the code, I get the first interrupt 10 seconds in but it never triggers again. I changed timers to see if Timer 6 was clashing with something that I am already using.I have found that when the Timer 6 counter hits ARR for the first time and interrupt triggers, The TIM6->SR stays 0 but when counter hits ARR for the second time, TIM6->SR turns 1 and interrupt does not trigger which the reference manual says its the flag UIF (Update Interrupt Pending). I was thinking maybe its a hardware issue so tried changing the timers but same story. In the same code I am also doing ADC DMA conversions using Timer 1 interrupt which is set to trigger at 100Hz. That works without issues. The callback function is the same for all Timer interrupts so I am not sure if that has an effec
I have a STM32H573I-DK discovery board, purchased for the purpose of getting to grips with Azure IoT.It appears however that the example does not run properly.Compiles and links OK, and I am using the Wireless plug in board as supplied, but it gets stuck initialising the network,I think there is an issue with the .ld and associated .s file. The Readme says to make modifications but is not very explicit on what the modifications should be. I have given it a go by adding a RAM_D1 section, but its having no effect.MY suspicion is that it stops as it attempts to run the Azure RTOS, because it has not been allocated somewhere in memory to run, but why doesn't the example run as supplied? Also any attempt to modify the .ioc file followed by a save results in lots of compilation errors, so again, there is a problem there - may not be directly related, but I was trying to modify the RAM sections using .iocDoes anyone have a function project?
I have STM32F407G-DISC board.Hello Everyone,Problem: I am working with a instrument where we frequently get the problem of frequency drop out, i.e. suddenly frequency signal goes missing i.e. goes to zero, this cause the loss in data as shown in the below image. Yellow is received frequency signal from Photodetector and Purple is the demodulated data (our desire output). When frequency goes zero the purple line is constant so data is lost.Solution: In order to solve this problem, I have solution in my mind, i.e. I should develop an algorithm which could work as follow,In this case I will have two Analog Inputs F_A, F_B and one analog output A_out.// F_A is our sensor data // Based on F_A, F_B is our final result obtained by demodulation of F_A.I want to developed following logic When data is not missing (i.e. F_A is not zero then output (A_out) of microprocessor should be zero, while F_B should store in the buffer zone.If F_A =0 is detected then the output (A_
Hi,I am using the STM32F407VG and PmodI2S2 to transfer 24-bit audio. For the most part I have followed this tutorial. So far everything works and I have audio throughput and the ability to manipulate it.In order to understand better the underlying code, I want to understand the following:1. In I2S2 > Parameter Settings > Data and Frame Format I have setup 24 bits Data on 32 Bits Frame and in DMA Settings > I2S2_EXT_RX and SPI2_TX I have Data Width set to Half Word. Currently I am receiving 16-bit data which I then restructure into a 32-bit int variable. Would it be possible to receive 32-bit data directly by selecting a data width of Word? I'm a bit confused about this as the method to setup the DMA (HAL_I2SEx_TransmitReceive_DMA) only accepts pointers to a uint16_t even after selecting a data width of word.2. If I2S2 > DMA Settings has two DMA requests (I2S2_EXT_RX and SPI2_TX), does this mean that the callbacks 'HAL_I2SEx_TxRxHalfCpltCallback' and 'HAL_I2SEx_TxRxCpltCallb
Hi, I started a github issue for this problem: https://github.com/STMicroelectronics/stm32h7xx_hal_driver/issues/63 Realistically, the entire HAL_ETH_ReadData() function just needs to be rewritten. There are multiple flaws in it: Take for example here: https://github.com/STMicroelectronics/stm32h7xx_hal_driver/blob/21b29aa338c68333bb5e489b03a04553f8fc2c12/Src/stm32h7xx_hal_eth.c#L1074What's going on there is the driver examines to check if a descriptor is the context format, and then processes the timestamp data, but then it immediately moves on and treats the descriptor as if it was a normal descriptor. It's really obvious that the PTP support was not tested (or else ST would have immediately noticed this issue) Also note that the function does not consider the timestamp dropped or timestamp available bits. This also needs to be fixed.ST, can you please rework this function to correctly handle retrieving the timestamp data from a context descrip
Hello,I would like to use the X-CUBE-CRYPTOLIB to calculate a SHA256 with a key. My implementation or the example HMAC_SHA2_AuthenticateVerify works in STM32CubeIDE 1.13.1 for an STM32L432KCU microcontroller.Source: https://www.st.com/en/embedded-software/x-cube-cryptolib.htmlTo rule out the possibility that the example project has implemented something that I forgot to copy into Atollic Studio, I created a new project in STM32CubeIDE and integrated the X-CUBE-CRYPTOLIB there as I did in Atollic Studio. The hash was calculated correctly there.Now my problem:The development environment Atollic TrueSTUDIO for STM32 9.3.0 is used for an existing project. I would like to use the X-CUBE-CRYPTOLIB there. If I put the "simple" example there, then the hash is calculated incorrectly.The error occurs on the line if (memcmp(Expected_Tag, Computed_Tag, computed_size) != 0) because the Computed_Tag was not calculated correctly. What could be the reason? /* Initialize cr
During audio codec processing, I encountered errors such as "UnboundLocalError: local variable 'res' referenced before assignment" and "struct.error: unpack requires a buffer of 13 bytes". These errors were reported by the Opus profiling tool, and the actual behavior is that the codec stops running shortly after starting. Additionally, there's another issue where, when outputting the audio file, I can see the encoded/decoded data using CubeIDE for debugging, but the audio file outputted from the PC is an empty file. I would greatly appreciate any solutions or replies to address these issues. Thank you.
I want to send audio samples (received via SAI1 from PDM MIC) to SAI2_SD_B as SPDIF out. It does not work, because: the DMA does not seem to write the DR in SAI2: the memory is filled with audio samples the DMA seems to run (I get the HAL_SAI_TxCpltCallback and I can see via debugger that the DMA pointers are moving) but the SPDIF sends all zero: on scope, the SPDIF output is all as zero words Remark: it is on a STM32U5A5RJT6Q (LQFP64 package): the datasheet "says": not a SAI2 there (just one SAI) - but not true - it works also with SAI2, even CubeMX does not let me configure SAI2 pins (also wrong in CubeMX tool). But I can configure SAI2 and see it working (in Polling and INT mode, just the DMA fails). So, my impression: the circular buffer and DMA does not work. No idea why not: the code is generated by CubeMX. This topic is related to this thread: Solved: STM32U5xx: SPDIF out - how to configure? - STMicroelectronics Community Here is the DMA config I use: Why does it send all
Hi,Can someone clarify why some examples of boot to QSPI change the SCB->VTOR register in JumpApp function :SCB->VTOR = (uint32_t)Application_vector;JumpToApp = (pFunction) (*(__IO uint32_t *)(Application_vector + 4u));__set_MSP(*(__IO uint32_t*) Application_vector);And some examples change the SCB->VTOR register in void SystemInit(void) function:SCB->VTOR = 0x90000000; I think both works but is there a best way and can someone explain the advantage and the inconvenient to update VTOR register in BOOT project or APP project.
st released a spirit mp3 encoder in STM32CubeExpansion_Audio_V1.1.1. But I failed to call functions inside lib file lib_mp3encoder_cortex_m4_v2.2.0.a.Are there m7 version lib for my stm32h743 mcu?
Sure, here is the translation of your query in a polite tone:I am using an STM32L072CB to validate an HID device and I want to switch between Input Reports based on the PC settings, using different Endpoints. However, after sending the Input Report to the newly added Endpoint, I encounter a CUSTOM_HID_BUSY issue which is not resolved, and the callback is not invoked. This suggests that the PC cannot properly handle the transmission through the newly added Endpoint. I suspect there might be mistakes or missing parts in the initial device configuration. Below is my main code: USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev){/* Init USB Ip. *//* Link the driver to the stack. */hpcd_USB_FS.pData = pdev;pdev->pData = &hpcd_USB_FS;hpcd_USB_FS.Instance = USB;hpcd_USB_FS.Init.dev_endpoints = 8;hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED;hpcd_USB_FS.Init.low_power_enable = DISABLE;hpcd_USB_FS.Init.lpm_enable = DISA
Hi, i go to start SDMMC1 in STM32H753z, is any sample code? can please provide. in SDMMC i need to use FATFS APIs or SDMMC APIs ? i am confusing please help me. when i debug the below code i am can n't access it stop at f_mount() starting only. please provide how to use SDMMC.Thank You
Hi,I have a custom master PCB connected to a few slave custom PCBs via serial. In some systems they are connected via I2C and in other systems they are connected via RS232.They all run STM32 micros.I am looking for two out-of-the-box protocols with source code available, one for the I2C and one for the RS232. They need to be very simple because only very little and simple data is exchanged (enable motor, change state machine state, turn LED on/off, etc) and none of it is time critical either.Which protocol would you suggest and where can I find the source code?Is there any such or similar solution provided by ST?Thank you :)
Hi,I am developing on stm32l011 board and I am facing issue about UART interrupt. static uint8_t rxBuffer[32] = { 0 }; void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { /* Check if it is start command. */ if(NULL != strstr((char*) rxBuffer, KEYPAD_START_COMMAND)) { /* Increase received data count. */ g_ReceivedDataCount++; /* Turn flag on. */ g_devicePlugged = true; } /* Check if it is stop command. */ else if(NULL != strstr((char*) rxBuffer, KEYPAD_STOP_COMMAND)) { /* Turn flag off. */ g_devicePlugged = false; } if(0 != rxBuffer[sizeof(rxBuffer) - 1]) { memset(rxBuffer, 0, sizeof(rxBuffer)); } /* Start UART RX again. */ if (HAL_UART_Receive_IT(&hlpuart1, rxBuffer, sizeof(rxBuffer)) != HAL_OK) { /* Handle error if the UART receive does not start properly */ Error_Handler(); } } When I send data less than 32 byte, interrupt works sccesfully but after I send greater than 32 byte data, interrupt firing and never work again. I trie
Hello everyone,I am currently working on a project with the STM32U5A9 microcontroller and am trying to interface the W25Q64JV flash memory using the OctoSPI bus in QuadSPI mode. Despite extensive searches, I have been unable to find relevant examples or documentation that specifically address this configuration.Could anyone in the community kindly share any sample code or resources that could assist with this setup? Any guidance or pointers to documentation would be greatly appreciated as it would greatly help in advancing my project.Thank you in advance for your time and assistance!Best regards,Nazar
Hello Community,I'm working on a project and could use your help. I'm trying to make a sine wave with a changing frequency from 600 Hz to 5 kHz using STM32 microcontroller(STM32L073RZT) with 32 MHz as sysclk. This are my configurations. Where this r2r pins are DAC bits. I am not able to generate sine wave more than 280 Hz but i want to generate till 2 KHz. Please suggest if I'm doing something wrong or if anyone has a good idea on how to overcome this issue. Code: /* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this sof
In the next code I sample audio from the mic, play it to the headphones, then i process the data to get Mel-Spectrogram feature and then I feed the Mel feature into an AI model to recognize speech.when I enable the functions that calc the mel and the AI model I get a distorted sound.the time taking to calc the mel and the AI model is 451 ms. int main(void){uint32_t i;*/HAL_Init();/* Configure the system clock to have a frequency of 120 MHz */SystemClock_Config();MX_CRC_Init();/* Configure LED1 */BSP_LED_Init(LED1);Preprocessing_Init();AI_Init();/* Initialize DFSDM channels and filter for record */DFSDM_Init();/* Initialize playback */Playback_Init(); /* Start DFSDM conversions */if(HAL_OK != HAL_DFSDM_FilterRegularStart_DMA(&DfsdmRightFilterHandle, RightRecBuff, 8000)){Error_Handler();}if(HAL_OK != HAL_DFSDM_FilterRegularStart_DMA(&DfsdmLeftFilterHandle, LeftRecBuff, 8000)){Error_Handler();}/* Start loopback */while(1){if((DmaLeftRecHalfBuffCplt == 1) && (DmaR
I want to develop an inverter with STM32H723, but I have not used ST's MCU for power supply before, so I would like to ask if there are suitable examples for reference, or what suggestions are there in the software framework. Thank you!
The ADC seem to work when i run this code.Internal ADC like vref vbat and internal temperature seem to be working and I testes it with cold spay and checked the internal temperature.the ADC input pins seem to be stuck ate a level and not change or giving the write valueADC::ADC(){ if (ADC_BUF_LEN != hadc1.Init.NbrOfConversion) {Error_Handler();} HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);this->rcvd = true; if (HAL_ADC_Start_DMA(&hadc1, (uint32_t *) adc1_buf, ADC_BUF_LEN ) != HAL_OK) {/* Start Error */Error_Handler();} } ADC::~ADC(){ } ADC *ADC::getInstance(){static ADC adc = ADC();return &adc; } void ADC::rcvdData(){this->rcvd = true;}bool ADC::getNumValue(uint32_t *value, adc_input_t idx){ switch (idx) {case ADC1_IN1_MCU_ADC_VMON_3V3 :case ADC1_IN2_MCU_ADC_VMON_5V0 :case ADC1_IN3_MCU_UVOV_IMON :case ADC1_IN5_DAC_PTR_POWER :case ADC1_IN6_ESC_POI
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.