STM32F103C8T6 SPI DMA hardfault
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-12-23 11:31 PM
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
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-12-24 7:46 AM
Posted on December 24, 2015 at 16:46
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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-12-24 8:03 AM
Posted on December 24, 2015 at 17:03
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.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-12-24 4:15 PM
Posted on December 25, 2015 at 01:15
I found the solution. This is an STM32cubeMX bug.
Thank's for all!