Esp32 non blocking delay. At first glance you may doubt the usefulness of this function. Esp32 non blocking delay

 
 At first glance you may doubt the usefulness of this functionEsp32 non blocking delay  everytime: A easy to use library for periodic code execution

e. System time can be kept by using either one or both of the hardware timers depending on the application’s purpose and accuracy requirements for system time. Though delay() is. built for the Arduino framework for ESP32. – unalignedmemoryaccess. If you’re running from a 12-16 MHz internal clock, the 16 bit timer doesn’t give you much of a delay. It means that non-optimal wiring and/or a load capacitor on the bus will most likely lead to input delay values. Non blocking behavior can always be achieved manually by calling update() or updateAllServos() in a loop - see ThreeServos example. loop() is looping but nothing else and all repeating must be done through repeated calls to functions inside function loop() Create a new non-blocking TLS/SSL connection. To generate a delay like this, both functions must be blocking. atoi () can be used to convert the null terminated char arrays to the byte values. 1 Sync Time with NTP Service from a server and set the local clock in the ESP32 (this is well documented and working) 2 Read current usecond till next sec, register a Timer#1 to Trigger when the second arrives. Hello Guys! I just started a new Rest-server project on my ESP32-S2, but I'm facing some problems regarding the function "WiFi. vTaskDelay is a non-blocking delay. Hi all, I am using ESP32 to do a project by using delay() function. ESP8266/ESP32 non-blocking WiFi/AP web configuration. {"payload":{"allShortcutsEnabled":false,"fileTree":{"examples/CDC/cdc_multi":{"items":[{"name":". There are a number of practical driver design. ESP targets such as ESP32, ESP32-S3, and ESP32-P4 are dual-core SMP SoCs. INCLUDE_vTaskDelay must be defined as 1 for this function to be available. One way would be to set up a FreeRTOS message queue which your while loop can scan. one that completely stopped the code from doing any thing else while the delay was waiting to expire. Then, each time through. This forum thread has a few good points when working with non-blocking calls. I tried to archiv the same result with millis (), but until now i could not make it. begin(9600); // This delay gives the chance to wait for a Serial Monitor without blocking if none is found delay(1500); myservo. After login, click on ‘+ Create New Instance’ to create a new instance. The fact is that it’s extremely useful in many. Task priority comes into play when triggering multiple tasks at the same time. In this post we are going to learn how to get started with the Ticker library, using the ESP32 and the Arduino core. 3. Each of those can be assigned to any PWM-capable pin. Note that the "single key" idea still blocks until the user hits that key. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). Knocking my head against a wall on this. I would then create a global message queue using the native environment to receive messages/events from other parts of the system. This means that the execution of a piece of code is identical regardless of which core it runs on. You don't need any task at all for your functionality, you just need a timer to perform the closing activity after 6000 ms. It covers non-blocking delays, non-blocking serial output, non-blocking user input, removing delays from third party libraries, and loop timers, so you can see. Why do we need this ESP32_FastPWM library Features. Limit your total file size to 900Kb. h header file must be included in order to use the delay library function: #include <util/delay. delay(1000);} All reactions. For most projects you should. time. h>. Non-Blocking Delays. INCLUDE_vTaskDelay must be defined as 1 for this function to be available. lienbacher. everytime: A easy to use library for periodic code execution. In this tutorial, we are going to learn another method to blink LED without blocking other tasks. That software has other functions it performs, like running the network stack. The 28BYJ-48 Stepper Motor has a stride angle of 5. . It is possible to do something similar but in an non-blocking. ino at master · prampec/IotWebConf. ESP32 Pin Layout (QFN 5*5, Top View) EspressifSystems 13 SubmitDocumentationFeedback ESP32SeriesDatasheetv4. delay(time in milliseconds); When you call delay(1000) your program stops on that line for 1 second. The while-loop looks like this: while (WiFi. The timer delay is non-blocking. The previous sketch used a blocking delay, i. BLE’s primary application is short distance transmission of small amounts of data (low bandwidth). The SPI controller peripheral external to ESP32 that initiates SPI transmissions over the bus, and acts as an SPI Master. Contents 3. Gotta be something to do with that register you set, or the setcrystal thing or one of those libraries. begin(115200); delay(10); wifisecure. void startTaskFunction(void *params) { //this is the function while ( true ) { xSemaphoreTake (StartSema,portMAX_DELAY); //which in order to start waits this Semaphore to be Given while ( true ) { //do some logic to controll a motor and keep it steady /////to stop this while. For that, we will configure and attach a. Ideally, task 2 should send data while task 1 collecting latest one. ESP32, if one is to look at the code for delay(), as I was shown, one will see that delay() on an ESP32 invokes vTaskDelay(), to run vTaskDelay(), a non-blocking delay, freeRTOS will be loaded. On ESP32-C6, the hardware additionally allows to perform up to 16 consecutive linear fades without CPU intervention. Find this and other ESP32 tutorials on ESP32GetStarted. You're 95% of the way there. Then, each time through. The config portal will stay available after WiFi connection was made. the calling task is. The ESP32 does not do multitasking the way Linux or Windows does. We’ll discuss a couple of ways to achieve this. The elapsed time then is very unaccurate Just like delay() has a microsecond-version called delayMicroseconds(), millis() has micros(). ESP32Time: Set and retrieve internal RTC time on ESP32 boards. I like this option the least although it's probably the simplest. In this post we are going to learn how to get started with the Ticker library, using the ESP32 and the Arduino core. */ #include "thingProperties. Hi everybody, As discussed in this thread The RTC-time drifts away pretty fast when the ESP32 is in a sleep-mode. There are many examples of how to do this on the ESP32 in the Arduino IDE using FreeRTOS). ESP32 Classic Bluetooth has two protocols, namely A2DP and SPP. You need an micro USB cable between PC and. Includes SafeStringReader: non-blocking tokenizing text reader, BufferedOutput: non-blocking text output, BufferedInput: extra buffering for text input, loopTimer: track of the maximum and average run times for the loop, PinFlasher: non-blocking flashing on an output Pin and millisDelay: a non-blocking delay, with single. I'm developing high frequency DAQ based on ESP32 and freeRTOS. unsigned long ini= 0 ; void setup() { Serial. Make sure lines are crossed, so Tx is bind to Rx on the other board and vice versa. IotWebConf will start up in AP (access point) mode, and provide a config portal for entering WiFi connection and other user-settings. You're 95% of the way there. I have pinned one task to each core with infinite loops. In the task void fDoParticleDetector( void * parameter ), I have a 280us delay, not using delay(), millis() and delayMicroseconds(). Some ports allow specifying the delay time as a floating-point number. – tavis. The program should wait until moving on to the next line of code when it encounters this function. It might not be very useful. This shouldn't effect the time for that call to send (), but it will effect the subsequent call (as buffered data which could have been flushed after the last call isn't flushed yet. Another restrain is speed as this loop work at 5ms and i would like to use the core 0. Blocking refers to whether something runs asynchronously or not. Configuring ESP8266/ESP32 as a TCP server using sockets. This means that the motor has a step angle of 5. Delay () Delay is an arduino function wrapper that calls vtaskdelay. Since the esp32 core builds on freertos, you get: void delay (uint32_t ms) { vTaskDelay (ms / portTICK_PERIOD_MS); } and vTaskDelay is defined off in the depths of FreeRTOS somewhere (source for freertos is not included in the Arduino distribution, although it is open. begin(115200); WiFi. Hardware: Board: Lolin32 Core Installation version: d5fdd71 IDE name: IDF component Flash Frequency: 40Mhz PSRAM enabled: no Upload Speed: 115200 Computer OS: Windows 8. The hardware setup for this example is very simple. {"payload":{"allShortcutsEnabled":false,"fileTree":{"libraries/WiFi/examples/WiFiScan":{"items":[{"name":". I use the AsyncWebServer library. delay() would pause the entire code until the time is reached. At its heart, there's a dual-core or single-core. h" #include <Servo. There will be 2 task, first task will run on core 0, communicating with sensors to collect data at 4000SPS, using SPI bus. The ESP32-S2 has two groups of two hardware timers so if I need to have multiple timers in use, then knowing which timer is being used would be helpful. Now that I have the control of NTP sync procedure, it would be a very nice feature to add non blocking NTP request. Now there is a technique of non-blocking timing. Re: Non-blocking sockets, select () and transmit buffer size. ESP32 analog input, ADC Calibration, ESP32 ADC Arduino Example. . I would like to change this as to. for esp32:. The parameter in vTaskDelayUntil is the absolute time in ticks at which you want to be woken calculated as an increment from the time you were last woken. 1 Sync Time with NTP Service from a server and set the local clock in the ESP32 (this is well documented and working) 2 Read current usecond till next sec, register a Timer#1 to Trigger when the second arrives. The testcode used delay() in the mainloop. esp_timer set of APIs provides one-shot and periodic timers, microsecond time resolution, and 64-bit range. I would need to figure out in the most real time possible, when one of such devices is close enough to the ESP32, and I thought that RSSI is a good enough approximation. There's actually a few issues in how the usbcdc functions for the ESP32C3. Task 2 will run on core 1, receiving data from first task and send it async over TCP. one that completely stopped the code from doing any thing else while the delay was waiting to expire. loop() , it checks to see if the desired blink time has passed. Configuring ESP8266/ESP32 as a TCP server using sockets. ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. ESP32 LED Blink without [delay] This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. This library is used to control one or more stepper motors from an ESP32 device. All reactions. Reload to refresh your session. Hi, I have several tasks in freeRTOS on my ESP32 delaying with the vTaskDelay-function. 2 but this function is blocking 'while (1)' loop in main function. This means that the motor has a step angle of 5. If you need better resolution, you can use micros(). do the other actions. However, the output shaft is driven via a 64:1 gear ratio. run() to a specific core on ESP32 using the built-in FreeRTOS library functions. Connect your DEV module to your Arduino IDE. I'm trying to receive a data from one esp32 to another. ESP_Log. For example, the sleep() function, when we call sleep(2), our program stops at this line for 2 seconds, and thus it acts as. I sometimes have in response from the server a blank white page and I think this is the reason. uint32_t. UDP packets can get lost and DNS servers can be slow to respond, so there has to be some amount of retransmits and waiting to see if there is a response as part of the process. Why not use the ESP32's OS, freeRTOS, vTaskDelay which is a non blocking delay? Also, freeRTOS has buffers that would handle such a large data thingy as an image. 1. ducalex commented on Jul 11, 2019 •. com. These ESP32-C3 Hardware Timers, using Interrupt, still work even if other functions are blocking. h> //SSID of your network char. Includes SafeStringReader: non-blocking tokenizing text reader, BufferedOutput: non-blocking text output, BufferedInput: extra buffering for text input, loopTimer: track of the maximum and average run times for the loop, PinFlasher: non-blocking flashing on an output Pin and millisDelay: a non-blocking delay, with single-shot, repeating. Hardware Arduino UNO or any other board supported by the Arduino IDE All the code developed here can be tested with just an Arduino UNO. Given that flush() should only return if data is sent, I think that blocking when there is no CDC connection may be the right behavior. Recently, I had been using the Adafruit Feather ESP32 V2 with ToF sensors from Pololu, and surprisingly I got into the same problem that I encountered when I was using these sensors with the MKR ZERO back in June 2022 - see this post This time I was using the Classic SerialBT that comes with this ESP32 board. Otherwise, if your ESP32 sometimes connects to the Wifi network almost immediately and sometimes it doesn’t seem to connect at all, use this code instead to automatically reset the ESP32 if it doesn’t connect within 5 seconds: fix-esp32-not-connecting-to-the-wifi-network. The ESP32 also does other tasks in the mean time, so I thought that scanning in a non blocking way would be the way to go. The callback-function void SNTP. If you need better resolution, you can use micros(). I2S (Inter-IC Sound), is an electrical serial bus interface standard used for connecting digital audio devices together. The Arduino millis () is a timer-based function that returns to you the time elapsed (in milliseconds) since the Arduino board was powered up. The time setting can be done manually through a network protocol or a battery backup. void loop () { callTask_1 (); // do something callTask_2 (); // do something else callTask_1 (); // check the. 2. The NoDelay library is used as a easy interface for using the built-in Mills function for keeping track of elapsed time and used for non blocking delays. See the RTOS Configuration documentation for more information. We will also expand the example creating a multi-threaded task. Hi, i am using the OneWire Library. Always use RTOS based delay function. One of them, ADC2, is actively used by the WiFi. All without using the delay() function. Then it has to go in an infinite loop to control a motor position. Open Arduino IDE, then go to the tab Sketch and click on the option Include Library-> Manage Libraries. The Ticker library allows to very easily setup callback functions to run periodically, without having to worry about the lower level details of setting up a timer (you can check an example on how to setup timer. There’s actually 3 general ways in which this loop could work - dispatching a thread to handle clientsocket, create a new process to handle clientsocket, or restructure this app to use non-blocking sockets, and multiplex between our “server” socket and any active clientsocket s using select. } blocks the loop. Re: Non-blocking sockets, select () and transmit buffer size. This feature can be useful if you want to do a fade with gamma correction. * The thing will delay actions arriving within 10 seconds. This function will return true if configuration is successful. ype Function AnalogI do not use millis() and delay() with the ESP32 and I write all my ESP32 code using freeRTOS, which would make a significant difference in operations. * * This example also provides the firmware update option. 11. A fade can be operated in blocking or non-blocking mode, please check ledc_fade_mode_t for the difference between the two available fade modes. However, the time I receive back from the NTP server doing so is in seconds and I would like to have the time in milliseconds or microseconds precision. Find this and other ESP32 tutorials on. The elapsed time then is very unaccurateOne way would be to set up a FreeRTOS message queue which your while loop can scan. Another benefit millis()is that it doesn't prevent us from running code while "waiting". The delay is virtual, during the delay, the code execution is continued. Then it has to go in an infinite loop to control a motor position. For delays longer than a few thousand microseconds, you should use. edit: here is a short description of the slow servo sketch. In this video, we will learn to create a non-blocking delays in MicroPython which is very similar to millis funtion of Arduino. Then we can likely propose a good way of solving your problem. cpp 📋 Copy to clipboard ⇓ Download. The principle is easy to describe but there are some gotchas along the way that you need to look out for. If it is somewhere around twice the amount of a single tick, then it'll probably work. I am using an ESP32-WROOM-32 Development Board (30 pin version) with Platformio (CLion version). A task switch is normally considered a form of “blocking”, isn’t it? Some other task may run, but YOUR task has. I am trying to create my own delay function but my sketch keeps crashing. Unlike Bluetooth that is always on, BLE remains in sleep mode constantly except for when a connection is initiated. สาธิตวิธีการใช้เซนเซอร์วัดระดับน้ำแบบไร้สัมผัส รุ่น XKC-Y25-PNP ร่วมกับ Arduino Nano หรือ ESP32 เพื่อวัดระดับน้ำแบบไม่ต้องติดตั้งให้สัมผัส. I know this isn't a simple "drop-in" suggestion, but maybe you can look. I want it to port to a Non-Blocking code. Step 1: Hardware. Configuration of GDB Hardware Debugging - Debugger tab. ; Measuring distance between 3 meters and 7 meters. This vTaskDelay( 2 ); is a NON-blocking delay. These targets have the following hardware features that make them SMP-capable: Two identical cores are known as CPU0 and CPU1. Especially on the smaller STM32’s, the 32 bit timers can be non-existent, or scarce. The project is essentially a web server on esp32 that sends data from different sensors and shows it on a beautiful website page. There will be 2 task, first task will run on core 0, communicating with sensors to collect data at 4000SPS, using SPI bus. Learn how to combine keypad and piezo buzzer code, how to program ESP32 step by step. Modbus Client aka Master for ESP32. Step 1: Advantages of the VirtualDelay Library. These targets have the following hardware features that make them SMP-capable: Two identical cores are known as CPU0 and CPU1. We can use the machine. This xEventGroupWaitBits (eg, evtDoTheBME280Thing, pdTRUE, pdTRUE, portMAX_DELAY ); is a task trigger. I have the socket setup in non blocking mode with : err = fcntl (sock, F_SETFL , O_NONBLOCK ); and for good measure I do the send call with: err = send (sock, tempbuf, tempbuflen, MSG_DONTWAIT ); I time. sleep (seconds): This blocking method provides a delay in seconds. That software serial library is not compatible with the ESP32 - it is only compatible with AVR-based boards. Arduino - delay () function. However, the loops don't have delay() or vTaskDelay() in them and I was wondering if that would cause issues with the pinned tasks blocking other system/housekeeping tasks from executing, as discussed in this thread. is there a non-blocking type of library for this sensor out there (which works. Best power transistor for a high PWM output from ESP32. Let's say portTICK_PERIOD_MS. Reifel but provides some. do the other actions. /* Blink without Delay Turns on and off a light emitting diode(LED) connected to a digital pin, without using the delay() function. You should copy it and use it here. h) will allow you to busy-wait for a. 0. In a simple state machine you'd assume you can be in one of two states: outputting a tone, and not outputting a tone. As a computer programmer implementing logic, you don’t want your tasks to get delayed for any reason. All functions are non-blocking (without using delay() function) Easy to use with multiple LEDs. Using this library would make next versions of NTPClientLib compatible only with ESP8266 and ESP32, as there is no equivalent library for MKR1000. Getting Date and Time from NTP Server. Setting EEPM1 and EEPM0 both to 0 will erase and program a new byte in a single operation. QoS 1 and 2 have different behaviors since the protocol requires extra steps to complete the process. SPI slave device (general purpose SPI controller). Interrupt based movement (movement without calling update() manually in a loop) is supported for the following Arduino architectures: avr, megaavr, sam, samd, esp8266, esp32, stm32, STM32F1 and apollo3. A WiFiManager alternative. How to write a non-blocking delay in Arduino. Examples of non-blocking operations include non-blocking send (synchronous) and CLFLUSHOPT. EveryTimer: A library providing the possibility to call a function at specific time intervals. I want to run away from there. vTaskDelay () is a non-blocking delay, it let's other threads to continue working. This library enables you to use 1 Hardware Timer on an ESP32_S2-based board to control up to 16 independent servo motors. Hi, I have several tasks in freeRTOS on my ESP32 delaying with the vTaskDelay-function. The ESP32 has two ADCs. Ideally, task 2 should send data while task 1 collecting latest one. ESP32 had a total of 4 hardware timers (Timer0, Timer1, Timer2, Timer3) which are all 64 bit based on 16-bit pre-scalers. Yes, delay (8000); in your void timeDelay () {. The ESP8266 server uses the connected router’s IP address. ) To work around this use setsockopt () to enable TCP_NODELAY. It keeps track of the elapsed time since the start of the delay or cycle and is non-blocking. everytime: A easy to use library for periodic code execution. [esp12 , esp32] Posted on July 30, 2019. First of all, you don't want to delay the loop() ever. This library allows you to use the I2S protocol on SAMD21 based boards (i. SPI Master driver is a program that controls ESP32’s General Purpose SPI (GP-SPI) peripheral(s) when it functions as a master. I would like to break this second loop when the stop button is pressed. I would like to write my own function to create a delay in a FreeRTOS task, without. ino. muTimer. 10. Thanks anyway. 8 Delay_ms class The 28BYJ-48 Stepper Motor has a stride angle of 5. I2C (Inter-Integrated Circuit) / TWI (Two-wire Interface) is a widely used serial communication to connect devices in a short distance. if the output buffer is full and you're calling send/write too often). Delay time that defines how long the output of the HC-SR501 stays HIGH after a motion is detected between 2. Hi, I'm doing a project in which I have to connect to a WiFi network. That's the whole reason of not using delay(). The previous sketch used a blocking delay, i. h ” is used for controlling the RGB LED strip. Node-RED, the "delay" node. I. I created an easy library for the ESP32 arduino toolchain to read the ADC, average up to 1,000,000 samples, linearize it (because the integral non-linearity is horrible), all with non-blocking code. Socket operations will return EWOULDBLOCK if they would block need to block (e. As you can see in the datasheet (below image) there are some lines also. h> Servo myservo; void setup() { // Initialize serial and wait for port to open: Serial. This method is a shorthand for certain settimeout() calls: sock. The important thing to. lwIP non blocking call of recvfrom. Share. This non-being-blocked important feature is absolutely necessary for mission-critical tasks. Easy ESP32 camera HTTP video streaming server. Where was this post 4 hours ago? Too stubborn to google is a flaw. ; The. ). In the task void fDoParticleDetector( void * parameter ), I have a 280us delay, not using delay(), millis() and delayMicroseconds(). There will be 2 task, first task will run on core 0, communicating with sensors to collect data at 4000SPS, using SPI bus. Another benefit millis()is that it doesn't prevent us from running code while "waiting". 5 seconds; And go back to step 1, because the loop() function keeps being executed again and again. Created by Espressif Systems, ESP32 is a low-cost, low-power system on a chip (SoC) series with Wi-Fi & dual-mode Bluetooth capabilities! The ESP32 family includes the chips ESP32-D0WDQ6 (and ESP32-D0WD), ESP32-D2WD, ESP32-S0WD, and the system in package (SiP) ESP32-PICO-D4. . To deal with calls to blocking activities triggered from the GUI I normally create a second native thread which monitors a similar global message/event queue that LVGL can post non blocking requests toFor example, certain function is blocking while it's connecting to WiFi or some services. Introduction. In new tab select region and click on ‘Review’. Open the "espgfxGIF. // Initializing the variable with the time BEFORE the count. If not set. Code for Shift Register: Switch Debouncer. Beginner in Arduino and ESP-32 needs help. range is 1-14 bits (1-20 bits for ESP32). and called it in an else clause added to that if statement, and discovered that the blocking delay is not this while loop. You need to solder header pins on the GND, DT, SCK, and VCC pins. ESP32 → PC: Your code on ESP32 send data via Serial. where the manual_delay_function is: `. loop() , it checks to see if the desired blink time has passed. And we’re going to do it with our second button (the one on the right), the sleepButton. The previous sketch used a blocking delay, i. ESP8266/ESP32 non-blocking WiFi/AP web configuration Arduino library - IotWebConf/IotWebConf14GroupChain. 1. This serial communication is considered as a. Problem is, I cannot start them from outside before the time is over. Delay a task until a specified time. Optional - an ESP32 e. It is based on the FlexyStepper library by S. setblocking(False) is equivalent to sock. tick () will prevent the timer from moving forward and calling any functions. Set blocking or non-blocking mode of the socket: if flag is false, the socket is set to non-blocking, else to blocking mode. Currently, the largest value that will produce an accurate delay is 16383; larger values can produce an extremely short delay. Looking back it is clear sure a delay delays = blocking the whole. So, if any part of your code uses a delay (), everything else is dead in the water for the duration. From the IDF documentation: Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when using together, which means the adc2_get_raw () may get blocked until Wi-Fi stops, and vice versa. Helpful if you need a long delay() or you want to operating a stepping motor for more than a couple seconds. void manual_delay_function ( unsigned long delay_time) { unsigned long current_time = millis (); bool delay_flag = true; while. 1. e. Why do we need this ESP32_ISR_Servo library Features. It seems that your specific problem here is that Blynk. The definition is that one in esp32-hal-misc. 625°/64 in half-step mode. ESP32-WROOM-32 PWD with millis. One way would be to set up a FreeRTOS message queue which your while loop can scan. If the counter have not been activated, the currenttime=millis() always ticking. Hi everyone, I want to use the HC-04 ultrasonic sensor in my project. A non blocking delay is a type of delay that allows other code to operate even though there is a delay operation elsewhere. Return-1 If connection establishment fails. The pieces to make a fully functional non-blocking analogRead were already a part of the ESP32 arduino. To address this, the following code implements a non-blocking approach using the ezLED library. (in ms) delay before toggling LED . Delay a task for a given number of ticks. The objective is to allow the Arduino to continue doing what it was doing before the interrupt. ESP32 runs FreeRTOS with preemptive multi-threading. non blocking API. begin(115200); delay(10); wifisecure. Send it a message from another task to change the delay time. #include #include. This next sketch shows you how to write a non-blocking delay that allows the code to continue to run while waiting for the delay to expire. Timing. If there's a semantic difference between delayMicroseconds() and delay(), it would be nice to document that! There's certainly no such difference in the general Arduino interface expectations. This means that the shaft (visible. As for making EEPROM writes non-blocking, you could set a (non-blocking). A non-blocking read will (or at least should) always return immediately, but it might not return any data, if none is available at the moment. This is one of the most common peripherals used to connect sensors, EEPROMs, RTC, ADC, DAC, displays, OLED, and many other devices and microcontrollers. Which makes 'loopDelay' a stupid name 'SerialInterval' is more appropriate.