title: STM32 Keil - Can not access target
body: <p>I'm trying to debug my stm32f407 project in Keil but I get the message &quot;cannot access target shutting down debug session &quot;. I'm trying to work with the DHT11 sensor and I want to show the result on the LCD. but I can't debug the code and can't figure out what is the problem.
  for the dht11 sensor, I used the guidness in
  <a href="https://controllerstech.com/using-dht11-sensor-with-stm32/" rel="nofollow noreferrer">https://controllerstech.com/using-dht11-sensor-with-stm32/</a>
  I can program the MCU and run the code, the problem is only in debugging.</p>
  <pre><code>/* Includes ------------------------------------------------------------------*/
  #include &quot;main.h&quot;
  #include &quot;adc.h&quot;
  #include &quot;i2c.h&quot;
  #include &quot;tim.h&quot;
  #include &quot;usart.h&quot;
  #include &quot;gpio.h&quot;
  
  /* Private includes ----------------------------------------------------------*/
  /* USER CODE BEGIN Includes */
  
  #include &quot;tm_stm32_hd44780.h&quot;
  #include &quot;stdio.h&quot;
  #include &quot;string.h&quot;
    
  #include &quot;bh1750.h&quot;
  #include &quot;DHT.h&quot;
  /* USER CODE END Includes */
  
  /* Private typedef -----------------------------------------------------------*/
  /* USER CODE BEGIN PTD */
  
  /* USER CODE END PTD */
  
  /* Private define ------------------------------------------------------------*/
  /* USER CODE BEGIN PD */
  /* USER CODE END PD */
  
  /* Private macro -------------------------------------------------------------*/
  /* USER CODE BEGIN PM */
  
  /* USER CODE END PM */
  
  /* Private variables ---------------------------------------------------------*/
  
  /* USER CODE BEGIN PV */
  char DM[35]=&quot;temp is: &quot;;
  char RT[35]=&quot;humidity is: &quot;;
  char ch[10]=&quot;10&quot;;
  uint8_t TEMP;
  uint8_t RH;
  
  //strncat(tara, &amp;ch, 1);
  
  /* USER CODE END PV */
  
  /* Private function prototypes -----------------------------------------------*/
  void SystemClock_Config(void);
  /* USER CODE BEGIN PFP */
  
  /* USER CODE END PFP */
  
  /* Private user code ---------------------------------------------------------*/
  /* USER CODE BEGIN 0 */
  #define DHT_H_11
  DHT_DataTypedef DHT11_Data;
  float Temperature, Humidity;
  
  #define DHT11_PORT GPIOA
  #define DHT11_PIN GPIO_PIN_1
  
  /* USER CODE END 0 */
  
  /**
    * @brief  The application entry point.
    * @retval int
    */
  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();
  
    /* USER CODE BEGIN Init */
  
    /* USER CODE END Init */
  
    /* Configure the system clock */
    SystemClock_Config();
  
    /* USER CODE BEGIN SysInit */
  
    /* USER CODE END SysInit */
  
    /* Initialize all configured peripherals */
    MX_GPIO_Init();
    MX_ADC1_Init();
    MX_I2C1_Init();
    MX_I2C2_Init();
    MX_TIM6_Init();
    MX_USART1_UART_Init();
    MX_USART2_UART_Init();
    MX_USART3_UART_Init();
    /* USER CODE BEGIN 2 */
      TM_HD44780_Init(16,2);
    TM_HD44780_Puts(0,0,(char*)DM);
      TM_HD44780_Puts(10,10,(char*)TEMP);
    
    /* USER CODE END 2 */
  
    /* Infinite loop */
    /* USER CODE BEGIN WHILE */
      while (1)
      {
          
          
      /* USER CODE END WHILE */
  
       /* USER CODE BEGIN 3 */
   
      
          DHT_GetData(&amp;DHT11_Data);
      
      Temperature = DHT11_Data.Temperature;
        Humidity = DHT11_Data.Humidity;
        HAL_Delay(3000);
      }
       
          Temperature=(char) TEMP;
        Humidity= (char) RH;
        HAL_Delay(1000);
        TM_HD44780_Puts(10,10,(char*)TEMP);
        TM_HD44780_Puts(0,0,&quot;STM32 &lt;3&quot;);
      /* USER CODE END 3 */
      }
  </code></pre>