Digital IO read cycle too slow

Recurrent H/W and software problems
Post Reply
agspo
Posts: 3
Joined: Wed Jan 31, 2024 11:37 am
Has thanked: 4 times

Digital IO read cycle too slow

Post by agspo »

I spent days trying to make Annex to read and process a clock/data serial data with a cycle duration of 250us (pulse 100us pause 150us) without any luck. Looks like the ESP32 v3 running Annex RDS is too slow to read this data... any ideas on how to solve this?
I attached screenshots of a simple test program to read data synchronous with the clock signal and change a test output that shows the symptom. The data is on channel A and what the program sees is on B. Clock is identical to data signal on A.
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Digital IO read cycle too slow

Post by cicciocb »

I think that you cannot achieve what you want in that way.
I can implement some functions to do that
agspo
Posts: 3
Joined: Wed Jan 31, 2024 11:37 am
Has thanked: 4 times

Re: Digital IO read cycle too slow

Post by agspo »

Thank you for the reply! Can you suggest any other way to read the data fast enough and decode it later - like iobuffer or similar?
agspo
Posts: 3
Joined: Wed Jan 31, 2024 11:37 am
Has thanked: 4 times

Re: Digital IO read cycle too slow

Post by agspo »

Or maybe some way to increase the interrupt priority to real time? Or similar
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Digital IO read cycle too slow

Post by cicciocb »

I'm actually off so I cannot help you. The idea is to implement a new function, or with SW bitbang or using the SPI as slave
Tinine
Posts: 12
Joined: Thu Apr 01, 2021 6:46 pm
Has thanked: 8 times
Been thanked: 3 times

Re: Digital IO read cycle too slow

Post by Tinine »

I like to stick with the wonderful world of interpreted BASIC but I also need extreme speed sometimes. An interesting approach would be to use the PicoMite as a companion to the Annex32. Thanks to the PIO state-machines, I am now able to interface with high-speed quadrature encoders. I'm not yet writing the actual assembly code myself but there are already some good examples to use as templates. I imagine PicoMite BASIC simply reading the data and sending it to the Annex32 via UARTS.
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Digital IO read cycle too slow

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue May 07, 2024 1:50 pm I like to stick with the wonderful world of interpreted BASIC but I also need extreme speed sometimes. An interesting approach would be to use the PicoMite as a companion to the Annex32. Thanks to the PIO state-machines, I am now able to interface with high-speed quadrature encoders. I'm not yet writing the actual assembly code myself but there are already some good examples to use as templates. I imagine PicoMite BASIC simply reading the data and sending it to the Annex32 via UARTS.
For the quadrature encoders there is a specific function available in annex that rely on the H/W counter.
Is not really documented but you can find the info on the forum.
Edit: details here [Local Link Removed for Guests]
Tinine
Posts: 12
Joined: Thu Apr 01, 2021 6:46 pm
Has thanked: 8 times
Been thanked: 3 times

Re: Digital IO read cycle too slow

Post by Tinine »

This is incredibly 8-)

Just the one encoder though, right?
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Digital IO read cycle too slow

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue May 07, 2024 5:37 pm This is incredibly 8-)

Just the one encoder though, right?
The actual implementation is with only one encoder but the library supports 8 encoders (for the classic ESP32).
Tinine
Posts: 12
Joined: Thu Apr 01, 2021 6:46 pm
Has thanked: 8 times
Been thanked: 3 times

Re: Digital IO read cycle too slow

Post by Tinine »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue May 07, 2024 6:13 pm The actual implementation is with only one encoder.....
How much beer can you drink? :D
Post Reply