Cannot read encoder ticks that fast
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have an encoder that gives me 2150 ticks per revolution. I am trying to control the position. If the motor goes slow, it functions just fine, but I need it to go faster, when I try this, I stop reading the encoder correctly, like it's missing ticks. I am already at 0.00001s as sample time, which I think it's already quite small, but it is still not enough. Any recommendations? Thanks!
4 Commenti
Walter Roberson
il 4 Nov 2022
Unfortunately I do not know anything about that blockset, other than what I see at https://link.springer.com/chapter/10.1007/978-3-031-79927-3_2
Looking at https://www.mathworks.com/matlabcentral/fileexchange/50373-stm32f4-discovery-board-programming-with-embedded-coder it looks like a USB cable is used to program the board.
However, I see there mention of "USB to TTL serial adapter - * Rx goes to PA2 * Tx goes to PA3". That hints to me that the board itself might have an actual TTL serial port. If so, then if you could connect that to a true serial port on your host (not a TTL to USB connection) then that would have the potential to talk to the board with lower latency.
Based on what people have done with other boards such as Arduino, I would suspect that you would be better off having code running on the board that does the counting for you, only sending summary or occasional information to the MATLAB host. But I do not know that particular blockset: some blocksets are designed to be deployed to boards like these, that might possibly already be what is happening.
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!