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

MotorSerial::transmitCommands uses a hard coded 2 millisec delay for MCB groups of commands #91

Open
mjstn opened this issue Jul 3, 2020 · 2 comments
Assignees

Comments

@mjstn
Copy link
Contributor

mjstn commented Jul 3, 2020

Found this deep in the mud. We can be jamming commands down the throat of the MCB faster than it can process them in all cases of worse case delay. This is likley 'part' of something that was recently discussed as a reliability issue by a user of our code on a different platform than the raspberry Pi platform. In any case this should be fixed to avoid message overrun on mcb.

@mjstn mjstn self-assigned this Jul 17, 2020
@mjstn
Copy link
Contributor Author

mjstn commented Jul 17, 2020

Here is what will be tried first for a robust yet time-out-able protocol that will be backward compatible with old firmware.

The ACK Protocol. Here is what I am coding now

  • The raw message will be changed in a sort of backwards compatible way. The upper bit of the byte that holds the register number will be a 'MCB is still busy' bit. Older code will just work because it will NEVER reply as busy. Only v38 and beyond will be setting the bit.

  • The motor_hardware layer will keep a mcbBusy state that on every reception of every message be it status or a query this mcbBusy will be set or cleared.

  • Every message sent to the MCB will set the mcbBusy bit as message is sent to MCB
    host code will have a common new transmitMcbCommand call in MotorHardware. This call will not send any new serial command out unless motor_hardware mcbBusy is reset

  • The new transmitMcbCommand layer will timeout and clear mcbBusy and just send the darn message if it has been something like 200msec and mcb is still seemign to be busy. We better do this till this protocol is proven.

@mjstn
Copy link
Contributor Author

mjstn commented Jul 19, 2020

As of today I have in branch addMcbMessageAck a good 1st cut attempt to solve 95% or more of issues.
My goal at this time is to have host side code that will function and improve things even with prior firmware.
Then firmware can also be helping this situation with perhaps v38 by setting a busy bit.
At this time host code on any read will set a 'mcb busy' condition upon and sending of a read query to the MCB.
The host will on any read look at the new mcb is busy bit which is the upper 0x80 bit of register byte.
Host will set no longer busy if it sees this bit clear. This is 1/2 of a formal solid solution.
After v38 we will have MCB report this bit back to host for each reply. To use v38 host code MUST be current so we can mask off register byte with 0x7F. So we will send out host code first then REQUIRE host upgrade for usage of v38.

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

No branches or pull requests

1 participant