Error in Simulink when using arduino uno for motor speed reading

9 views (last 30 days)
I am reading the speed of a maxon EC motor (brush less) on simulink using arduino uno. The encoder is mounted on (connected to) my motor. The count per turn for the motor encoder is 8600 (I observed). I am using Simulink of MATLAB R2021b for this purpose. I am using Encoder block for speed reading (count reading). I am using "monitor and tune" to run my motor.
When I am running my motor at very slow speed (less that 50 RPM), then there is no error. But, when I increase the speed of my motor, then simulink shows the following error:
Component:Simulink | Category:Model warning
External Mode Open Protocol CheckData command failed
Caused by:
  • Multiple errors detected.
  • XCP internal error: timeout expired, in response to XCP SYNCH command
  • Error detected while trying to disconnect Simulink from target application.
  • XCP error: XCP internal error: No slave connected
Please help me to solve this problem. I Really need some help!
Arun Kumar
Arun Kumar on 20 Oct 2021
Edited: Arun Kumar on 20 Oct 2021
Hi Aakash,
Have you tried deploying the model and seen behaviour with high motor speeds?
You could use serial transmit block to send the encoder values for testing.
For quick response, please contact MathWorks Technical support.
aakash dewangan
aakash dewangan on 20 Oct 2021
Edited: aakash dewangan on 21 Oct 2021
Thank you very much for response, Arun.
I deployed the model, and there was no error.
I am able to read the speed in simulink at low speeds (example 60 rpm). But when my speed goes beyond 100Rpm (approx. Not know the exact value at which arror starts), then it gives me the error mentioned in my main question.
I tried serial transmit block also, but it did not work. It gives me a new error (without running the block diagram), which is difficult for me to understand.
Could you please suggect me how can i read speed at high speed also Using my block diagram mentioned below. Here k (gain) is beibg used to convert "counts" into "rpm".

Sign in to comment.

Accepted Answer

aakash dewangan
aakash dewangan on 23 Oct 2021
Edited: aakash dewangan on 23 Oct 2021
I found that when i use arduino Uno board for this application (motor speed reading), I get error at around 20000 counts/sec (105rpm).
When i use arduino MKR1010 wifi board for same application, I get error at around 35000 counts/seconds (250rpm).
when i use arduino Due board for same application, I did Not get any error even beyond 1,00,000 counts/secons (800rpm).
SO, my understanding says that this is because of the processing speed/clock speed/speed of external interrupt pins of my arduino.
So, if you have similar problem, try arduino Due, which has 84MHz clock speed (V. good). But, still I don't know the exact answer. Looking for more precise answer.
Hope this will be useful for others.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!