I created a new freertos task and initially pulled a gpio pin high in the task, it was very simple. But when I monitor the waveform of this pin with an oscilloscope, I found that this pin is not always high, when freertos does time slice task scheduling and switches tasks, this pin will return to the low initial state, I tried a lot methods, such as using preemptive scheduling instead, or setting this pin in all tasks, but none solved the problem.
Here is my code:
void testTask1(void* *pvParameters)
{
while(1)
{
gpio_bit_set(GPIOD, GPIO_PIN_4);
}
}
void main(void)
{
rcu_periph_clock_enable(RCU_GPIOD);
gpio_init(GPIOD, GPIO_MODE_OUT_PP, GPIO_OSPEED_MAX, GPIO_PIN_4);
xTaskCreate(testTask5, "test_task5", 128, NULL, 1, NULL);
vTaskStartScheduler();
}