Question
STM32F103C8T6 SPI DMA hardfault
Posted on December 24, 2015 at 08:31
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 #hardfault