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've been working on with LIS3MDL a magnetometer from STM, but there was one problem because reading X,Y,Z it was showing good values but sometimes instead of value it just spitted 0, for example X = 0.14, Y = 0.30, Z = 0.14 and sometimes it just randomly zeroed random axis like X = 0.14, Y = 0.0, Z = 0.14The culprit was here : uint8_t data[6]; HAL_I2C_Mem_Read(&hi2c1, LIS3MDLTR_Address, LIS3MDLTR_X_Y_Z_Axis, 1, data, 6, HAL_MAX_DELAY); The problem firstly I used int8_t data[6] instead of uint8_t data[6], I don't know why HAL had problem with it ?? Binnary it should be the same data but somehow it didn't work. Someone know maybe why ? *x = ((int16_t)data[1] << 8 | (int16_t)data[0]); *y = ((int16_t)data[3] << 8 | (int16_t)data[2]); *z = ((int16_t)data[5] << 8 | (int16_t)data[4]); Here I still changed it into int16_t so the binary data is not interpreted differently decimally, but in HAL_I2C it should make any differ
In the code I have written here, I am trying to send data from UART4 within the main function and simultaneously receive data through interrupts if data arrives. However, the data transmission part works for a very short time and then stops, and the data received from the interrupt is corrupted. I am providing the code from the main.c and stm32f4xx_it.c files below. Can you help me?main.c: #include "main.h" #include "kibar_nextion.h" #include <string.h> uint8_t main_buffer[5]; uint8_t main_buffer1[8]; int main(void) { __HAL_UART_ENABLE_IT(&huart4, UART_IT_RXNE); uint8_t last_data[] = {255, 255, 255}; while (1) { for(int i = 0; i < 360; i++) { HAL_UART_Transmit(&huart4, (uint8_t*)"main_screen.z0.val=", 19, 100); HAL_UART_Transmit(&huart4, (uint8_t*)kibar_return_array_char_from_32_t(i), kibar_size_integer_data_32_t(i), 100); HAL_UART_Transmit(&huart4, last_data, 3, 100); } } } stm32f4xx_it.c: #include "main.h" #include "stm32f4xx_it.h"
We are using two STM32 platforms, one is running STM32H735RGV6 and the other is running STM32F103C8T6, they are connected by a single wire and connecting as UART Half Duplex.Note that we did make it work in a UART in full duplex mode for STM32F103C8T6 previously without any problem using another platform. The STM32H735RGV6 is transmitting messages as expected, we do not know it by seeing bytes using a logic analyzer, and we do not know if it can receive yet, and it is configured as this: ======= huart7.Instance = UART7; huart7.Init.BaudRate = 19200; huart7.Init.WordLength = UART_WORDLENGTH_8B; huart7.Init.StopBits = UART_STOPBITS_1; huart7.Init.Parity = UART_PARITY_NONE; huart7.Init.Mode = UART_MODE_TX_RX; huart7.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart7.Init.OverSampling = UART_OVERSAMPLING_16; huart7.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; huart7.Init.ClockPrescaler = UART_PRESCALER_DIV1; huart7.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO
Hi,I have a background in electrical engineering but am a complete beginner with embedded engineering. I've bought two nucleo f767zi boards with the goal to send information between them using Ethernet with the built in rj45 port. My goal right now is to utilize the built in user button to light a LED on the other board. Once i get a working initial code ill be able to build on it from there. However, im struggling a lot to even get the initial code working. I'm using the stm32cube and after a lot of reading i've decided to go for FREErtos(cmsis V2) and lwip using the netconn API (although raw would work as well). The two boards will utilize the same code but i will manually comment out one of these two lines (743 or 744) in the code before flashing the boards.//tcpecho_init();ping_init(); My problem right now is that the code leaves the ping_thread after this line and do not seem to come back no matter if i press the button. (line 601)semaphore_status = xSemaphore
Hi there.As usual, I'm there with a new issue... :grinning_face_with_sweat:Developing a custom Bootloader, I'm trying to disable both Instruction and Data chaches.As I read on the ST AN4839, before deactivating the DCache, I would also Clean it.No problem with the Icache, but I'm experiencing Hard Fault adding Dcache cleaning and/or disabling.void DoJump2App(u32t uiAPPaddress) { /*.-.-.| Local Varibles |.-.-.*/ /*.-.-.| Execution |.-.-.*/ SCB_DisableICache(); SCB_CleanDCache(); SCB_DisableDCache(); uiResetKey = RESET_DRV_BTL_KEY; // Clear RESET key pJump2App = (pFunction)(*(volatile u32t*)(uiAPPaddress + 4)); __set_MSP(*(volatile u32t*)uiAPPaddress); // Initialize user application's Stack Pointer __ISB(); // Instruction Synchronization Barrier pJump2App(); }Above the example of the routine I'm testing.To be noticed that:This routine is called just once in the main program after peripheral initialization (inside a more complex wrapping function)Cac
Today I started to implement DMA for the SDMMC peripheral, and it worked for the most part, but when I got around to doing some sector writes, I started to get CRC-16 mismatches. This was a relatively simple fix, as I was enabling the Data Path State Machine before the Command Path State Machine, rather doing after I receive the response for the command. For sector reads, this is what you're supposed to do, but for writes (or any other transfer where data goes from device to card), one needs to handle this the other way around. By making this post, I hope it fixes someone's potential bug.But it made me wonder: why was there a CRC-16 mismatch anyways? It's a good question. One that didn't need to be answered -- and I did almost just moved on -- but it is a good question. What's happening under the hood to cause this issue?So I busted out my oscilloscope and picked apart what was happening. The following screenshot is it working properly (no CRC-16 mismatch) with 1-bit wide bus at 500KHz
In the ethernetif.c file,typedef enum{RX_ALLOC_OK = 0x00,RX_ALLOC_ERROR = 0x01} RxAllocStatusTypeDef; // Here, RxAllocStatusTypeDef type is not used.It says that RxAllocStatusTypeDef is not used, which violates misra-c:2012 2.3.Inferentially, this would require changing the type in the following code:[before]static uint8_t RxAllocStatus;[after]static RxAllocStatusTypeDef RxAllocStatus;It looks like the code should be changed, what do you think?
Hello,I'm having some issue going from my user code running azure RTOS to the bootloader. I'm using a STM32U599The code I'm using is the following, you can find online: void JumpToBootloader(void){uint32_t i=0;void (*SysMemBootJump)(void);/* Disable all interrupts */__disable_irq(); /* Disable Systick timer */SysTick->CTRL = 0; /* Set the clock to the default state */HAL_RCC_DeInit(); /* Clear Interrupt Enable Register & Interrupt Pending Register */for (i=0;i<5;i++){NVIC->ICER[i]=0xFFFFFFFF;NVIC->ICPR[i]=0xFFFFFFFF;} /* Re-enable all interrupts */__enable_irq(); __DSB(); __DSB(); __ISB();/* Set up the jump to boot loader address + 4 */SysMemBootJump = (void (*)(void)) (*((uint32_t *) ((0x0BF90000 + 4)))); /* Set the main stack pointer to the boot loader stack */__set_MSP(*(uint32_t *)0x0BF90000); /* Call the function to jump to boot loader location */SysMemBootJump(); /* Jump is done successfu
I'm using an STM32 H7 and CubeIDE, As the title states, When placing a breakpoint at HAL_UART_TxHalfCpltCallback, it is triggered.But when placing it at HAL_UART_TxCpltCallback it is never triggered, it used to work, but I don't know where it went wrong. Is there a setting for this in Cube IDE? I don't use the halfcplt function, but it was now just added to search for the error.I'm using normal DMA at highest priority. (I'm running multiple uart's and SAI with DMA) void sendGPSdata(){ if(1){//gps_out[gpsoutpointer-gps_data_size+15] =='A'){ uart_tx_state = 1; set_header(gps_data_size,gps); set_payload(gps); set_footer(gps); HAL_UART_Transmit_DMA(&huart4,&uart_out[0],GPS_packet_size); } gps_data_behind--; } void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *uart){ if(uart == &huart4){ //4g } } void HAL_UART_TxCpltCallback(UART_HandleTypeDef *uart){ if(uart == &huart4){ //4g uart_tx_state = 0; if(audio_to_uart_data_behi
Today I decided to improve the performance of my USB driver by transferring multiple IN packets at a time, instead of one at a time. This in theory would be relatively easy, as I can just configure the IN endpoint's TX-FIFO to have a larger allocation and simply push more data into it whenever I'm sending multiple packets, setting PKTCNT and XFRSIZ as needed.Well that's theory, but in practice? It worked for the most part. I could push up to 7 IN packets all-in-one-go with no problems, but what happens at 8 you may ask? Well, it led to the baffling bug of the "IN Transfer Completed" interrupt not being asserted anymore.I double-checked the endpoints' FIFO address field, the size, the PKTCNT, and XFRSIZ, ... no obvious issue anywhere. I checked the USB bus traffic and could verify that a single IN packet does indeed get sent to the host after I push 8 packets worth of data, but that's it.Okay... what if I reduce my Bulk IN endpoint from 64 bytes to 32 bytes? No difference. What if I all
Hello I am working on the Free RTOS code that I am trying to send the data on the server using Free RTOS but I am not able to send data on the server I am using some dummy data and GPS for location +STM32F411ceu6a+EC200U GNSS. But my RTOS task is not working can some one plz help me find the problem in my code.CODE:-// Globals QueueHandle_t xQueue; SemaphoreHandle_t xBinarySemaphore; typedef struct { float Latitude; float Longitude; float objectTemp; float ambientTemp; float xG; float yG; float zG; float avg; } GPSData_t; /* Definitions for ec200u6 */ osThreadId_t ec200u6Handle; const osThreadAttr_t ec200u6_attributes = { .name = "ec200u6", .stack_size = 128* 4, .priority = (osPriority_t) osPriorityRealtime, }; /* Definitions for L89 */ osThreadId_t L89Handle; const osThreadAttr_t L89_attributes = { .name = "L89", .stack_size = 128 * 4, .priority = (osPriority_t) osPriorityRealtime, }; /* Definitions for myQueue01 */ osMessageQueueId_t myQueue01Handle; const osMes
Hi, i'm using my Nucleo STM32F401RE as a HID Device for a MIDI Keyboard projectI have configured the following:Connectivity --> USB_OTG_FS --> Device OnlyMiddleware --> USB_DEVICE --> Human Interface DeviceI followed a video tutorial to configure the USB MIDI Descriptor in the file usbd_hid.c and it worked, my notebook detects my Nucleo as a USB Device and I have made a code to send only MIDI Note On and Note Off messages up to now, when pushing the Nucleo switch.The problem comes when trying to use a potentiometer to send Control Change messages. I tried to use the ADC with interrupt and with DMA but when i use it, my notebook fails to detect the board as a USBIf i comment the line that initializes the ADC (HAL_ADC_Start_DMA) it works, but when uncommenting it again the ADC works fine but the HID doesn'tI'm not sure if i have an issue with the configuration of the ADC or USB or if maybe they are incompatibleThe code in the main.c is the following: /*
Hello everyoneI do not understand how to use the STACK_SMBUS_ExecuteCommand callback function provided by the SMBUS stack (See picture below). The function is called either in receiving data or transmitting data (from the device point of view). Due to the fact that it is the same function for both situations how can I figure out if it was a read or write command?I defined the CMD_Table with a READ_OR_WRITE cmnd_query. In the callback I receive pStackContext-Pointer. But on the device side the information pStackContext->OpMode is not handled. That's why I have no information if it was a read or write command calling the callback. Can someone help me out and explain how to use the stack function callback for this purpose? Thank you Kind regardsDominic
I can transmit data in this code, but I cannot receive data with an interrupt. Can you help me?Code:#include "main.h"#include "kibar_nextion.h"#include <string.h> UART_HandleTypeDef huart4;UART_HandleTypeDef huart3; uint8_t main_buffer[13];uint8_t pure_buffer[13];uint8_t rx_buffer[1];volatile uint8_t address = 0; int main(void){HAL_Init(); SystemClock_Config(); MX_GPIO_Init();MX_USART3_UART_Init();MX_USB_OTG_FS_PCD_Init();MX_UART4_Init(); __HAL_UART_ENABLE_IT(&huart4, UART_IT_RXNE);KIBAR_NEXTION_ kibar_nextion = KIBAR_NEW_NEXTION();kibar_basic_configuration_nextion(kibar_nextion, &huart4); while (1){for(int i = 0; i < 360; i++) {uint8_t last_data[] = {255, 255, 255};HAL_UART_Transmit(kibar_nextion->kibar_uart_, (uint8_t*)"main_screen.n0.val=", sizeof("main_screen.n0.val=") - 1, 100);HAL_UART_Transmit(kibar_nextion->kibar_uart_, (uint8_t*)kibar_return_array_char_from_16_t(i), kibar_size_integer_data_16_t(i), 100);HAL_UART_Transmi
Hi everyoneI have some issues using the X-CUBE SMBUS stack from ST.Issue 1:I have an issue with the alert response process. I am using 2 WB55 NUCLEO's. One is defined as host, the other is a device. Now when the device pulls alert signal low the master reads on the ARA adress. The device does not respond corretly on this read command. A normal quick command read is transfered correctly but in alert response the slave does not transmit its own address. The signals for those two commands look the same (See pictures). If I single step through the function HAL_SMBUS_Slave_Transmit_IT(...) it works fine and the slave address is transmitted correctly as well as the PEC byte. Does anyone have an idea what the problem could be? Are there some timing issues maybe? Issue 2:In the error callback of the stm smbus stack it performs DeInit / Init in some cases (timeout f.e.) If alert function is used the alert interrupt is not enabled anymore in master mode. I don't know if this is an
Hello,I have a custom pcb with STM32H747XI and a DSI LCD. Everything is on M7 with PWR_DIRECT_SMPS_SUPPLY.The issue that I am facing is that I can't write any data on lanes. Both Positive and Negative are on 1.44v constantly.I tried to be as close as possible to LCD_DSI_VideoMode_SingleBuffer example but with using .ioc generated code.Attached you can find the .ioc and I can upload the whole project if required but probably I miss something in general.Below are the MX_DSIHOST_DSI_Init & HAL_DSI_MspInit as generated.(the clock for DSI is around 7Mhz for debug) void MX_DSIHOST_DSI_Init(void) { /* USER CODE BEGIN DSIHOST_Init 0 */ /* USER CODE END DSIHOST_Init 0 */ DSI_PLLInitTypeDef PLLInit = {0}; DSI_HOST_TimeoutTypeDef HostTimeouts = {0}; DSI_PHY_TimerTypeDef PhyTimings = {0}; DSI_VidCfgTypeDef VidCfg = {0}; /* USER CODE BEGIN DSIHOST_Init 1 */ /* USER CODE END DSIHOST_Init 1 */ hdsi.Instance = DSI; hdsi.Init.AutomaticClockLaneControl = DSI_A
1. CubeMX only allows HAL or LL for SPI and other peripherals. STM32C031C6 itself provides the good SPI clock rate. SPI LL API function only allows two-byte R/W.. The slave STPM34 Meter IC requires 4-Byte SPI R/W. So we have to choose HAL SPI API calls, such as HAL_SPI_TransmitReceive(). However HAL introduces a big delay (15 us or more) between two consecutive HAL SPI-API calls. We need 6 SPI-API calls within 128us for our application, This big delay inserted by HAL makes it impossible. .2. The only solution is to write the register low level SPI R/W functions. Is it possible to write it under the current CubeMx IDE compiler for STM32C031C6? Could you provide us the solutions? Thanks, Rong
I am new to embedded programming and very recently got started with programming the STM32F407G Disc-1 board with STM32CubeIDE(1.12.0).I typical register level program for LED blinking:Blinking the on-board LED - LD4. int main(void){uint32_t *clk_reg = (uint32_t*)0x40023830;uint32_t *D_IO_Mode_reg= (uint32_t*)0x40020C00;uint32_t *D_Out_data_reg= (uint32_t*) 0x40020C14; *clk_reg= *clk_reg|0x08; //port D clock is Enabled*D_IO_Mode_reg = *D_IO_Mode_reg & 0xFCFFFFFF;//clearing of 24 bit*D_IO_Mode_reg = *D_IO_Mode_reg | 0x01000000;//set 24 bit*D_Out_data_reg = *D_Out_data_reg|0X1000; //setting the 12th pin high} After I run the debug session and check the relevant registers, everything looks fine and the LED turns on, as it should be. However, when I terminate the debug session the LED is still ON!!. I plugged out my device from the computer and put it back in, and still the LED is ON. What is going on? Even the onboard reset pin doesn't reset the LED. What is wr
I use NUCLEO-F722ZE and STM32CubeIDE.When I set SDMMC1 to SD 4bits wide bus, the RCC shows a warning “partly disabled conflict with : SDMMC1 : SD 4bits wide bus”. At this time, when I wrote a program on the board and operated it, “FR_DISK_ERR” occurred. Is the error caused by RCC warning?
Hi, I am using STM32F746 controller for development. So my hex file size is too more then controller flash memory. So I am trying to use Moving internal flash data to external flash Making external flash work as internal.So kindly explain how to achive this process and what are the critical faces are in this process. If anybody work on this way means explain to me. I am a beginner for this project. Kindly help to me.Thanks.
Hi, I am working on STM32F1 family and implementing LIN communication. I found the function HAL_UARTEx_ReceiveToIdle_DMA() that is very useful to handle variable incoming data. But I have a problem that this function only works first time, but not calling HAL_UARTEx_RxEventCallback(), I need to get data in USART1_IRQHandler() function. The reason is because the flag of Frame Error is arrising and stops the receive DMA process. The intersting is that the received data is correct, for all different RX size. I review all init and functions according to the examples and forum, and it seems ok. Could it be because the link break detection? My RX buffer always show zero as the first byte, so it compute the break as first data.byte[0] = break;byte[1] = sync;byte[2] = PID... DMA init static void MX_DMA_Init(void) { /* DMA controller clock enable */ __HAL_RCC_DMA1_CLK_ENABLE(); /* DMA interrupt init */ /* DMA1_Channel5_IRQn interrupt configura
I'm simply trying to do:res = f_open(&fil, "file.txt", FA_CREATE_ALWAYS | FA_WRITE);but nothing is created despite the return message. Could it be my SD card? I'm able to read from it in 4B mode.Any suggestions would be gratefully received.
The MCU I'm using is STM32F743H7IIT6.I am trying to perform firmware update via the USART bootloader protocol. (AN3155Application note) Everything was working fine with many .bin files until one .bin file crashed the update. When I debuged I found a command that doesn't receive any response.31 ce good ACK received080163006a (address) good ACK received5bed5f0108ed5f0108ffffffffffffffffffffffffffff000001004153434949000000000000000000000000000000000000000000000000000000415343494900000000000000000000000000000000000000000000000000000000005aNothing is received back. (5b is the number of Bytes followed by 92 bytes and 5a is the checksum)I tried with 59, 5a, 5b, 5c, 5d as the number of Bytes and every time nothingI tried writing 03 ff ff ff ff 03 on the same address and it's working.Also tried longer Byte Arrays with ff number of bytes and they work.(I didn't bother very much with the checksum, as it should return NACK if the checksum was bad) Any help appreciated,&n
Hey all,i need to use the Rust Programming Language. Now i want to enable the PLL to increase the system srequency.I'm using the "stm32h5" crate (https://crates.io/crates/stm32h5). let dp = stm32h563::Peripherals::take().unwrap(); // Setup handler for device peripherals let rcc = dp.RCC; dp.FLASH.acr().write(|w| unsafe { w.latency().bits(5); w.prften().set_bit() }); dp.PWR.voscr().write(|w| w.vos().bits(0b11)); //VOS scale 1 while dp.PWR.vossr().read().vosrdy().bit() != true {} dp.ICACHE.cr().write(|w| w.en().set_bit()); rcc.cr().write(|w| w.hsebyp().set_bit()); rcc.cr().write(|w| w.hseon().set_bit()); //Enable High speed external clock 8 MHz while rcc.cr().read().hserdy().bit_is_clear() {} rcc.cr().write(|w| w.hseext().set_bit()); //PLL1 rcc.cr().write(|w| w.pll1on().clear_bit()); while rcc.cr().read().pll1rdy().bit_is_set() {} rcc.pll1cfgr().write(|w| w.pll1src().bits(0b11)); //HSI as PLL1 source rcc.pll1cfgr().write(|w| unsafe { w.pll1m().bits(4) })
I have successfully got data going to Azure IoT hub, but now need to connect it to Azure IoT Central instead. I've not managed to get it to connect successfully though... This is the device settings, which are in the azure_iot config.h file, but I've been messing with it for a couple of days and can't tell if the problem is with some IoTCentral setting, or something in the firmware config... Anyone else had success with this board? Most of the examples are for the other U5 board which I don't have.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.