Problem configuring DMA on STM32F130rb trying to read a temp sensor
- December 9, 2019
- 3 replies
- 1107 views
Hi all,
I'm trying to write a small program that will read the values from the temperature/humidity sensor. I will try to explain in detail what I have at the moment, but bear with me, I'm still a beginner in bare metal development.
I am using an STM32F103RB board, DHT22 temp/hum sensor, and FreeRTOS as middleware. The environment is STM32CubeIDE (eclipse based, arm gcc compiler, st-flash) with HAL driver and CMSIS BSP.
I have configured the TIM3_CH1/Trig on channel 6 and on pin PA6. Since the sensor is using a singel wire protocol, I am switching the mode of the GPIO from output to input and back in order to get the data in. The problem occurs when I call the HAL_TIM_IC_Start_DMA function. In it, the correct channel will be chosen, and the corresponding callbacks should be set. And that is exactly where I get the a hard fault interrupt. in particular at this specific line:
htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt;
in file stm32f1xx_hal_tim.c, line 2106.
I've added the handler in the HardFault_Handler, that gets the status of the registers, but, as a novice, that doesn't mean that much to me.
So, at the moment, I am stuck at this point.
I have included the entire project as an attachment, hopefully, it is not too much to ask, someone could have a look at it.
Thank you all in advance!
Vladimir
