<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									DIY CNC 3D Printer Robot Forum - Recent Posts				            </title>
            <link>https://diycnc.ca/community/</link>
            <description>DIYCNC Customer Support &amp; Tech Sharing for Canadian DIY Hobbyists and Makers.</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 15 Oct 2026 08:48:33 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Interac e-Transfer is supported for Canadian customers</title>
                        <link>https://diycnc.ca/community/main-forum/interac-e-transfer-is-supported-for-canadian-customers/#post-172</link>
                        <pubDate>Sun, 11 Oct 2026 17:00:47 +0000</pubDate>
                        <description><![CDATA[Interac e-Transfer is supported for Canadian customers now. 
Steps:
Step 1. When checking out, select &#039;Direct Bank Transfer Discount&#039; payment option. The discounted amount will be showing ...]]></description>
                        <content:encoded><![CDATA[<p>Interac e-Transfer is supported for Canadian customers now. </p>
<p>Steps:</p>
<p><strong>Step 1. </strong>When checking out, select 'Direct Bank Transfer Discount' payment option. The discounted amount will be showing and Total will be updated. Place Order.</p>
<p><img src="https://diycnc.ca/wp-content/uploads/2026/10/smple-of-bank-transfer.png" /></p>
<p><strong>Step 2. </strong> If you are a registered user, your order will appear under <strong>My Account → Orders.</strong> If you check out as a guest, you will receive an email confirming your order.<br />Your order will be placed <strong>On Hold for 4 hours</strong> while we wait for your bank payment. If we do not receive the payment within this 4-hour window, the order will be automatically cancelled, and the reserved products will be returned to inventory.</p>
<p><strong>Step 3.</strong> Make a payment</p>
<ul>
<li>From your Canadian bank account</li>
<li>Select Interac e-Transer</li>
<li>Recipient Email: <strong>orders@diycnc.ca</strong></li>
<li>Put the order# in the message box. The example below shows the TD Bank e-Transfer page. Other banks and financial institutions may have different interfaces.</li>
</ul>
<p>&nbsp;</p>
<p><img src="https://diycnc.ca/wp-content/uploads/2026/10/smple-of-TD.png" /></p>
<p><strong>Step 4, </strong><span>Once we have received and verified your e-Transfer, your order status will change to </span><strong><span>Processing</span></strong><span>, and you will receive a confirmation email.</span></p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>admin</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/main-forum/interac-e-transfer-is-supported-for-canadian-customers/#post-172</guid>
                    </item>
				                    <item>
                        <title>RE: CAN Bus Communication for Servo**D Series Closed Loop Stepper Driver - STM32 Blue Pill</title>
                        <link>https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servod-series-closed-loop-stepper-driver-stm32-blue-pill/#post-170</link>
                        <pubDate>Sat, 12 Sep 2026 04:01:19 +0000</pubDate>
                        <description><![CDATA[Speed mode:
#define SERVO42D_SPEED_MODE 0xF6


void Servo42D_RunSpeed(void)
{
 TxHeader.StdId=SERVO42D_ID;
 TxHeader.ExtId=0;
 TxHeader.IDE=CAN_ID_STD;
 TxHeader.RTR=CAN_RTR_DATA;
...]]></description>
                        <content:encoded><![CDATA[<p>Speed mode:</p>
<p><span style="background-color: #ffffff;padding: 0px 0px 0px 2px"><span style="color: #000000;background-color: #ffffff;font-size: 10pt"><span style="color: #7f0055;font-weight: bold">#define</span><span style="color: #000000"> SERVO42D_SPEED_MODE 0xF6</span></span></span></p>
<div style="background-color: #ffffff;padding: 0px 0px 0px 2px">
<div style="color: #000000;background-color: #ffffff;font-size: 10pt">
<p style="margin: 0"><span style="color: #7f0055;font-weight: bold">void</span><span style="color: #000000"> </span><span style="color: #000000;font-weight: bold">Servo42D_RunSpeed</span><span style="color: #000000">(</span><span style="color: #7f0055;font-weight: bold">void</span><span style="color: #000000">)</span></p>
<p style="margin: 0"><span style="color: #000000">{</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">StdId</span><span style="color: #000000">=SERVO42D_ID;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">ExtId</span><span style="color: #000000">=0;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">IDE</span><span style="color: #000000">=CAN_ID_STD;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">RTR</span><span style="color: #000000">=CAN_RTR_DATA;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">DLC</span><span style="color: #000000">=5;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxHeader.</span><span style="color: #0000c0">TransmitGlobalTime</span><span style="color: #000000">=</span><span style="color: #0000c0;font-style: italic">DISABLE</span><span style="color: #000000">;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #3f7f5f">// Speed Mode</span></p>
<p style="margin: 0"><span style="color: #000000"> TxData=SERVO42D_SPEED_MODE;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxData=0x01;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxData=0x40;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxData=0x02;</span></p>
<p style="margin: 0"><span style="color: #000000"> TxData=(SERVO42D_ID+TxData+TxData+TxData+TxData)&amp;0xFF;</span></p>
<p style="margin: 0"><span style="color: #000000"> </span><span style="color: #7f0055;font-weight: bold">if</span><span style="color: #000000">(HAL_CAN_AddTxMessage(&amp;hcan,&amp;TxHeader,TxData,&amp;TxMailbox)!=</span><span style="color: #0000c0;font-style: italic">HAL_OK</span><span style="color: #000000">)</span></p>
<p style="margin: 0"><span style="color: #000000"> {</span></p>
<p style="margin: 0"><span style="color: #000000"> Error_Handler();</span></p>
<p style="margin: 0"><span style="color: #000000"> }</span></p>
<p style="margin: 0"><span style="color: #000000">}</span></p>
<p style="margin: 0"> </p>
</div>
</div>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servod-series-closed-loop-stepper-driver-stm32-blue-pill/#post-170</guid>
                    </item>
				                    <item>
                        <title>CAN Bus Communication for Servo**D Series Closed Loop Stepper Driver - STM32 Blue Pill</title>
                        <link>https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servod-series-closed-loop-stepper-driver-stm32-blue-pill/#post-169</link>
                        <pubDate>Sat, 12 Sep 2026 04:00:31 +0000</pubDate>
                        <description><![CDATA[Servo42D/57D supports position mode and Speed mode. On Position Mode, the Position Mode includes absolute position and relative position. 
The code below shows the Relative Position motion ...]]></description>
                        <content:encoded><![CDATA[<p><img src="https://diycnc.ca/wp-content/uploads/2026/09/stm32-mks-servo-kit-1.png" /></p>
<p>Servo42D/57D supports position mode and Speed mode. On Position Mode, the Position Mode includes absolute position and relative position. </p>
<p>The code below shows the Relative Position motion baccording to pulse number (page 78 on CAN User Manual)</p>
<pre contenteditable="false">#define SERVO42D_SPEED_MODE 0xF6

void Servo42D_RunPosition(void)
{
  TxHeader.StdId=SERVO42D_ID;
  TxHeader.ExtId=0;
  TxHeader.IDE=CAN_ID_STD;
  TxHeader.RTR=CAN_RTR_DATA;
  TxHeader.DLC=8;
  TxHeader.TransmitGlobalTime=DISABLE;

  TxData=SERVO42D_POSITION_MODE1;
  TxData=0x00;
  TxData=0x3C;
  TxData=0x02;
  TxData=0x00;
  TxData=0x00;
  TxData=0x64;
  TxData=(SERVO42D_ID+TxData+TxData+TxData+TxData+TxData+TxData+TxData)&amp;0xFF;


  if(HAL_CAN_AddTxMessage(&amp;hcan,&amp;TxHeader,TxData,&amp;TxMailbox)!=HAL_OK)
  {
    Error_Handler();
  }
}
</pre>
<p>&nbsp;</p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servod-series-closed-loop-stepper-driver-stm32-blue-pill/#post-169</guid>
                    </item>
				                    <item>
                        <title>RE: CAN Bus Communication for Servo 28D/35D/42D/57D Series Closed Loop Stepper Driver - STM32 Blue Pill</title>
                        <link>https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver-stm32-blue-pill/#post-168</link>
                        <pubDate>Wed, 09 Sep 2026 18:11:06 +0000</pubDate>
                        <description><![CDATA[Case 1, get motor Mode status. Using this testing to verify the communication between STM32 Blue Pill, MCP2551 and Servo42D via CAN.
#include &quot;main.h&quot;

/* Private variables --------------...]]></description>
                        <content:encoded><![CDATA[<p>Case 1, get motor Mode status. Using this testing to verify the communication between STM32 Blue Pill, MCP2551 and Servo42D via CAN.</p>
<pre contenteditable="false">#include "main.h"

/* Private variables ---------------------------------------------------------*/
CAN_HandleTypeDef hcan;

/* USER CODE BEGIN PV */

#define SERVO42D_ID 0x01
#define SERVO42D_READ 0x00
#define SERVO42D_WORK_MODE 0x82
CAN_TxHeaderTypeDef TxHeader;
CAN_RxHeaderTypeDef RxHeader;
uint8_t TxData;
uint8_t RxData;
uint32_t TxMailbox;
uint8_t ServoMode=0xFF;

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_CAN_Init(void);
/* USER CODE BEGIN PFP */

void Servo42D_ReadWorkMode(void);

int main(void)
{

  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();
  MX_CAN_Init();
  if(HAL_CAN_Start(&amp;hcan)!=HAL_OK)
  {
      Error_Handler();
  }
  while (1)
  {
    /* USER CODE END WHILE */
	  Servo42D_ReadWorkMode();
	  HAL_Delay(100);
	  if(HAL_CAN_GetRxFifoFillLevel(&amp;hcan,CAN_RX_FIFO0)&gt;0)
	  {
		  if(HAL_CAN_GetRxMessage(&amp;hcan,CAN_RX_FIFO0,&amp;RxHeader,RxData)==HAL_OK)
		  {
			  if(RxHeader.StdId==SERVO42D_ID&amp;&amp;RxHeader.DLC==3&amp;&amp;RxData==SERVO42D_WORK_MODE)
			  {
				  uint8_t crc=(SERVO42D_ID+RxData+RxData)&amp;0xFF;
				  if(RxData==crc)
				  {
					  ServoMode=RxData;
				  }
			  }
		  }
	  }
	  HAL_Delay(900);
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
  if (HAL_RCC_OscConfig(&amp;RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&amp;RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  {
    Error_Handler();
  }
}

/**
  * @brief CAN Initialization Function
  * @param None
  * @retval None
  */
static void MX_CAN_Init(void)
{

  hcan.Instance = CAN1;
  hcan.Init.Prescaler = 4;
  hcan.Init.Mode = CAN_MODE_NORMAL;
  hcan.Init.SyncJumpWidth = CAN_SJW_1TQ;
  hcan.Init.TimeSeg1 = CAN_BS1_15TQ;
  hcan.Init.TimeSeg2 = CAN_BS2_2TQ;
  hcan.Init.TimeTriggeredMode = DISABLE;
  hcan.Init.AutoBusOff = DISABLE;
  hcan.Init.AutoWakeUp = DISABLE;
  hcan.Init.AutoRetransmission = DISABLE;
  hcan.Init.ReceiveFifoLocked = DISABLE;
  hcan.Init.TransmitFifoPriority = DISABLE;
  if (HAL_CAN_Init(&amp;hcan) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN CAN_Init 2 */
  CAN_FilterTypeDef CAN_Filter;
  CAN_Filter.FilterBank=0;
  CAN_Filter.FilterMode=CAN_FILTERMODE_IDMASK;
  CAN_Filter.FilterScale=CAN_FILTERSCALE_32BIT;
  CAN_Filter.FilterIdHigh=(SERVO42D_ID&lt;&lt;5);
  CAN_Filter.FilterIdLow=0;
  CAN_Filter.FilterMaskIdHigh=(0x7FF&lt;&lt;5);
  CAN_Filter.FilterMaskIdLow=0;
  CAN_Filter.FilterFIFOAssignment=CAN_FILTER_FIFO0;
  CAN_Filter.FilterActivation=ENABLE;
  CAN_Filter.SlaveStartFilterBank=14;
  if(HAL_CAN_ConfigFilter(&amp;hcan,&amp;CAN_Filter)!=HAL_OK)
  {
      Error_Handler();
  }
  /* USER CODE END CAN_Init 2 */

}

static void MX_GPIO_Init(void)
{

  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();

}

/* USER CODE BEGIN 4 */
void Servo42D_ReadWorkMode(void)
{
    TxHeader.StdId=SERVO42D_ID;
    TxHeader.ExtId=0;
    TxHeader.IDE=CAN_ID_STD;
    TxHeader.RTR=CAN_RTR_DATA;
    TxHeader.DLC=3;
    TxHeader.TransmitGlobalTime=DISABLE;
    TxData=SERVO42D_READ;
    TxData=SERVO42D_WORK_MODE;
    TxData=(SERVO42D_ID+TxData+TxData)&amp;0xFF;
    HAL_CAN_AddTxMessage(&amp;hcan,&amp;TxHeader,TxData,&amp;TxMailbox);
}
/* USER CODE END 4 */

/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void)
{
  __disable_irq();
  while (1)
  {
  }
  /* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
void assert_failed(uint8_t *file, uint32_t line)
{
}
#endif /* USE_FULL_ASSERT */
</pre>
<p>&nbsp;</p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver-stm32-blue-pill/#post-168</guid>
                    </item>
				                    <item>
                        <title>CAN Bus Communication for Servo 28D/35D/42D/57D Series Closed Loop Stepper Driver - STM32 Blue Pill</title>
                        <link>https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver-stm32-blue-pill/#post-167</link>
                        <pubDate>Wed, 09 Sep 2026 17:57:01 +0000</pubDate>
                        <description><![CDATA[Hardware: MKS Servo42D Closed Loop Driver with CAN communication, MCP2551, STM32F103C8Tx Blue Pill
Referring:
Software enviroment: STM32CubeIDE, STM32CubeMX
STM32F103C8Tx Blue Pill Pins Co...]]></description>
                        <content:encoded><![CDATA[<p>Hardware: MKS Servo42D Closed Loop Driver with CAN communication, MCP2551, STM32F103C8Tx Blue Pill</p>
<p>Referring: https://community.st.com/stm32-mcus-60/using-can-bxcan-in-normal-mode-with-stm32-microcontrollers-part-1-151183</p>
<p>Software enviroment: STM32CubeIDE, STM32CubeMX</p>
<p>STM32F103C8Tx Blue Pill Pins Configuration va STM32CubeMX:</p>
<p>&nbsp;</p>
<div><img style="margin-left: auto;margin-right: auto" src="/wp-content/uploads/wpforo/default_attachments/1788976621-STM32BluePill-MX.png" width="500" /></div>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver-stm32-blue-pill/#post-167</guid>
                    </item>
				                    <item>
                        <title>CAN Bus Communication for Servo 28D/35D/42D/57D Series Closed Loop Stepper Driver</title>
                        <link>https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver/#post-166</link>
                        <pubDate>Sun, 06 Sep 2026 15:32:56 +0000</pubDate>
                        <description><![CDATA[Case 1,  Single Drive over CAN Bus
Hardware:  Nema17 with Servo42D, MKS CANable V2.0 USB-CAN, 12V DC Power Power Supply
Wiring: Refer gitbub user manual: Github User Manual, (Note: MKS_Ser...]]></description>
                        <content:encoded><![CDATA[<p><strong>Case 1,  Single Drive over CAN Bus</strong></p>
<p>Hardware:  <a href="https://diycnc.ca/product/makerbase-mks-servo42d-nema17-closed-loop-stepper-motor-driver/" target="_blank" rel="noopener">Nema17 with Servo42D</a>, <a href="https://diycnc.ca/product/usb-rs485-can-driver/" target="_blank" rel="noopener">MKS CANable V2.0 USB-CAN</a>, 12V DC Power Power Supply</p>
<p>Wiring: Refer gitbub user manual: <a href="https://github.com/makerbase-motor/MKS-SERVO42D-57D/blob/master/User%20Manual/V1.0.9/MKS%20SERVO42%2657D_CAN%20User%20Manual%20V1.0.9.pdf" target="_blank" rel="noopener">Github User Manual</a>, (Note: MKS_ServoD_Control software is not suitable for testing the CAN bus, use CNGaroo or Python)</p>
<p><strong>Step one: </strong> Test the communication, Here, I am using Python to do the test, without using software tool such as CANgaroo.</p>
<ul>
<li>Use USB cable connect the CANable adaper to PC</li>
<li>Use three dopont wires to connect CANable adaper and MKS Servo42D Motor Driver(CAN-H, CAN-L and GRD)</li>
<li>12V DC Power to Servo42D Motor Driver</li>
<li>The following code to test the communication, only CAN ID received is successful. </li>
</ul>
<pre contenteditable="false">import can
import time

bus = can.Bus(
    interface="slcan",
    channel="COM5",       # change to your COM port
    bitrate=500000
)

print("CAN bus opened")

# Send Servo42D encoder request
msg = can.Message(
    arbitration_id=0x01,
    data=,
    is_extended_id=False
)

print("Sending:", msg)
bus.send(msg)

print("Waiting for response...")

# Listen for up to 3 seconds
start = time.time()

while time.time() - start &lt; 3:
    response = bus.recv(timeout=0.5)

    if response is not None:
        print("RECEIVED:", response)
        print("ID:", hex(response.arbitration_id))
        print("DATA:", response.data.hex(" ").upper())
        print("DLC:", response.dlc)

print("Done")

bus.shutdown()</pre>
<p><strong>Step two, </strong> Run the motor.  </p>
<p>The following code will control the stepper motor by selecting its direction and speed:</p>
<pre contenteditable="false"># MKS Servo42D/57D CAN Bus Testing

import can
import time

# =========================
# CAN configuration
# =========================
COM_PORT = "COM5"       # &lt;-- change this based on your USB Port
CAN_BITRATE = 500000
CAN_ID = 0x01

# =========================
# Open CAN bus
# =========================
bus = can.Bus(
    interface="slcan",
    channel=COM_PORT,
    bitrate=CAN_BITRATE
)

print("CAN bus opened")
print(f"Port: {COM_PORT}")
print(f"CAN ID: 0x{CAN_ID:X}")
print(f"Bitrate: {CAN_BITRATE}")
print()


# =========================
# Send CAN frame
# =========================
def send(data):
    msg = can.Message(
        arbitration_id=CAN_ID,
        data=data,
        is_extended_id=False
    )

    print("TX:", " ".join(f"{x:02X}" for x in data))

    try:
        bus.send(msg)
    except can.CanError as e:
        print("CAN ERROR:", e)


# =========================
# Read CAN response
# =========================
def receive(timeout=1.0):
    msg = bus.recv(timeout=timeout)

    if msg is None:
        print("RX: no response")
        return None

    print(
        f"RX ID: 0x{msg.arbitration_id:X}  "
        f"DATA: {msg.data.hex(' ').upper()}  "
        f"DLC: {msg.dlc}"
    )

    return msg

# =========================
# Enable motor
# =========================
def enable():
    # F3 01 + checksum F5
    send()
    receive()


# =========================
# Disable motor
# =========================
def disable():
    # F3 00 + checksum F4
    send()
    receive()


# =========================
# Read encoder
# =========================
def read_encoder():
    # 30 31
    send()
    receive()


# =========================
# Speed command
# =========================
def speed_command(rpm, direction=0, acceleration=2):

    if rpm &lt; 0:
        rpm = -rpm
        direction = 1

    if rpm &gt; 2047:
        print("RPM too high")
        return

    # 12-bit speed value
    speed = int(rpm)

    high = (speed &gt;&gt; 8) &amp; 0x0F
    low = speed &amp; 0xFF

    # Bit 7 = direction
    if direction:
        high |= 0x80

    # Calculate checksum
    checksum = (
        CAN_ID +
        0xF6 +
        high +
        low +
        acceleration
    ) &amp; 0xFF

    data = 

    send(data)


# =========================
# Stop motor
# =========================
def stop():
    # F6 00 00 00 + checksum
    checksum = (
        CAN_ID +
        0xF6
    ) &amp; 0xFF

    send()

    receive()


# =========================
# Main menu
# =========================
try:

    while True:

        print()
        print("============================")
        print(" MKS SERVO42D CAN TEST")
        print("============================")
        print("1 - Enable motor")
        print("2 - Disable motor")
        print("3 - Read encoder")
        print("4 - CW 100 RPM")
        print("5 - CCW 100 RPM")
        print("6 - CW 300 RPM")
        print("7 - CCW 300 RPM")
        print("8 - STOP")
        print("9 - Exit")
        print("============================")

        choice = input("Select: ")
        if choice == "1":
            enable()

        elif choice == "2":
            disable()

        elif choice == "3":
            read_encoder()

        elif choice == "4":
            speed_command(100, direction=0)

        elif choice == "5":
            speed_command(100, direction=1)

        elif choice == "6":
            speed_command(300, direction=0)

        elif choice == "7":
            speed_command(300, direction=1)

        elif choice == "8":
            stop()

        elif choice == "9":
            stop()
            break

        else:
            print("Invalid selection")

finally:
    bus.shutdown()
    print("CAN bus closed")</pre>
<p>&nbsp;</p>
<p><strong>Notes: If the communication cannot be created between CANable Adapter and Servo42D, check the resister (120 Ω) either in adapter or Servo42D board, at leaset one resistor should be connected for the single master motor. </strong></p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/can-bus-communication-for-servo-28d-35d-42d-57d-series-closed-loop-stepper-driver/#post-166</guid>
                    </item>
				                    <item>
                        <title>MKS Servo42D Servo57D Stepper Motor Technical Support</title>
                        <link>https://diycnc.ca/community/makerbase-products/mks-servo42d-servo57d-stepper-motor-technical-support/#post-165</link>
                        <pubDate>Sat, 05 Sep 2026 01:11:42 +0000</pubDate>
                        <description><![CDATA[One of the popular products, I want to use this topic to answer any questions.]]></description>
                        <content:encoded><![CDATA[<p>One of the popular products, I want to use this topic to answer any questions. </p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>T Zhao</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/makerbase-products/mks-servo42d-servo57d-stepper-motor-technical-support/#post-165</guid>
                    </item>
				                    <item>
                        <title>LinuxCNC Projects</title>
                        <link>https://diycnc.ca/community/cnc-build-logs/linuxcnc-projects/#post-164</link>
                        <pubDate>Mon, 31 Aug 2026 05:12:49 +0000</pubDate>
                        <description><![CDATA[Creating two LinuxCNC project:  1) EtherCAT Drive Servo Motors, 2) CANOpen Closed Loop. Putting the list below:



 
EtherCAT Pro Kit
CANOpen Learning Kit
Notes


1
Raspberry Pi 4...]]></description>
                        <content:encoded><![CDATA[<p>Creating two LinuxCNC project:  1) EtherCAT Drive Servo Motors, 2) CANOpen Closed Loop. Putting the list below:</p>
<table class="bridata-table" width="682">
<tbody>
<tr>
<td width="64"> </td>
<td width="106">EtherCAT Pro Kit</td>
<td width="141">CANOpen Learning Kit</td>
<td width="371">Notes</td>
</tr>
<tr>
<td>1</td>
<td>Raspberry Pi 4B</td>
<td>Raspberry Pi 4B</td>
<td>4G, Case, 32G MicoSD, Preinstalled and configure LinuxCNC</td>
</tr>
<tr>
<td>2</td>
<td>7" Touch Screen</td>
<td>7" Touch Screen</td>
<td>Capacitive IPS</td>
</tr>
<tr>
<td>3</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>4</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>5</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>6</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>7</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>8</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>9</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>10</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>11</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>12</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>13</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>14</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>15</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>16</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>17</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>18</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>19</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>20</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>21</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>22</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>23</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>24</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>25</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>Ray</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/cnc-build-logs/linuxcnc-projects/#post-164</guid>
                    </item>
				                    <item>
                        <title>VFD Spindle Technical Support</title>
                        <link>https://diycnc.ca/community/technical-questions/vfd-spindle-technical-support/#post-163</link>
                        <pubDate>Sun, 30 Aug 2026 13:27:00 +0000</pubDate>
                        <description><![CDATA[VFD Spindle Technical Support]]></description>
                        <content:encoded><![CDATA[<p>VFD Spindle Technical Support</p>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>Ray</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/technical-questions/vfd-spindle-technical-support/#post-163</guid>
                    </item>
				                    <item>
                        <title>RE: Interface and Communication Tech Discussion</title>
                        <link>https://diycnc.ca/community/product-questions-and-technical-exchange/interface-and-communication-tech-discussion/#post-162</link>
                        <pubDate>Sat, 29 Aug 2026 16:29:16 +0000</pubDate>
                        <description><![CDATA[SKU: 27322.
MCP2518FD Module SPI to CANFD Controller User Manual
&nbsp;MCP2518FD.pdf]]></description>
                        <content:encoded><![CDATA[<p>SKU: 27322.</p>
MCP2518FD Module SPI to CANFD Controller User Manual
<p>https://diycnc.ca/product/mcp2518fd-module-spi-to-canfd-controller-8-mbps/</p>
<div id="wpfa-27327" class="wpforo-attached-file"><a class="wpforo-default-attachment" href="//diycnc.ca/wp-content/uploads/wpforo/default_attachments/1788020956-MCP2518FD.pdf" target="_blank" title="MCP2518FD.pdf"><i class="fas fa-paperclip"></i>&nbsp;MCP2518FD.pdf</a></div>]]></content:encoded>
						                            <category domain="https://diycnc.ca/community/"></category>                        <dc:creator>Ray</dc:creator>
                        <guid isPermaLink="true">https://diycnc.ca/community/product-questions-and-technical-exchange/interface-and-communication-tech-discussion/#post-162</guid>
                    </item>
							        </channel>
        </rss>
		