Hi stm Community,
I have an issue with freeRTOS when I add DHT22 initial and getdata function to the default task. I tried many options but had no success. I set up freeRTOS v2 in MX and built a second task. add my dht22 library to main.c and initialize it in default task:
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN 5 */
DWT_Delay_Init();
DHT22_Init(DHT22_GPIO_Port, DHT22_Pin);
/* Infinite loop */
for(;;)
{b++;
DHT22_GetTemp_Humidity(&temperature,&humidity);
HAL_GPIO_TogglePin(LED2_GPIO_Port,LED2_Pin);
osDelay(1000);
}
/* USER CODE END 5 */
}
after I compiled it, I found just one temperature and humidity data and after that MCU not working and LEDs kept ON.
I put global variable b to count how many times the default task ran and it sticks on “1”.
how can I solve this problem?
total heap size: one-time default next time on 65536
task stack size 8192