arduino-esp32
arduino-esp32 copied to clipboard
Don't know where the 10ms delay comes from? 【不知道哪里来的10ms延时?】
Board
ESP32-S3 N16R8
Device Description
Using the software environment,【使用软件环境,】 vscode+platformIO arduino espressif32 6.4.0 Use hardware【硬件使用】:ESP32-S3 N16R8
Question: There is an inexplicable 10ms do not know what task is being performed. 【问题: 出现莫名其妙的10ms不知道在执行什么任务。】
Hardware Configuration
no
Version
latest master (checkout manually)
IDE Name
PlatformIO
Operating System
windows11
Flash frequency
40MHz
PSRAM enabled
yes
Upload speed
115200
Description
Question: There is an inexplicable 10ms do not know what task is being performed. 【问题: 出现莫名其妙的10ms不知道在执行什么任务。】
for example 【举个简单例子】
`#include <Arduino.h> unsigned long lasttime = 0; unsigned long nowtime = 0; void setup() { Serial.begin(115200); }
void loop() { lasttime = micros(); Serial.printf("1->lasttime=%u,", lasttime);
nowtime = micros() - lasttime; Serial.printf("%u\n", nowtime);
vTaskDelay(1); }`
And if vTaskDelay(1); Change to vTaskDelay(2). There is no such phenomenon
The output is normal.
【而如果vTaskDelay(1);修改为vTaskDelay(2);就没这个现象
输出很正常】
There is also a normal writing output, or vTaskDelay(1);
However, when you do not use a string of more than two bytes to print, it is normal
【还有一种写法也输出正常,还是vTaskDelay(1);但是不使用2个字节以上的字符串打印时候,也正常】
And when I thought I had found the problem, what was this routine?
【而我满心欢喜以为找到问题时候,结果这个例程又是为什么呢?】
Sketch
#include <Arduino.h>
unsigned long lasttime = 0;
unsigned long nowtime = 0;
void setup()
{
Serial.begin(115200);
}
void loop()
{
lasttime = micros();
Serial.printf("1->lasttime=%u,", lasttime);
nowtime = micros() - lasttime;
Serial.printf("%u\n", nowtime);
vTaskDelay(1);
}
Debug Message
Question:
There is an inexplicable 10ms do not know what task is being performed.
【问题:
出现莫名其妙的10ms不知道在执行什么任务。】
for example
【举个简单例子】
`#include <Arduino.h>
unsigned long lasttime = 0;
unsigned long nowtime = 0;
void setup()
{
Serial.begin(115200);
}
void loop()
{
lasttime = micros();
Serial.printf("1->lasttime=%u,", lasttime);
nowtime = micros() - lasttime;
Serial.printf("%u\n", nowtime);
vTaskDelay(1);
}`

And if vTaskDelay(1); Change to vTaskDelay(2). There is no such phenomenon
The output is normal.
【而如果vTaskDelay(1);修改为vTaskDelay(2);就没这个现象
输出很正常】

There is also a normal writing output, or vTaskDelay(1);
However, when you do not use a string of more than two bytes to print, it is normal
【还有一种写法也输出正常,还是vTaskDelay(1);但是不使用2个字节以上的字符串打印时候,也正常】

And when I thought I had found the problem, what was this routine?
【而我满心欢喜以为找到问题时候,结果这个例程又是为什么呢?】

Other Steps to Reproduce
..
I have checked existing issues, online documentation and the Troubleshooting Guide
- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
This is due to how delay is calculated. The minimum delay is a multiple of the FreeRTOS tick frequency (1000 Hz). https://github.com/espressif/arduino-esp32/issues/2981
Isn't this just related to the serial buffer filling up and thus turning the Serial.print
call into a blocking call until the last byte of your call was at least put into the buffer?
Is this problem has been solved? I also meet this question
Is this problem has been solved? I also meet this question
No solution
Is this problem has been solved? I also meet this question
No solution
Are you sure? As I mentioned 3 weeks ago, you are sending about 24 bytes via serial every msec.
At 115200 baud, you can't process this amount of data and thus at some point the serial buffer will be full and the serial print statement will be blocking. As simple 'proof' of this theory, you can try to only send the last few bytes to serial, or increase the baud rate.
Hello, closing as therr are no action points and this issue is just a question.