By default STM32CubeMonitor takes the ST-LINK for itself, so if you try to debug in the IDE while CubeMonitor is running, one of them fails to connect. Shared mode routes both tools through the ST-LINK server so they can use the probe at the same time. You can step through code in STM32CubeIDE while CubeMonitor live-plots your variables.
| Protocol | How it connects | Can it share the probe |
|---|---|---|
p2p (default) |
It connects straight to the probe and gives the highest data rate. | No, because it locks out every other application. |
tcp |
It connects through the ST-LINK server, which shares access between apps. | Yes, and this is the mode that shared mode uses. |
Shared mode means you run CubeMonitor in tcp mode and tell the IDE to use the
shared ST-LINK. A J-Link probe supports p2p only, so shared mode is an ST-LINK
feature.
Shared mode passes through a helper called the ST-LINK server, which normally
installs together with STM32CubeIDE and STM32CubeProgrammer. If you have either
tool you already have it. On Windows you can find it inside Program Files in a
folder named stlink_server.
The protocol is set in CubeMonitor's settings.js file, and the change only takes
effect the next time the app starts.
- Close STM32CubeMonitor if it is open.
- Open the
settings.jsfile for your operating system from the table below. - Find the line that starts with
connectionTypeand change its value totcp. - Save the file and start STM32CubeMonitor again.
| Operating system | settings.js location |
|---|---|
| Windows | %USERPROFILE%\.STMicroelectronics\stm32cubemonitor\settings.js (i.e. C:\Users\<you>\.STMicroelectronics\stm32cubemonitor\settings.js) |
| Linux | ~/.STMicroelectronics/stm32cubemonitor/settings.js |
| macOS | ~/Library/stm32cubemonitor/settings.js |
connectionType: "tcp",- Open Run > Debug Configurations.
- Select your debug configuration on the left.
- Open the Debugger tab.
- Check Enable shared ST-LINK.
- Click Apply, then click Debug to start the session.
With the debug session running, start your acquisition in CubeMonitor as usual by
pressing the start button on the acquisition node and opening the dashboard. When
it works the probe in the flow shows the text tcp connected, and both tools keep
running together.
| IDE | Where to switch it on |
|---|---|
| STM32CubeIDE | Debug Configurations > Debugger tab > Enable shared ST-LINK |
| IAR Embedded Workbench | Project > Options > Debugger > Extra Options, then add --stlink_use_server |
| Keil uVision | Project > Options for Target > Debug tab > ST-Link settings, then set Debug adapter to Shareable ST-Link |
- If CubeMonitor still cannot connect while the IDE is debugging, the
connectionTypeis probably stillp2por you did not restart CubeMonitor after the edit, so redo Step 2 and start the app again. - If the IDE debug session will not start while CubeMonitor is open, Enable shared ST-LINK is not checked or the ST-LINK server is not installed, so check Step 1 and Step 3.
- If it connects but the data is slow or drops samples, that is the cost of
tcpmode, so lower the sampling rate or switch back top2pwhen you do not need the IDE attached. - If you use a J-Link probe, shared mode is not available because J-Link supports
p2ponly, so use an ST-LINK to debug and monitor together.