#1 2018-12-11 11:46:16

bodie
Member
Registered: 2016-12-19
Posts: 10

Rexduino counter problem

Hello,
I am using Rexduino (*.mdl file and three *.ino files from github) in Rexygen and I have problem with counter. I set the pinmode2 to Encoder A, pinmode4 to Encoder B and connected CNB with state on to CNT2E. The incremental encoder is connected to Arduino UNO board, measuring the DC motor. When I set the PWM for motor to constant value, it runs quite constantly. But the output from Arduino UNO mask, CNT2, is updating irregularly.

CNT2_output.png

I checked comm_status, it is 3 without changes. I also tried to increase baudrate from 57600 to 115200 (in REX and Arduino), but without any help. The program runs on Raspberry Pi 1 B+, ticks 0.005 and ntick0 for used task is 2 (so periode of mz task is 10 ms).

Thanks for your help.

Offline

#2 2018-12-13 08:42:27

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 524

Re: Rexduino counter problem

Hi Bodie,
thanks for the detailed description of the problem. Three questions on my mind:

  • Did you also check the err_code and err_subcode outputs? I guess there will be some nonzero values.

  • Can you try rotating the encoder with your hand to avoid noise generated by the motor? Does the problem still occur in such a case?

  • What is the average and maximum execution time of your task?

Kind regards,
Jaroslav

Offline

#3 2018-12-13 11:30:34

bodie
Member
Registered: 2016-12-19
Posts: 10

Re: Rexduino counter problem

Hi Jaroslav,
I checked err_code and err_subcode and there were zeros.
I tried to rotate it manually, but i am not sure if I was able to rotate it with constant speed. Still problems with counter value, see attached picture.
I also attached diagnostic window screen, average time was 3.59 ms and maximum 6.87 ms.

Regards

Bodie

CNT2_output2.png

diagnostic.png

Offline

#4 2018-12-13 13:16:27

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 341

Re: Rexduino counter problem

Hi Bodie,

just to be sure: did you check trend of err_code and err_subcode? Can you also check userRecv output of Arduino subsystem? It should show Arduino internal time.

Regards, Tomas

Offline

#5 2018-12-13 13:56:31

bodie
Member
Registered: 2016-12-19
Posts: 10

Re: Rexduino counter problem

Hi Tomas,
Yes, as you wrote, I checked it in trend.
The userRecv trend is attached, looks like it is rising linearly.

Regards

Bodie

log1.png

Offline

#6 2018-12-17 11:09:17

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 524

Re: Rexduino counter problem

Hi Bodie,
this will need a thorough analysis, at the moment I do not see any potential cause of the problem. Can you please try running your algorithm on a Raspberry Pi 3 and check if the problem persists?

Best regards,
Jaroslav

Offline

Board footer

Powered by FluxBB