MT4V2 Driver Board Tutorial

STM32F103CB + two DRV8262 chips drive 4 DC motors or DC lights · MODBUS RTU dual serial control · beginner-friendly

1. What is this board?

This is a motor / light driver board. Its core is two DRV8262 dual H-bridge driver chips, controlling 4 DC motors simultaneously, or dimming 4 DC lights (LED / halogen).

From your PC you simply send one command over serial (MODBUS protocol) to run a motor forward, reverse, stop, or set a light to 30%, 80%, and so on.

The board offers two serial ports, either one works:

2. Pins & Wiring

2.1 Drive outputs (connect motors / lights)

PurposePinsChannel
Chip1 · Motor 1IN1 = PB0 , IN2 = PB1M1
Chip1 · Motor 2IN3 = PB4 , IN4 = PB5M2
Chip2 · Motor 3IN1 = PA0 , IN2 = PA1M3
Chip2 · Motor 4IN3 = PA2 , IN4 = PA3M4

Connect the two drive wires of each motor to INx / INy. The board automatically drives them with a 20 kHz PWM for speed and direction.

2.2 Current sensing

PurposePinChannel
Motor1 currentchip1_IPROPI1 = PA4M1
Motor2 currentchip1_IPROPI2 = PA5M2
Motor3 currentchip2_IPROPI1 = PA6M3
Motor4 currentchip2_IPROPI2 = PA7M4

2.3 Control & fault pins

FunctionPinDescription
TOFFPC13Off-time / duty clamp config
OCPMPB2Overcurrent blanking time select
nSLEEPPC15Driver enable (low = sleep)
DECAYPB8Decay mode
MODEPB15Control mode
nFAULT1PB12Chip1 fault (active low, readable)
nFAULT2PB14Chip2 fault (active low, readable)

2.4 Serial ports

PurposePinsParameters
RS485 port (UART1)TX=PA9, RX=PA10, dir=PA8 (A/B differential)8N1, baud = factory config (default 38400)
UART3 portTX=PB10, RX=PB11fixed 115200, 8N1

3. Communication setup

Slave address: the board uses a fixed MODBUS slave address of 1. No dip switches are needed.

4. MODBUS register map (important)

This is the core table. Learn it and you can control everything.

RegisterFunctionAccessValue notes
2000Motor M1 speedR/WSigned -100 ~ +100
+ = forward, - = reverse, 0 = stop
2001Motor M2 speedR/W
2002Motor M3 speedR/W
2003Motor M4 speedR/W
2010Motor M1 current (raw ADC)ReadMotor working current
2011Motor M2 currentRead
2012Motor M3 currentRead
2013Motor M4 currentRead
2020Chip1 fault nFAULT1Read1 = fault, 0 = ok
2021Chip2 fault nFAULT2Read1 = fault, 0 = ok
💡 Master enable (soft coil): the board has no hardware enable signal; use MODBUS soft coil 503 as the "master switch".
1. Default after power-up = ON; the MCU checks it every millisecond.
2. Write 503=ON → motors can run; write 503=OFF → all motors forced to stop.
3. This switch does not block communication; you can turn it back on anytime.
Click to see: hex frames for soft coil 503 (addr = 1)
Enable (motors can run): 01 05 01 F7 FF 00 19 FE
Disable (forced stop):   01 05 01 F7 00 00 58 0E
Read enable status:      01 01 01 F7 00 01 68 0E
Speed is a signed 16-bit value. To write a negative value (e.g. -50) you must send its two's complement (-50 = 0xFFCE). HMI/SCADA tools usually handle this automatically; it only matters when typing hex manually.

5. Hands-on practice (step by step)

Step 0: Prepare tools

Step 1: Create a new connection

Create a new connection in Modbus Poll:

Connection > Connect
   Slave ID: 1              (fixed default address)
   Serial port: your COM port
   Baud rate: 115200        (if you use RS485 use 38400 or the factory value)
   Data bits: 8   Parity: None   Stop bits: 1
   Protocol: MODBUS RTU

Step 2: Read registers (confirm it works)

Read 4 registers starting at 2000:

Function (FC): 03  Read Holding Registers
   Starting Address: 2000
   Quantity: 4

If you get back 4 values, communication is OK. Default speed is 0 (motors off).

Step 3: Run motor 1 forward

Write register 2000 with value 50 (50% forward):

FC: 06 Write Single Register
   Register: 2000
   Value: 50

Motor 1 should start running forward at half speed.

Step 4: Reverse, stop, and control the others

What to doWrite registerValue
Motor1 reverse (50%)2000-50
Motor1 stop20000
Motor2 forward 100%2001100
Motor3 forward 30%200230
Motor4 reverse 80%2003-80

Step 5: Brightness control with lights

If you connected DC lights, the speed value becomes "brightness". Write 2000 = 80 for 80% brightness, 0 to switch the light off.

6. Prefer no tools? Send raw hex frames

Use any "serial assistant" in HEX mode and paste one frame below (CRC=Lxx Hxx are the check bytes, already computed). All samples use the fixed address 1.

Motor 1

ActionFull frame (copy & paste)
Forward 50%01 06 07 D0 00 32 2D 58
Reverse 50%01 06 07 D0 FF CE 6C E9
Stop01 06 07 D0 00 00 AC 8D

Motor 2

ActionFull frame
Forward 80%01 06 07 D1 00 50 FD 71

Multiple writes (FC16 bulk write 2000-2001)

ActionFull frame
M1=50 and M2=5001 10 07 D0 00 02 04 00 32 00 32 8A C6

Reads

ActionFull frame
Read 4 speeds (2000-2003)01 03 07 D0 00 04 61 4E
Read 4 currents (2010-2013)01 03 07 DA 00 04 41 4C
Read 2 faults (2020-2021)01 03 07 E4 00 02 A0 82
Reading a hex frame at a glance:
01      06      07D0      0032     — 2D58
Addr    Func    Register   Value    CRC check
The address, function, register, and value are plain data; only the trailing CRC is computed. Tools calculate it for you automatically.

7. FAQ

No response / board does nothing?

Why doesn't writing register 2000 turn the motor on?

The speed register is a "command value" applied to PWM every millisecond. If it doesn't run, check:
1. Enough power (motors need their own supply, not the MCU supply).
2. Soft coil 503 (master enable) is ON (default ON).
3. Read back register 2000 to confirm the write was accepted.

Motor clacks / stalls?

That is usually a PWM duty / configuration issue. Try a smaller speed (e.g. 20%) first, and make sure the motor voltage matches the board supply — avoid over-voltage and over-current.

Reading 2020 / 2021 returns 1?

Fault = 1 means the chip detected overcurrent, overtemperature, or under-voltage. Power off, check the wiring, remove any short, then power back on; once the fault clears, the register returns to 0.

8. Speed value cheat sheet

Desired effectRegister valueTwo's complement (HEX)
0 = stop00000
20% forward200014
50% forward500032
100% forward1000064
50% reverse-50FFCE
100% reverse-100FF9C
💡 Three rules to remember: (1) speed lives in registers 2000-2003, one per motor; (2) + = forward, - = reverse, 0 = stop, range ±100; (3) connect at 115200 with a tool like Modbus Poll and you're in control. Enjoy!