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
Hello,I am working on a project using the STM32H745 microcontroller with an MT25QL512A external QSPI flash. I am using IAR Embedded Workbench for development and require the following:.board file: Specific to STM32H745 with MT25QL512A.Flash loader file: A compatible flash configuration file for programming and debugging the external QSPI flash in IAR.I’ve seen .stldr files provided by STM32CubeProgrammer, but these cannot be directly used in IAR. If anyone has successfully configured this setup in IAR or has access to the required .board and flash files, I would greatly appreciate your help.Any examples or guidance on configuring QSPI for this combination in IAR would also be highly valuable.Thank you in advance for your support!
I'm trying to write three functions: to start an ADC conversion, wait for it to complete, and retrieve the results based on the low-level drivers from ST. The issue I'm facing is that I can read the first channel (LL_ADC_CHANNEL_0) with the correct value (I've verified this by debugging - the value is 4020 when the channel is connected to VDD, and 0 when connected to GND). However, when I connect the same channel to PA1, I get nothing (it's like the pin is floating), and when I connect it to PA2, I see the data in LL_ADC_CHANNEL_1 instead.Additionally, I see the EOS (End of Sequence) interrupt triggered after 1-3 conversions, so it's not performing all the conversions that it should. As a result, my code gets stuck checking the conversion complete flag, as it's never able to finish reading all 6 channels. I'm not sure why this is happening, any idea or help will be more than welcome. #include "stm32c0xx_ll_adc.h" #include "stm32c0xx_ll_gpio.h" #include "stm32c0xx_ll_bus.h" #
i recently made a custom board using stm32h743VIT6 and i configured lwip and freertos (before this i was using stm32f407vgt6 it is perfectly working and the circuit is same for this MCUs) now when i start the program it keeps having hardfault i tried it with MPU but still im having hardfault i changed the clock setting from external to internal but nothing changed only when i commented out MX_LWIP_Init() its working its better to mention im having only one task in freertos with 2048 stack size and also the lwip init is done completly after a little hard fault come up.my hardfault analyzer returns "Bus memory management or usage fault with bus fault details imprecise data access violation".im not having any httpd or anything on lwip i only want to get a simple ping.
Hi Sir, 2 pins are configured as I2C functionality and doesn't enable I2C interrupt. Openbootloader is referred to the example of STM32G474E-EVAL I want to communicate with the Open Bootloader using the I2C interface, so from the host side, I executed i2cset -y 6 33 33 to the MCU, with the goal of making it jump to the application. After executing this, it initially gets stuck at OPENBL_I2C_Go in OPENBL_I2C_SendAcknowledgeByte. This happens because during OPENBL_I2C_GetCommandOpcode, the OPENBL_I2C_WaitAddress clears the ADDR (via LL_I2C_ClearFlag_ADDR). Then, after sending i2cset -y 6 33 80 00 00, it continues to OPENBL_I2C_SendByte to send OPENBL_I2C_SendAcknowledgeByte, but gets stuck at LL_I2C_IsActiveFlag_TXIS, as TXIS is never set. Therefore, the process cannot be completed. Do you have any suggestions?
Chip: STM32H747I have setup a master timer. sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_ENABLE;And two slave timers each with sSlaveConfig.SlaveMode = TIM_SLAVEMODE_COMBINED_RESETTRIGGER; sConfigOC.OCMode = TIM_OCMODE_TOGGLE; sConfigOC.Pulse = 0; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; The slave timers correctly start when the master timer startsI first start the slave timer HAL_TIM_Base_Start(&htim_adc); HAL_TIM_OC_Start(&htim_adc, ADC_SAMPLING_TIMER_CHANNEL);..as expected no timer output until I start the master timerAt a certain moment I stop the master and slave timers HAL_TIM_OC_Stop(&master, ...); HAL_TIM_Base_Stop(&master); // reset HAL_TIM_GenerateEvent(&master, ...); __HAL_TIM_SET_COUNTER(&master, 0); // also stop/reset the slave timer HAL_TIM_OC_Stop(&a
Hey everyone! I'm trying to decrease the clock speed of TIM3 on my STM32L452RET6 (NUCLEO-L452RE) and i've run into issues. I think i figured it out already but I just don't understand why the problem is. My clock tree looks like this in CubeMX:With this configuration and the default generated code the SystemClock_Config function looks like this: void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = { 0 }; RCC_ClkInitTypeDef RCC_ClkInitStruct = { 0 }; /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) Error_Handler(); /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 64; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct
Can anyone explain to me what is wrong in my code?Microcontroller: STM32C031K6T6I'm trying to make an interface so that the user can change the name of their environment in real time, my idea and what I tried to write is something that holds the previous strings (which may already be edited) in RAM, makes the modifications and then then write in flash again. Currently my code is like this, it shows the environments ("AMBIENTE 01...24"), I can edit the name of the string, it "saves" when i call Grava();, but when I turn my board off and on the changes do not continue... I tried to copy the txtL strings to b_txtL using memcpy, and strncpy at the beginning of main();, but when i do this my my display goes "crazy" showing the strings "AMBIENTE ..." all broken in line 1 and 2Note: I can't debug and at the same time see the changes that happen on the display because the SWCLK pin was used for a display pin, I had to implement a code that erased the memory after holding d
I'm working with an STM32F407G and a SIM7600G GSM module. I've successfully configured the GSM module using AT commands, switched to PPPOS, and obtained a valid IP address, gateway, and netmask using LWIP.I can successfully resolve the IP address of test.mosquitto.org using netconn_gethostbyname(). However, when I try to connect to the MQTT broker at this IP (5.196.78.28), I keep getting "Connection disconnected" in the MQTT connection callback.The issue is that after attempting to connect, the callback shows "Connection disconnected" status every time. The IP resolution works, and I'm using LWIP with PPPOS for the GSM connection. Could this be related to protocol issues, or is something missing in my MQTT connection setup? Any guidance would be appreciated!Here’s the MQTT connection callback and code I’m using: static void mqtt_connection_cb(mqtt_client_t *client, void *arg, mqtt_connection_status_t status) { switch (status) { case MQTT_CONNECT_ACCEPTED: printf("Connecte
Hi, I’m having trouble reading measurements from the ADXL345 using SPI. I’ve attached a picture from the debugger that shows a view of the variables. The SPI is configured as master full duplex, and I’ve included a screenshot showing the SPI configuration. The SCK is connected to SCL, MISO to SDO, MOSI to SDA, and CS is connected to a configured output. I’m looking for help because I can’t figure out how to solve this issue.int main(void){void adxl_init(void);while (1){ adxl_read(0x32); // x = (data_rec[1]<<8|data_rec[0]);// y = (data_rec[3]<<8|data_rec[2]);// z = (data_rec[5]<<8|data_rec[4]); x = ((data_rec[1] << 8) | data_rec[0]);y = ((data_rec[3] << 8) | data_rec[2]);z = ((data_rec[5] << 8) | data_rec[4]); xg = x*.0078;yg = x*.0078;zg = x*.0078;}}void adxl_write (uint8_t address, uint8_t value){uint8_t data[2];data[0] = address|0x40; // multibyte writedata[1] = value;HAL_GPIO_WritePin (GPIOB, GPIO_PIN_6, GPIO_PIN_RE
Hi,I am implementing DFU over I2C to an STM32L476, trying to follow AN4221 and AN2606.For now I am focused on just getting some DFU command to work successfully over I2C, and I started with "Get Version" to get the bootloader version. I am able to get the ACK byte back (0x79), but not the rest of the data.I first tried to write the command (and the following for the checksum), and then try to receive the 3 bytes that are specified. ACK, $version, ACK. In pseudo code:beginTransmission(0x43); // slave address, 7bitwrite(0x01); // cmd = GetVersionwrite(0xFE); // complimentary of cmd, for XOR checksummingendTransmission(STOP);data = read(3, STOP);In this case I get an error indicating that less than 3 bytes was received. Is it not correct to expect the protocol to be able to work like this?Since the documentation flowcharts indicates for host to "wait for ACK" (although the device flowchart does not mention it). I also tried to first read 1 byte for the ACK, check it, and then wait for the
Dear MCD Application Team,in Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_uart.c you can find this check:/* Ensure that Frequency clock is in the range [3 * baudrate, 4096 * baudrate] */ if ((lpuart_ker_ck_pres < (3U * huart->Init.BaudRate)) || (lpuart_ker_ck_pres > (4096U * huart->Init.BaudRate))) { ret = HAL_ERROR; }assume huart->Init.BaudRate is 28333333 and lpuart_ker_ck_pres=170000000 the result is larger than uint32_t and results in a HAL_ERRORYou can check this with this small test application. Maybe you can fix this in the next release.#include <stdio.h> #include <stdint.h> int main() { uint32_t BaudRate = 28333334; uint32_t lpuart_ker_ck_pres = 170000000; printf("Start;\n"); if (lpuart_ker_ck_pres < (3U * BaudRate)) { printf("Error(1);\n"); } if (lpuart_ker_ck_pres > (4096U * BaudRate)) { printf("Error(2);\n"); } printf("End;\n"); }
Hi,My uC (STM32F30K6T6) is full in RAM memory.To optimize the RAM size, I have planned to reduce the Heap Size Memory (initial Heap size is 0x400).I do not use any manual memory allocation so, I think I will set it to a quarter of it (0x100), just in case.It leads me two interrogrations about heap and stack :how to check and know the exact start and end addresses of the heap and stack memory ? This, to check, in debug mode, the live usage (using IAR RAM memory live watch) of each.The .map file just give that piece of information:Following the described order, should I expect to have first rw, then CSTACK and at the end of RAM memory the heap ?At next question, we see that I have hint about the CSTACK start and end RAM addresses (0x2000 0C00 to 0x2000 1000) but what about the Heap adresses?From now on, I don't see any correlation between what I see in the CSTACK usage tool and the RAM MemoryLive watch (where I suppose to have the stack)I see only 20bytes (CSTACK usage tool) while I see
Gradually debug the DMA send function, HAL-UART Transmit DMA, and find that the function will judge a status bit of the serial port handle, gState. It will only send normally when huart ->gState==HAL UART State READY,And the reason why the first transmission can be successful is because initially, gState was set to HAL-UARTVNet READY, so it can be successfully sent. However, during the first transmission, the HAL-UART_Transmit_SMA function will change gState to HAL-UARTVNet BUSY1 TX state, and the gState bit will remain in the HAL-UARTVNet BUSY1 state, causing subsequent transmissions to be unable to be executed. To clear gState state, it must enter the UART of the serial port interrupt HAL-UART_iRQHandler, where the gState flag bit is cleared.My problem is that the serial port interrupt can only be accessed for the first time and cannot be accessed afterwards, so the sending fails. During debugging, occasional normal sending and receiving can be achieved. Can you please provide som
It seems that STM32H563MI has four I2C ( I2C1 ~ I2C4):However, the corresponding STM32H563.svd only includes 2 I2C ( I2C1 ~ I2C2).https://stm32-rs.github.io/stm32-rs/STM32H563.html
SEE EDITI am using the STM32H7B3I-DK. I am trying to write my own simple SPI ISR to handle transmitting and receiving of just one byte I have gotten the slave working with my ISR (while master used HAL). I am now implementing on the master and having issues with the transmit. When I am in debug mode and transmit one byte then hit a breakpoint it works fine. However, when I just run normal after I start transmitting, my board says it starts receiving button presses. It is acting as if someone is randomly pressing all the buttons connected on the PC2 (input- pull down - active High) line. The weird thing is I don't have this issue if I use the HAL Transmit, only when I use my transmit. This occurs even if the slave is not on and the master is just sending bytes to a non powered device.My SPI Setup uses SPI2 which PC2 could have the AF SPI2 MISO but I do not have it configured that way. Could the spi be interfering with the GPIO input internally? Any other suggestions to try? SP
I am using STM32H7B3I-DK running a touchgfx application and acting as SPI Master, and Nucleo-H743ZI as SPI Slave. Both are configured in interrupt mode not using HWNSS. The Master is sending 0,1,2,3,4,5,6,7, but the slave is only receiving 0,2,4,6,0,2,4,6.I am sending one byte at a time and receiving one byte then adding it to a buffer. The master is properly sending data, as checked by oscilloscope. I have tried introducing a HAL-Delay(1) between transmissions and the data is then received perfectly fine; however, that is way to slow for proper communication. I have double checked the compatible settings for Master-Slave communication in the .ioc files such as Data Size, First Bit, etc...Here is my following relevant code for the master: for(;;) { HAL_GPIO_WritePin(GPIOI, GPIO_PIN_0, GPIO_PIN_RESET); // Pull CS low for (int i = 0; i < 8; i++) { data[i] =i; HAL_SPI_Transmit(&hspi2, &data[i], 1, HAL_MAX_DELAY); // Transmit one byte HAL_UART_T
Hi, I have a custom PCB where I am attempting to bootload an STM32G071CBU6 (using an STM32U575). I am using the bootloader while developing for uploading development builds, so it is being used often. The G0 seems to occasionally, randomly, stop responding and clock stretch indefinitely while the firmware is being written to the MCU. Sometimes this is remedied by resetting the chip and starting the bootloading process over again, sometimes I have to power cycle the whole board, and there have been a couple of instances now where even power cycling would not fix it, and I would have to erase the chip using an STLink. The problem almost always presents as the host MCU reading back a non-valid ACK byte (according to AN4221) - I've seen 0x4D most recently which does not match 0x79 for ACK, 0x1F for NACK, or 0x76 for BUSY. It is usually the first response when polling for an ACK after writing a block of byte to memory. If the host MCU tries to read again, the G0 will clock stretch indefinit
Using a Nucleo-F411RE board modified to have 8MHz HSE crystal oscillator and running the OTG peripheral in forced host mode, we are working on implementing our own host stack. With the current code no IRQs trigger until a device is physically attached to the port. However, when we plug up a device then the DISCINT bit in GINTSTS is set along with PCSTS and PCDET in FS_HPRT. Since the host port IRQ is unmasked in FS_GINTMSK the code correctly branches to the global USB ISR, but we are curious as to why the DISCINT (device disconnect) but would also be tripped. We have verified that this bit is not prematurely firing before we physically plug in the USB device. The register setup after our USB hardware configuration is as follows:OTG_FS_HOST FS_HCFG 0x00000200 0x50000400 FSLSPCS 0x0 [1:0] FSLSS 0 [2:2] HFIR 0x0000ea60 0x50000404 FRIVL 0xea60 [15:0] FS_HFNUM 0xea603fff 0x50000408 FRNUM 0x3fff [15:0] FTREM 0xea60 [31:16] FS_HPTXSTS 0x00080200
The Ethernet reset is not clearing (ETH_DMABMR_SR in DMABMR).I am having a similar issue as others but have not seen a solution in the forum.I am working with the stm3210c-eval board. I know it is no longer available; but it has a version of the processor that I wish to use and Ethernet support.I verified that the Ethernet clocks are enabled in AHBENR:RCC_AHBENR_ETHMACEN, RCC_AHBENR_ETHMACTXEN & RCC_AHBENR_ETHMACTXEN.I verified that the port IO clocks are enabled.The pins ETH_MDC, ETH_TXD2, ETH_TX_CLK, ETH_CRS, ETH_RX_CLK, ETH_MDIO, ETH_COL, ETH_TX_EN, ETH_TXD0, ETH_TXD1, ETH_TXD3, ETH_RX_DV, ETH_RXD0, ETH_RXD1, ETH_RXD2 & ETH_RXD3 pin's modes are set to GPIO_MODE_AF_PP.And pin ETH_RX_ER is set to input, no pull.I verified that there is a 25 mHz clock signal at PA1 & PC3.It is configured for MII mode (MAPR AFIO_MAPR_MII_RMII_SEL = 0).Note that the Ethernet link & activity LEDs are working.Is there anything else I can check?
Hi, Looks like the HAL driver for the STM32f7xx ADC is missing a case for using the software start of the ADC2 peripheral in the HAL_ADC_Start_IT function. Starting from line 1128: else { /* if instance of handle correspond to ADC1 and no external trigger present enable software conversion of regular channels */ if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)) { /* Enable the selected ADC software conversion for regular group */ hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART; } /* if dual mode is selected, ADC3 works independently. */ /* check if the mode selected is not triple */ if( HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI_4) ) { /* if instance of handle correspond to ADC3 and no external trigger present enable software conversion of regular channels */ if((hadc->Instance == ADC3) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)) { /* Enable the selected ADC software conver
Hi, I am having a strange ADC problem on my STM32L431 device. I am sampling 6 channels without DMA using polling method with the following code: while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ ADC_Select_CH0(); HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY); adc_values[0] = HAL_ADC_GetValue(&hadc1); HAL_ADC_Stop(&hadc1); HAL_Delay(100); ADC_Select_CH1(); HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY); adc_values[1] = HAL_ADC_GetValue(&hadc1); HAL_ADC_Stop(&hadc1); HAL_Delay(100); ADC_Select_CH2(); HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY); adc_values[2] = HAL_ADC_GetValue(&hadc1); HAL_ADC_Stop(&hadc1); HAL_Delay(100); ADC_Select_CH3(); HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY); adc_values[3] = HAL_ADC_GetValue(&hadc1); HAL_ADC_St
Hello,I have been trying to read/write into an SD card using the SPI or SDMMC method with Fatfs. I wasn't able to make use of the filex option for file operation which is provided in the STM32u5A9 libraries, since I am using FreeRTOS in my project (as per notes, Filex cannot be used with FreeRTOS). So, I have taken the FatFs library from STM32F4 design and ported the same to STM32U5A9 design (took reference from https://deepbluembedded.com/stm32-sd-card-spi-fatfs-tutorial-examples/). Unfortunately, in both SPI and SDMMC methods, I was not able to initialize my SD card and the application keep on waiting for SPI Rx data in SPI mode, and in SDMMC method, the application keeps on waiting in a HAL_Delay() in HAL_SD_initcard() APIIs there any known issues in this board type? Can you point any working examples for STM32U5A9 with FatFs and FreeRTOS? Your support is much appreciated!Thanks & Regards
Hello, I am using an STM32G0B0 and am debugging the process of the bootloader handing over control to the application.The bootloader goes through its handover process without an issue.The final part of the bootloader handover looks like this.{ pFunction appEntry; uint32_t appStack; Cpu_WDT_Kick(); // kick the watchdog HAL_DeInit(); //test to see if this disablles all the peripherals, so we don't have to do it individually like below with the USB and the timers //disable all interupts while we are jumping to the app. //this is because our interrupt vector table is changed during this jump //and we dont want to jump to the wrong memory region __disable_irq(); // Get the application stack pointer (First entry in the application vector table) appStack = (uint32_t) * ((__IO uint32_t *)CONFIG__APPLICATION_BASE_ADDRESS); // Get the application entry point (Second entry in the application vector table) appEntry = (pFunction) * (__IO uint32_t *)(CONFIG__APPLICATIO
Hey everyone!I'm trying to detect the rotations of my rotary encoder. I used external interrupts to detect when the state of the pin changes. My problem is that it seems like when the encoder bounces the interrupt gets triggered, but the state doesn't change. How can that be? The only thing I can think of is that when I read the pin with HAL_GPIO_ReadPin inside the interrupt it has already changed. Can that happen? I would assume that the contents of the IDR are locked while the interrupt is running, but I could find any information about this.Here is the minimal code from my project. uint8_t get_rotary_state() { GPIO_PinState A_state = HAL_GPIO_ReadPin(ENCODER_A_GPIO_Port, ENCODER_A_Pin); GPIO_PinState B_state = HAL_GPIO_ReadPin(ENCODER_B_GPIO_Port, ENCODER_B_Pin); return (B_state << 1) + A_state; } uint8_t rotary_prev_state = 0; void HAL_GPIO_EXTI_Callback(uint16_t GPIO_pin) { if (GPIO_pin == ENCODER_A_Pin || GPIO_pin == ENCODER_B_Pin) { uint8_t rotary_current_stat
Hi!I am having big troubles getting USB-PD sink on the STM32G431KBT to work. I am using CubeMX and following the AN5418 Complete USB-PD application example and using FREERTOS 10.3.1 and USBPD 3.3.0.Connected to my wall adapter the debug traces looks as follow:The source always resetting its power after the source capabilities are recieved. And the board restarts.Any ideas how to fix this?
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.