diff --git a/debug_attributes.md b/debug_attributes.md
index a3ac46f1..31a14794 100644
--- a/debug_attributes.md
+++ b/debug_attributes.md
@@ -87,6 +87,7 @@ If the type is marked as `{...}` it means that it is a complex item can have mul
| swoConfig
.decoders | {object} | Both | SWO Decoder Configuration |
| swoConfig
.enabled | boolean | Both | Enable SWO decoding. |
| swoConfig
.source | string | Both | Source for SWO data. Can either be "probe" to get directly from debug probe, or a serial port device to use a serial port external to the debug probe. |
+| swoConfig
.swoEncoding | string | Both | BMP only: SWO encoding data used at the line level. Depends on the probe hardware, native (the original one) supports only Manchester (self-clocked, but slower rates) while most other platforms (e.g. ST-LINK with BMP firmware) support only UART (frequency/baud rate has to match to within ~2%). |
| swoConfig
.swoFrequency | number | Both | SWO frequency in Hz. |
| swoConfig
.swoPath | string | Both | Path name when source is "file" or "serial", device name regex match when source is "probe" for BMP. Typically a /path-name or a serial-port-name |
| swoConfig
.swoPort | string | Both | When server is "external" && source is "socket", port to connect to. Format [host:]port. For BMP, specifies the regex match of the USB interface contianing raw SWO data. |
diff --git a/package.json b/package.json
index a8f1c141..6f1e788e 100644
--- a/package.json
+++ b/package.json
@@ -1524,6 +1524,15 @@
"default": 0,
"description": "SWO frequency in Hz; 0 will attempt to automatically calculate.",
"type": "number"
+ },
+ "swoEncoding": {
+ "default": "uart",
+ "description": "BMP only: SWO encoding data used at the line level. Depends on the probe hardware, native (the original one) supports only Manchester (self-clocked, but slower rates) while most other platforms (e.g. ST-LINK with BMP firmware) support only UART (frequency/baud rate has to match to within ~2%).",
+ "type": "string",
+ "enum": [
+ "uart",
+ "manchester"
+ ]
}
},
"required": [],
@@ -2683,6 +2692,15 @@
"default": 0,
"description": "SWO frequency in Hz.",
"type": "number"
+ },
+ "swoEncoding": {
+ "default": "uart",
+ "description": "BMP only: SWO encoding data used at the line level. Depends on the probe hardware, native (the original one) supports only Manchester (self-clocked, but slower rates) while most other platforms (e.g. ST-LINK with BMP firmware) support only UART (frequency/baud rate has to match to within ~2%).",
+ "type": "string",
+ "enum": [
+ "uart",
+ "manchester"
+ ]
}
},
"required": [],
diff --git a/src/bmp.ts b/src/bmp.ts
index bb77cd7d..899e9b63 100644
--- a/src/bmp.ts
+++ b/src/bmp.ts
@@ -93,7 +93,7 @@ export class BMPServerController extends EventEmitter implements GDBServerContro
const cpuFrequency = this.args.swoConfig.cpuFrequency;
const ratio = Math.floor(cpuFrequency / swoFrequency) - 1;
- const encoding = this.args.swoConfig.source === 'probe' ? 1 : 2;
+ const encoding = this.args.swoConfig.swoEncoding === 'manchester' ? 1 : 2;
const commands: string[] = [];
@@ -112,7 +112,7 @@ export class BMPServerController extends EventEmitter implements GDBServerContro
commands.push(this.args.swoConfig.profile ? 'EnablePCSample' : 'DisablePCSample');
if (this.args.swoConfig.source === 'probe') {
- commands.push('monitor traceswo');
+ commands.push(encoding === 2 ? `monitor traceswo ${swoFrequency}` : 'monitor traceswo');
}
return commands.map((c) => `interpreter-exec console "${c}"`);
diff --git a/src/common.ts b/src/common.ts
index 0de30170..f8fb1d90 100644
--- a/src/common.ts
+++ b/src/common.ts
@@ -200,6 +200,7 @@ export interface SWOConfiguration {
enabled: boolean;
cpuFrequency: number;
swoFrequency: number;
+ swoEncoding: 'manchester' | 'uart';
decoders: any[];
profile: boolean;
source: string;