Components libraries bugs.

Any bugs you encounter with Flowcode should be discussed here.
djebirmalik
Posts: 22
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 5:21 am
Has thanked: 1 time
Been thanked: 1 time

Re: Components libraries bugs.

Post by djebirmalik »

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.

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: Components libraries bugs.

Post by mnfisher »

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

Xbiotec
Posts: 206
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 34 times
Been thanked: 25 times

Re: Components libraries bugs.

Post by Xbiotec »

Hi
you can also check this prog who is using multitasking of freeRTOS.
it's very fast and accurate too
toggle every 0.5S
Xtask On-Off 1S.fcfx
(17.63 KiB) Downloaded 448 times
toggle every 1ms
Xtask On-Off 1ms.fcfx
(17.62 KiB) Downloaded 478 times
console 3.jpg
console 3.jpg (113.58 KiB) Viewed 4608 times
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

djebirmalik
Posts: 22
Joined: Thu Dec 03, 2020 5:21 am
Has thanked: 1 time
Been thanked: 1 time

Re: Components libraries bugs.

Post by djebirmalik »

Thank you Martin & SEB.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: Components libraries bugs.

Post by medelec35 »

Hello.
Here is my input on this.
The timer interrupt on the ESP32 is different from the PIC version.
For example you can select:
ESP32 Interrupts.png
ESP32 Interrupts.png (7.6 KiB) Viewed 4568 times
It's very accurate.
For a 1 second timer interrupt:
Analyser Waveform.png
Analyser Waveform.png (20.73 KiB) Viewed 4568 times
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

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Components libraries bugs.

Post by BenR »

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.

djebirmalik
Posts: 22
Joined: Thu Dec 03, 2020 5:21 am
Has thanked: 1 time
Been thanked: 1 time

Re: Components libraries bugs.

Post by djebirmalik »

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.
Flowcode1.fcfx

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Components libraries bugs.

Post by BenR »

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.

djebirmalik
Posts: 22
Joined: Thu Dec 03, 2020 5:21 am
Has thanked: 1 time
Been thanked: 1 time

Re: Components libraries bugs.

Post by djebirmalik »

Hi BenR,

Thank you very much in advance.

Cordially.

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: Components libraries bugs.

Post by BenR »

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.

Post Reply