1

Topic: Sending sequence of messages as part of state machine

I am trying to initialize and communicate with a electric motor controller on a CAN bus.

The protocol requires me to send and Init sequence of 3 consecutive messages with ID 0x000, length 2 bytes and the following content:
0x000 81 00
0x000 80 00
0x000 01 00
These need to have approx 20-40ms between them.

After these I need to send a Sync message with ID 0x080, length 1 byte and content 00:
So it looks like 0x080 00

I need to repeat the above (Init + Sync) until I receive InitReady message with ID 0x181 and content of 40 00 within it.

After the InitReady I need to only send the Sync message every 500ms and check that the 0x181 (InitReady) message has the 40 00 with it.

If I don't see the InitReady message within 1000ms I revert back to (Init + Sync) as above.

I tried several different strategies, but I think I am missing something.
Here is the cfd file I have made so far.

It seems I have problem syncronizing the ReadyToSend with the 20-40ms timespan between the 0x000 messages.
And from the simulation I can see that I have some issues with retaining the current_msg to the value needed.

Any help is appreciated!

Thank you in advance,
Nikolay

Post's attachments

Attachment icon test_6.cfd 7.83 kb, 185 downloads since 2020-01-19 

2

Re: Sending sequence of messages as part of state machine

Please see attachment:

Post's attachments

Attachment icon c7_motor_ctrl.cfd 4.4 kb, 182 downloads since 2020-01-20