Thanks chipfryer27 and Martin;
With the simulation, it works very well.
For programming, no.
I don't want to use "delay" because it's not precise.
I could possibly use interrupts.
And I bought Flowcode to avoid writing lines of code.
The problem comes from the Timer because when I do a test with delays only, it works. As soon as I replace the delays with the timer, the program does not load completely.
Components libraries bugs.
-
- Posts: 22
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 5:21 am
- Has thanked: 1 time
- Been thanked: 1 time
-
- Valued Contributor
- Posts: 1453
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 707 times
Re: Components libraries bugs.
The interrupt example I gave should be the most accurate...(I think you should find delay pretty good too - test it?)
Note that, the timer version won't work (and might not be very accurate) - you can do it this way - create an interrupt that increments a counter every 1ms. (This will be very accurate - 1ms is 'ages' at 240MHz)
However - the busy wait (while 1, if ms > 1000...) Isn't a good technique - and wdt issues will cause more problems....
Martin
Martin
Note that, the timer version won't work (and might not be very accurate) - you can do it this way - create an interrupt that increments a counter every 1ms. (This will be very accurate - 1ms is 'ages' at 240MHz)
However - the busy wait (while 1, if ms > 1000...) Isn't a good technique - and wdt issues will cause more problems....
Martin
Martin
-
- Posts: 206
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 34 times
- Been thanked: 25 times
Re: Components libraries bugs.
Hi
you can also check this prog who is using multitasking of freeRTOS.
it's very fast and accurate too
toggle every 0.5S toggle every 1ms do not forget to change Tick rate to 1000 Hz in menuconfig (default value is 100HZ, so min delay is 10ms)
--> Component config-->Freertos--->Tick rate to 1000
then recompile your program
you can also check this prog who is using multitasking of freeRTOS.
it's very fast and accurate too
toggle every 0.5S toggle every 1ms do not forget to change Tick rate to 1000 Hz in menuconfig (default value is 100HZ, so min delay is 10ms)
--> Component config-->Freertos--->Tick rate to 1000
then recompile your program
Seb
-
- Posts: 22
- Joined: Thu Dec 03, 2020 5:21 am
- Has thanked: 1 time
- Been thanked: 1 time
-
- Matrix Staff
- Posts: 1913
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 619 times
- Been thanked: 644 times
Re: Components libraries bugs.
Hello.
Here is my input on this.
The timer interrupt on the ESP32 is different from the PIC version.
For example you can select: It's very accurate.
For a 1 second timer interrupt: It does need to be noted the simulation will be much faster than embedded.
Here is my input on this.
The timer interrupt on the ESP32 is different from the PIC version.
For example you can select: It's very accurate.
For a 1 second timer interrupt: It does need to be noted the simulation will be much faster than embedded.
- Attachments
-
- ESP Wroom32 1sec timer.fcfx
- (9.03 KiB) Downloaded 505 times
Martin
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 684 times
Re: Components libraries bugs.
Hello djebirmalik,
I've been informed you're not satisfied and would like some addtional help. Can you attach your programs that aren't working for the timer / timer interval and I'll investigate. The ESP does do timers a bit differently and so it could be the timer components aren't quite doing things right for what you are expecting.
I've been informed you're not satisfied and would like some addtional help. Can you attach your programs that aren't working for the timer / timer interval and I'll investigate. The ESP does do timers a bit differently and so it could be the timer components aren't quite doing things right for what you are expecting.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 22
- Joined: Thu Dec 03, 2020 5:21 am
- Has thanked: 1 time
- Been thanked: 1 time
Re: Components libraries bugs.
Hi BenR,
here is the flowchart.
As soon as I drag the timer into the 2D board and send the programming, the program fails.
Also, when a program fails, a duplicate of the files is automatically copied to my desktop ????
and each time an ESP is programmed, the programming takes a while. However, I followed the ESP32 "toolchain" installation method in PDF.
here is the flowchart.
As soon as I drag the timer into the 2D board and send the programming, the program fails.
Also, when a program fails, a duplicate of the files is automatically copied to my desktop ????
and each time an ESP is programmed, the programming takes a while. However, I followed the ESP32 "toolchain" installation method in PDF.
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 684 times
Re: Components libraries bugs.
Hello,
I'm now compiling the project you sent...
Ok I see the problem I'll see if we can make the Timer component work better on the ESP32 hardware. Looks like currently it's not happy.
One problem is going to be that there might not be a good way to collect timings better then the resolution of the interrupt. The problem being that higher resolution will be more interrupts which could then start making things take longer.
For example on a PIC you can get very high resolution e.g. on a 16-bit timer you get 1:65536 better resolution than the interrupt frequency. On the ESP things are a bit more hidden in the IDF code and hacking into the IDF code caused potential problems moving forwards in the IDF version.
I'll try and add a ESP 32 specific property that allows you to set the resolution, I'll also look at the IDF code and see if there is a way to access the internal count registers.
I'm now compiling the project you sent...
Ok I see the problem I'll see if we can make the Timer component work better on the ESP32 hardware. Looks like currently it's not happy.
One problem is going to be that there might not be a good way to collect timings better then the resolution of the interrupt. The problem being that higher resolution will be more interrupts which could then start making things take longer.
For example on a PIC you can get very high resolution e.g. on a 16-bit timer you get 1:65536 better resolution than the interrupt frequency. On the ESP things are a bit more hidden in the IDF code and hacking into the IDF code caused potential problems moving forwards in the IDF version.
I'll try and add a ESP 32 specific property that allows you to set the resolution, I'll also look at the IDF code and see if there is a way to access the internal count registers.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 22
- Joined: Thu Dec 03, 2020 5:21 am
- Has thanked: 1 time
- Been thanked: 1 time
-
- Matrix Staff
- Posts: 1926
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 501 times
- Been thanked: 684 times
Re: Components libraries bugs.
I've had a quick go at adding ESP32 support to the timer component. There is now a new resolution property that appears for the ESP32 that allows you to specify the resolution of the timer in microseconds.
I hope to have a bit of an IDF dig tomorrow so while I'm doing that I'll also see if there are any additional registers I can access to enhance the resolution.
Latest component should now be available via the library update system.
I hope to have a bit of an IDF dig tomorrow so while I'm doing that I'll also see if there are any additional registers I can access to enhance the resolution.
Latest component should now be available via the library update system.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel