New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Least possible scheduling time #163
Comments
The fastest scheduling is instant, and incrementally 1ms.
But I am sure the problem is elsewhere.
Could you please send me your code at ***@***.***?
I'll have a look.
Sent from my mobile implant.
Apologies for autocorrect.
…________________________________
From: Siddarth Chockalingam Murugesan ***@***.***>
Sent: Wednesday, April 19, 2023 10:18:17 AM
To: arkhipenko/TaskScheduler ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [arkhipenko/TaskScheduler] Least possible scheduling time (Issue #163)
Hi, I am using this library to read IMU sensor data. I have a created task where the data is collected. It works fine when I run the task with a 1-second interval, but when I try to run it for 20ms or 50ms, it doesn't work well. I observed this using the millis() function in the task. If it is meant to be like that, what is the least possible scheduling time that a task can be assigned of ?
Thanks
—
Reply to this email directly, view it on GitHub<#163>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AACMMTPRQQPQ56CZUFFGLCTXB7X2TANCNFSM6AAAAAAXEEWDAI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Thank you for your response. I have attached the code here and also have mailed you it. The created task is intended to collect IMU data for every 20 ms, running on Arduino on Xiao nrf52840 ble sense board, and send it via Bluetooth. // Required libraries added (check readme file references for further info) //Create an instance of class LSM6DS3 IMU // UUid for Service // UUid for IMU characteristics // BLE Service // BLE Characteristics (1 time data + 6 IMU sensor data) // millis return values in data type unsigned long type void imu_read_func(); void imu_read_func() void setup() pinMode(LEDR, OUTPUT); // onboard led red // init IMU
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed pinMode(sensorPin, INPUT);
if (!BLE.begin()) // error: flash led forever
} //ppg sensor setup // Set BLE name // Set advertised Service // Add characteristics to the Service // add service to BLE // start advertising runner.addTask(imu_task); void loop() // central device connected
} } |
you guys should check for this #define _TASK_MICRO_RES in my project of led increment light , split into micro second will make the led light goes up smoothly |
I am using nrf 52832. I also have this problem. i tested 80ms, I used mills(), no problems. i tested 50ms, the result is 40 ms. and I test 20 ms or other lower like 10ms, 5ms. the result is always 14ms. |
I tested example 13 Micros, the result is the first interval is also 14 ms,second is 20ms. it is weird. |
First, you should not do this in the loop:
this is blocking, and the framework does other things outside of the loop() which are now blocked. Second:
This is a very expensive method - 3 reads of the Float value with I2C and a write to a BLE stack. Can you run this method 1000 times wrapped with two millis() calls before and after? |
my problem is solved, UART costs so much time. when I remove all the print function. 1ms works well for me now. |
Thanks you for posting this, helps me a tonne! :) |
I am struggling to get this to wonderful BLE example to build, any advice on your setup? I am at latest Arduino IDE, and I've tried Platform.io as well. I think it might be very sensitive to exactly which version everything is? Thank you!!! |
Hi, I am using this library to read IMU sensor data. I have a created task where the data is collected. It works fine when I run the task with a 1-second interval, but when I try to run it for 20ms or 50ms, it doesn't work well. I observed this using the millis() function in the task. If it is meant to be like that, what is the least possible scheduling time that a task can be assigned of ?
Thanks
The text was updated successfully, but these errors were encountered: