cancel
Showing results for 
Search instead for 
Did you mean: 

Command service on Motor control protocol(MCP) with examples

BT.3
Associate II

Hi, I am using L476 controller with MCSDK 6.3.0  to control the BLDC motor, able to control the motor with Motor pilot application. However, i need to control the motor using serial communication IDEs like Realterm or Putty.

I referred the document "Motor Control Protocol Suite" but didnt succeed in understanding and implementing the same. Please share some examples of the commands.

I want to use command service only not the ASPEP. Looking forward for the support as soon as possible.

7 REPLIES 7
STuser2
Senior III

It depends on level of features you need,

Very simple

The UART transmit 8 bits of information you can use any serial port software for transmitting data and define for example

Start of packet data

Bit0:  Value 1 - start

           Value 0 - stop

Byte1 : Torque Value 

Byte2: Speed Value 

End of packet data

Similarly receive data from the MCU and manually check the received bytes for information, like

Motor status:

Motor RPM

That again depends on the number of bytes etc, and you need to update the motor control software.

Very Advanced:

In this it will be a GUI similar to motor pilot and based on the button selection etc it will send commands to motor control unit and receive data. You can define your own protocol.

BT.3
Associate II

Hi,, 

Thanks for the info, but i think you are suggesting me to customize and rewrite the motor control protocol. 

Instead,I want to know the command service already defined in the default program generated using motor control workbench. Please explain with an example like what to send command for "Motor #" , "Command ID" , "Command Payload" as its not clearly defined in the document.

Like for example: 

1.TO GET_MCP_VERSION:        

Motor# : 000

Command ID: 0x0000

Combined command will be : 0x00 0x00 0x00 0x00

Is that so? Please suggest. Thanks in advance.

 

image.png

If you review the below two source files will get fair idea i think.

sync_registers.c and mcp.c file 

BT.3
Associate II

I didnt get " sync_registers.c " file in generated files. Please help me to trace the same.

I am not sure why it is not generated for you, take any example MCSDK project as below

STuser2_0-1768304351199.png

Turn ON the profiler and may be UART and generate the code, you should get it. I am attaching for your reference the file.

 

 

Gael A
ST Employee

Hello BT.3,

sync_registers.c and hf_registers.c have been added in the MCSDK 6.4. For MCSDK 6.3 and older, you can refer to register_interface.c

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.
BT.3
Associate II

I am using MCSDK 6.3, still am unable to decode. I want to change the motor ID, so that i will be able to address the particular motor. 4 motors are connected on single bus.