Forums » Req. WJ2(ESP32) support »
How to change the solver fixed stepsize less than 10 millisecond
Added by martin van beek about 4 years ago
Dear support,
How can I change the solver fixed stepsize less than 10ms, I need a stepsize of 100us.
When I change this stepsize less than 10ms, the ESP32 controller will stop working.
Also the Target Setup interface block doesn't have a property input field where you can change the base step size.
Now it shows always 1 second for the base step size.
Best regards,
Martin.
Replies (5)
RE: How to change the solver fixed stepsize less than 10 millisecond - Added by Chandima Jayaneththi (จันทิมา) about 4 years ago
From the Waijung2 release 20.11a onwards the sample time of ESP32 can be changed up to 1ms . If you need to go lower than 1ms, we recommend to use the ESP32 with bare board. But current Waijung 2 blockset does not support bare board programming.
It is not recommended to use the solver fixed-step size to change the sample time of the ESP32. Keep that settings as default (change the FIxed-step size to auto) and change sample time from the block mask.
As an example please refer the following model.
The pulse generator has a sample time of 1ms and the state will be changed with the time interval of 1ms. So the digital state of the GPIO4 should be changed with the interval of 1ms.
Please visit Scheduling mechanism in Waijung 2 wiki page for more information about task scheduling.
RE: How to change the solver fixed stepsize less than 10 millisecond - Added by martin van beek about 4 years ago
I've the same Waijung 2 version as you when looking at the picture in your last reply (version V.19.03.1) and don't understand your comment about the version 20.11a and onward.
But the best stepsize timing I can choose at this moment is 10 milliseconds, when modeling with 5 milliseconds the processor will stop working.
Did you verify the 1 millisecond stepsize yourself with a hardware oscilloscope?
See for the results I grabbed in the attachment below.
Best regards,
Martin.
Capture11.JPG | View Capture11.JPG | 489 KB | |||
Capture10.JPG | View Capture10.JPG | 499 KB | |||
Capture12.JPG | View Capture12.JPG | 227 KB |
RE: How to change the solver fixed stepsize less than 10 millisecond - Added by Krisada Sangpetchsong (เอม) about 4 years ago
Dear Martin. We plan to release Waijung 2 version 20.11a today. Sorry for being ahead of ourself.
RE: How to change the solver fixed stepsize less than 10 millisecond - Added by Chandima Jayaneththi (จันทิมา) about 4 years ago
The sample time of the ESP32 depends on the FreeRTOS tick rate. For the higher tick rate we can get a better configurable sample time range. But there are some limitations of freeRTOS configuration on ESP-IDF. According to the configuration, the range of the tick rate is between 1 to 1000 Hz as in the following configuration figure. It means that the sample time can be varied from 1s to 1ms.
If the tick rate is tried to change manually to more than 1000Hz, the ESP-IDF doesn't allow the user to configure it.
The maximum that it can be configured is 1ms.
The sample time in the previous release was set to 10ms (100Hz). That's why it could not be able to go beyond 10ms. With the waijung2_20.11a release (which was released on 04th November 2020), the sample time can be configured upto 1ms.
The new Waijung 2 release can be download from here
RE: How to change the solver fixed stepsize less than 10 millisecond - Added by martin van beek about 4 years ago
Great work, Waijung2 update v20.11a did the job.
Hopefully you will also implement the 'bare metal' mode for better solver step timing, Simulink Embedded Coder can do task scheduling much faster then 1 millisecond.
But for now, thanks a lot for enabling the 1ms step size.
Best regards,
Martin.