-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
@at-wat PTAL |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
I changed the code base since we decided to use RS485 communication instead. |
closes #29