Troubleshooting
Control a Modbus drive from a PLC over PROFIBUS DP
Short answer
Yes — a PROFIBUS DP master controls a Modbus-only drive through a protocol-converting gateway, and the gateway, not the drive, is the DP slave. It works when the gateway runs DP slave plus Modbus RTU master, the drive is in Modbus mode with fieldbus command source, the GSD module lengths match the mapping, the register map is byte-order tested, and the PLC sequences the control word with a defined bus-loss stop.
On this page
- The five checks at a glance
- The gateway must be DP slave and Modbus RTU master at once
- Set the drive to Modbus and hand it the command
- Configure the DP master with the gateway's GSD file
- Map the registers before your first write
- Worked example: sending 50.00 Hz
- Sequence the control word and decide the bus-loss stop
- The decision, case by case
- Questions asked
Yes — a PLC with an onboard PROFIBUS DP master port, an S7-300 model such as the 313C-2DP, can control a Modbus-only drive such as a SINAMICS G120C with the combined USS/Modbus serial port. The PROFIBUS slave station in the DP master's hardware configuration is the protocol-converting gateway itself, imported from the gateway's own GSD file; the drive never appears on PROFIBUS. On the serial side the gateway runs as a Modbus RTU master, and the drive must be switched to Modbus with its command and setpoint sources on that link. When the drive ignores the PLC, one of five checks is failing, and each check rules out a different fault.
The five checks at a glance #
Run them in this order; each one decides a distinct failure:
- Roles. The gateway must be a PROFIBUS DP slave toward the PLC and a Modbus RTU master toward the drive, at the same time.
- Drive mode. The serial port is set to Modbus — not USS — with matched baud, parity, stop bits and slave address, and the command and setpoint sources pointing at the serial link.
- DP configuration. The gateway's GSD file, a unique station address, and a cyclic input/output module whose byte counts match the gateway's mapping size.
- Register map. Control word, speed setpoint, status word and actual value at the addresses the drive's register list gives, with the right function codes and byte order.
- Program logic. A control-word sequence the drive's state machine accepts, and a defined stop when communication drops.
The gateway must be DP slave and Modbus RTU master at once #
A Modbus RTU drive is a slave: it only answers. The converter between the buses therefore needs a Modbus RTU master role on the drive side and a DP slave role toward the PLC, simultaneously. The PLC side is cyclic: the DP master exchanges the configured input and output bytes every bus cycle. The Modbus side is transactional: the gateway issues reads and writes with function codes 03 and 04 to read and 06 and 16 to write, and waits for each response. The gateway decides when a changed PLC output becomes a serial write, so the two sides update asynchronously, and the PROFIBUS cycle time tells you nothing about the drive's update rate.
Check the mapping style too: the gateway must link its cyclic I/O image to ordinary Modbus register and coil commands. A box that only tunnels proprietary messages needs its own documented method instead of the register mapping below.
Decision: read the gateway data sheet. DP slave plus Modbus RTU master at once means the box is right; anything else is the wrong box, and no PLC program changes that.
Set the drive to Modbus and hand it the command #
USS and Modbus are separate protocols sharing one set of terminals; selecting one does not make the port answer the other. On a drive marked USS/MB, switch the serial protocol to Modbus in the drive's commissioning settings and apply the restart the drive manual calls for.
- Match the serial settings at both ends: baud rate, parity, stop bits, and the gateway's Modbus slave ID equal to the drive's station address. The Modbus over Serial Line specification's default of 19200 baud, 8 data bits, even parity and 1 stop bit is a starting point, not a requirement — the two ends must match each other, and a parity mismatch alone produces zero responses.
- Point the drive's command source and speed-setpoint source at the serial link. A drive can answer Modbus reads all day and still refuse to start from them while its run command comes from the terminals.
Decision: reads succeed but the drive never runs — the protocol is right and the command source is not. Change the source, not the cable.
Configure the DP master with the gateway's GSD file #
PROFIBUS DP (standardized in IEC 61158) lets the master's configuration tool learn each slave from a GSD file that the slave's manufacturer publishes. Install the gateway manufacturer's GSD in STEP 7's hardware configuration and import the gateway as a DP slave at its set station address, unique on the bus. The GSD must describe the gateway, because the gateway is the station the PLC sees; a drive's GSD describes a different device.
From the GSD's module list, select the module whose cyclic input and output byte counts equal the mapping size configured in the gateway. Then:
- Keep the module's addresses inside the S7-300's process image, with no overlap; the repair for a detected PROFIBUS gateway that reads no I/O data is usually exactly this address range.
- Match the module's consistency: word-length modules can be moved in the process image, while longer consistent blocks must go through the consistent-transfer system functions SFC 14 (DPRD_DAT) and SFC 15 (DPWR_DAT).
- Open the CPU diagnostic buffer and confirm the slave exchanges data with no station or configuration fault before touching a register.
Decision: an absent station means address, termination or cabling; a present station with garbled data means the GSD module and the gateway mapping disagree.
Map the registers before your first write #
Four signals carry the whole job, and the drive's register list gives each one an address, a width, a scale and a permission:
| Signal | Direction | Modbus function | First test |
|---|---|---|---|
| Control word 1 (STW1) | PLC writes | 06 or 16 | Write the off/ready state, watch the status word |
| Speed setpoint | PLC writes | 06 or 16 | Write a value whose two bytes differ |
| Status word | PLC reads | 03 | It changes on stop and start |
| Actual value | PLC reads | 03 | It matches the drive display after scaling |
Watch the address convention: register lists often print a documentation-style number next to the zero-based address the wire expects, and a wrong base lands on the wrong register or reads across a map gap — the case in Modbus exception 02 when a read crosses a register-map gap. Check byte order as well, because gateways differ in the word and byte order they apply to 16-bit values, and a swapped value still passes a zero test.
Decision: a rejected write points at permission or function code; a value that arrives wrong points at address base or byte order.
Worked example: sending 50.00 Hz #
Assume the register list defines the speed setpoint as a signed integer at 0.01 Hz per bit — a common drive convention, but confirm the resolution your own list documents before reusing these numbers. The machine needs 50.00 Hz:
- 50.00 Hz ÷ 0.01 Hz per bit = 5000 counts = 0x1388.
- The bytes differ (0x13 and 0x88), so a swap cannot hide. If the gateway swaps them, the drive receives 0x8813 = 34835 counts × 0.01 Hz = 348.35 Hz — far above any real setpoint, so the drive rejects or clamps the value and the mistake surfaces on the first write.
- With the order correct, the drive display shows 50.00 Hz and the actual value reads back 5000.
Now check the pace. Under the Modbus over Serial Line framing at 19200 baud with 8 data bits, even parity and 1 stop bit, one character is 11 bits, so a character takes 11 ÷ 19200 bits/s = 0.573 ms.
- A function 06 frame is 8 bytes — address, function, register, value, CRC — so request and response each take 8 × 0.573 ms = 4.58 ms, plus the 3.5-character silence of about 2 ms before each frame; one setpoint write is roughly 13 ms on the wire.
- The status word therefore lags the control word by at least one transaction. Gate the logic on the status word instead of expecting the drive state to change within the same scan as the command; the same transaction-per-update arithmetic is what makes drive polling on one Modbus RTU serial port slow down as drives are added.
Sequence the control word and decide the bus-loss stop #
The drive's communication manual defines the transition order of control word 1 (STW1). On the G-family the documented start is 0x047E — off, ready, control from the network — held until the status word reports the matching ready state, then 0x047F, which adds the ON bit. Jumping straight to the ON bit from a cold start is the classic answers-but-never-runs bug. The same word carries the fault-reset bit, used after a fault and again confirmed in the status word; step through states only as the status word confirms each one.
Program the loss branch deliberately: when the DP slave drops out, when the gateway's exchange flag stops refreshing, or when Modbus transactions fail, write the stop state to STW1 and hold the drive inhibited until the status word confirms a ready state again. A zero setpoint is not a stop — it only ramps the speed to zero while the drive stays enabled. The write-ordering discipline in the fix for missing setpoint and control-word writes to a PROFIBUS drive applies here with the protocol translated.
One safety line: the OFF states in STW1 are operating stops, not a safety function. A required safe stop belongs on the drive's documented STO safety inputs, wired and validated per its safety documentation.
The decision, case by case #
- Gateway does DP slave and Modbus RTU master together: the box is right; configure it.
- Gateway is DP master, or Modbus slave only: replace it — roles cannot be programmed around.
- No DP station in the diagnostic buffer: fix PROFIBUS address, termination or cabling before any Modbus setting.
- DP data present but garbled: match the GSD module lengths to the gateway mapping and check process-image addresses.
- Reads succeed, drive never runs: switch the drive from USS to Modbus and move the command and setpoint sources to the serial link.
- Modbus exception on read or write: wrong address base or out-of-range value — re-check the register list and rerun the 0x1388 byte-order test.
- State checks false-alarm: that is the serial-leg lag, not a fault — gate on the status word.
- Every communication loss ends in the programmed stop branch, and the safe stop stays on STO hardware.
Questions asked
Does the PROFIBUS baud rate affect how fast the drive gets its setpoint?
No. The PROFIBUS baud rate only moves cyclic data between the PLC and the gateway. The drive sees changes at the Modbus RTU side's pace: roughly one transaction, about 13 ms at 19200 baud, per mapped write or read, plus the gateway's own scan time. Raising the DP line to 12 Mbit/s shortens the PLC-to-gateway leg and does nothing for the serial leg to the drive.
Can one gateway control several Modbus drives from one DP slave station?
Yes, if the gateway's command table supports several Modbus slave addresses. Each added drive adds its own transactions and the serial update time grows roughly linearly; plan on tens of milliseconds per drive at 19200 baud. If an axis needs a stiff, predictable update, give it its own gateway instead of sharing one serial port.
The gateway shows healthy PROFIBUS exchange but the drive never moves — what does that isolate?
It isolates the fault to the serial leg. DP health covers only the PLC-to-gateway link, and the gateway-to-drive link fails on its own conditions: protocol still set to USS, mismatched parity or stop bits, a slave address unequal to the gateway's Modbus slave ID, or a command source still on the terminals. Check the gateway's Modbus error counters and the drive's serial settings before rewriting PLC logic.
What do Modbus exception codes 01, 02 and 03 tell me here?
01 is illegal function: the gateway sent a code the drive does not support on that register. 02 is illegal data address: the register is not in the map, usually a wrong address base or a read spanning a gap. 03 is illegal data value: the register exists but the value is out of range, which is exactly what a byte-swapped setpoint produces.
Is there a version of this drive with PROFIBUS onboard?
Some G120C order variants carry onboard PROFIBUS DP or PROFINET. A unit like that appears on the bus as the drive itself and is configured from its own GSD, with no protocol conversion in the path. Check the option codes on the drive's order number: if your hardware includes the DP or PROFINET option, configure it directly and remove the gateway.