2015-12-23 11:31 PM
Hello All,
I try to send an uint8_t array over SPI with DMA, but the microcontroller going to hard fault handler. The C code is generated by STM32cubeMX.My source code is:/* USER CODE BEGIN 0 */&sharpdefine meret 100uint8_t spitx[meret];/* USER CODE END 0 */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(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_SPI1_Init(); /* USER CODE BEGIN 2 */ for(uint16_t i=0;i<meret;i++) { spitx[i]=127; } HAL_SPI_Transmit_DMA(&hspi1,spitx,meret); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */}Can someone help to me? #dma #spi #hardfault2015-12-24 07:46 AM
You'll need to analyze the faulting state, and look at the processor context and register states.
Look at implementing a proper Hard Fault Handler, and examining the instruction that is actually faulting.2015-12-24 08:03 AM
As Clive said, step through your code and watch where it goes to HardFault. These HAL functions are quite enormous and it is hard to say what should go wrong.
2015-12-24 04:15 PM
I found the solution. This is an STM32cubeMX bug.
Thank's for all!