Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heartbeat feature #32

Closed
wants to merge 8 commits into from
Closed

Heartbeat feature #32

wants to merge 8 commits into from

Conversation

DaikiMaekawa
Copy link
Member

closes #29

@DaikiMaekawa DaikiMaekawa requested a review from at-wat February 14, 2019 08:04
@DaikiMaekawa
Copy link
Member Author

@at-wat PTAL

Copy link
Member

@at-wat at-wat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to add Travis setting to build HEARTBEAT enabled version.

@@ -586,7 +586,7 @@ int main()

// Enable watchdog
printf("Watchdog init\n\r");
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDRSTEN | 0xFF00FF; // 1s
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDRSTEN | 0x7d007d0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding, watchdog count clock is 32.768kHz divided by 128 = 256 Hz. (datasheet 15. Watchdog Timer (WDT))
0x7d0 means 7.8 seconds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's my bad. will revert it back.

@@ -655,7 +655,8 @@ int main()
// Driver loop
while (1)
{
AT91C_BASE_WDTC->WDTC_WDCR = 1 | 0xA5000000;
if (!HEARTBEAT)
AT91C_BASE_WDTC->WDTC_WDCR = 1 | 0xA5000000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watchdog timer should be reset automatically before entering servo_level > SERVO_LEVEL_STOP.
Otherwise, the device periodically resets its-self including USB connection which is not good behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's continuously checked in timer0_vel_calc(), right?
so, you mean, it's better to switch servo_level to STOP if heartbeat doesn't arrive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the power on, servo_level goes SERVO_LEVEL_STOP until PC (yp-spur) starts communicating with the device and changes control mode to SERVO_LEVEL_TORQUE or SERVO_LEVEL_VELOCITY.

If watchdog time is not cleared automatically on SERVO_LEVEL_STOP, the device triggers reset for every watchdog duration.
This resets USB connection and make PC difficult to start the communication.

so, you mean, it's better to switch servo_level to STOP if heartbeat doesn't arrive?

That's not what I would like to say in the previous comment.
But It is sounds also good to make the device always under control. (Everything is uncontrollable during reset.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed, I'm gonna stop the motor from the power cycle via a I/O pin. According to the hardware team, a corresponded pin has not been decided yet.

@DaikiMaekawa
Copy link
Member Author

I changed the code base since we decided to use RS485 communication instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add heartbeat input interface
2 participants