)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1b30ca003f38c3440b54e580e4b3e80baabe297a","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":5,"id":"7ce39b6f_02cfd5cd","updated":"2026-02-07 17:43:45.000000000","message":"Please use the same indent/tabs\u003d4 as in C source.","commit_id":"c01b33a0803374627310589327ae7dda611115ee"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"b0962ab7c988e9f760dfbbc7fcf2426e8583d3e2","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"0f9ce287_01089f97","in_reply_to":"7ce39b6f_02cfd5cd","updated":"2026-02-10 17:25:49.000000000","message":"Done","commit_id":"c01b33a0803374627310589327ae7dda611115ee"}],"tcl/target/silabs/series2.cfg":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"db69a34f0ebac5ebc999f607667b7b315e547e71","unresolved":true,"context_lines":[{"line_number":67,"context_line":"    set dap [$target cget -dap]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"   # Read DP_IDCODE"},{"line_number":70,"context_line":"   set dp_id [$dap dpreg 0]"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"   if {$dp_id !\u003d 0x6BA02477} {"},{"line_number":73,"context_line":"      echo \"Error: invalid DP ID for Silabs Series 2\""}],"source_content_type":"text/x-ttcn-cfg","patch_set":5,"id":"237dbb5c_62994846","line":70,"updated":"2026-02-07 14:27:41.000000000","message":"DCI support written in Tcl lacks error handling.\nE.g. when MCU stops responding (simulated by keeping RESETn low)\nOpenOCD logs:\n```\nError: Error connecting DP: cannot read IDR\nError: [efm32.cpu] Execution of event examine-fail failed:\no/tcl/target/silabs/series2.cfg:145: Error:\nTraceback (most recent call last):\n  File \"o/tcl/target/silabs/series2.cfg\", line 62\n    silabs_s2_dci_read_se_status\n  File \"o/tcl/target/silabs/series2.cfg\", line 284, in silabs_s2_dci_read_se_status\n    silabs_s2_dci_connect\n  File \"o/tcl/target/silabs/series2.cfg\", line 145, in silabs_s2_dci_connect\n    {efm32.dap dpreg} 0\nError: [efm32.cpu] Examination failed, GDB will be halted. Polling again in 6300ms\n```\n\nUnfortunately I didn\u0027t find a detailed DCI description in the EFR32xG22 ref man. Perhaps it is in some app note? Please give a pointer.\n\nAnyway looking at the following AP level operations looks like the DCI is in fact a set of registers behind MEM-AP 1. I added\n```\ntarget create efm32.dci mem_ap -dap efm32.dap -ap-num 1\n```\nand it seems to work without AP level commands:\n```\n\u003e efm32.dci mdw 0x10fc\n0x000010fc: 000dc11d\n```\nCouldn\u0027t we go this way? Or of course even better would be to implement DCI\nfunctions as C code OpenOCD command handlers in the flash driver. Somewhat similar approach is used in kinetis.c flash driver (MDM-AP stuff). What do you think?","commit_id":"c01b33a0803374627310589327ae7dda611115ee"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"b0962ab7c988e9f760dfbbc7fcf2426e8583d3e2","unresolved":false,"context_lines":[{"line_number":67,"context_line":"    set dap [$target cget -dap]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"   # Read DP_IDCODE"},{"line_number":70,"context_line":"   set dp_id [$dap dpreg 0]"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"   if {$dp_id !\u003d 0x6BA02477} {"},{"line_number":73,"context_line":"      echo \"Error: invalid DP ID for Silabs Series 2\""}],"source_content_type":"text/x-ttcn-cfg","patch_set":5,"id":"26d2726e_08c190de","line":70,"in_reply_to":"0f825d5b_e8009cde","updated":"2026-02-10 17:25:49.000000000","message":"Done","commit_id":"c01b33a0803374627310589327ae7dda611115ee"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"20817c8b183b6127b5761a8a6aedfa1320634087","unresolved":true,"context_lines":[{"line_number":67,"context_line":"    set dap [$target cget -dap]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"   # Read DP_IDCODE"},{"line_number":70,"context_line":"   set dp_id [$dap dpreg 0]"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"   if {$dp_id !\u003d 0x6BA02477} {"},{"line_number":73,"context_line":"      echo \"Error: invalid DP ID for Silabs Series 2\""}],"source_content_type":"text/x-ttcn-cfg","patch_set":5,"id":"0f825d5b_e8009cde","line":70,"in_reply_to":"237dbb5c_62994846","updated":"2026-02-10 11:58:14.000000000","message":"I have to admit I have imported this TCL code without really understanding it and I haven\u0027t tested the debug lock feature. I have applied your suggestion (with help of an AI, I have to confess). silabs_s2_dci_device_lock() and silabs_s2_dci_device_erase() seems to work as expected.","commit_id":"c01b33a0803374627310589327ae7dda611115ee"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"80472f5a9759d2c9dcbdc81c12dcb786843e5ab3","unresolved":true,"context_lines":[{"line_number":74,"context_line":"proc silabs_s2_dci_connect {} {"},{"line_number":75,"context_line":"\tglobal _DCINAME _DCI_REG_ID"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"\tpoll off"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"\tset dciid [$_DCINAME read_memory $_DCI_REG_ID 32 1]"},{"line_number":80,"context_line":"\tif {$dciid !\u003d 0xdc11d} {"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"dd0c44f0_50c7b5b5","line":77,"updated":"2026-02-11 22:40:02.000000000","message":"Looks definitively better!\nAnother advantage of MEM-AP usage that we don\u0027t need to suppress polling.\nUnfortunately `dci_write_command` makes debug AP unresponsive so we have to `poll off` anyway. Consider moving `poll off` just before the first `dci_write_command` call. This prevents the problem of leaving poll off after error in `read_memory`.\n\nI think that we can limit error handling to `dci_connect` which floods the log during repeated examination.\nWe can treat `read_memory` and wrong ID errors Tcl way:\n```\nproc silabs_s2_dci_connect {} {\n    global _DCINAME _DCI_REG_ID\n\n    if [catch {$_DCINAME read_memory $_DCI_REG_ID 32 1} dciid] {\n        return -code error \"Failed to read DCIID\"\n    }\n    if {$dciid !\u003d 0xdc11d} {\n        return -code error \"Failed to read correct DCIID (got $dciid)\"\n    }\n    echo \"Successfully connected to DCI\"\n}\n```\n\nThen caller functions can use just:\n```\nproc silabs_s2_dci_read_se_status {} {\n    silabs_s2_dci_connect\n\n    poll off \n    # Write len\n    silabs_s2_dci_write_cmd 8\n\n```\n\nBut event examine-fail should `catch` to get rid of call history info:\n```\n$_TARGETNAME configure -event examine-fail {\n    if [catch silabs_s2_dci_read_se_status errstr] {\n        echo $errstr\n    }\n}\n```","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"81117bb43e60d22b4bbb261c35ed25e73bd07de6","unresolved":false,"context_lines":[{"line_number":74,"context_line":"proc silabs_s2_dci_connect {} {"},{"line_number":75,"context_line":"\tglobal _DCINAME _DCI_REG_ID"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"\tpoll off"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"\tset dciid [$_DCINAME read_memory $_DCI_REG_ID 32 1]"},{"line_number":80,"context_line":"\tif {$dciid !\u003d 0xdc11d} {"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"332cade3_728d6bfa","line":77,"in_reply_to":"dd0c44f0_50c7b5b5","updated":"2026-02-26 16:49:15.000000000","message":"Done","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"80472f5a9759d2c9dcbdc81c12dcb786843e5ab3","unresolved":true,"context_lines":[{"line_number":173,"context_line":"\tpoll on"},{"line_number":174,"context_line":"}"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"proc silabs_s2_dci_read_se_status {} {"},{"line_number":177,"context_line":"\tif {[silabs_s2_dci_connect] !\u003d 0} {"},{"line_number":178,"context_line":"\t\tpoll on"},{"line_number":179,"context_line":"\t\treturn"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"19e7d4f1_4ca407f5","line":176,"updated":"2026-02-11 22:40:02.000000000","message":"Reading status resets MCU. Is it normal or DCI reacts to a problem in communication?","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"f4ad4499c3d90fed7624e1208ec23a9ec1b31caa","unresolved":true,"context_lines":[{"line_number":173,"context_line":"\tpoll on"},{"line_number":174,"context_line":"}"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"proc silabs_s2_dci_read_se_status {} {"},{"line_number":177,"context_line":"\tif {[silabs_s2_dci_connect] !\u003d 0} {"},{"line_number":178,"context_line":"\t\tpoll on"},{"line_number":179,"context_line":"\t\treturn"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"327770e6_e6aa320a","line":176,"in_reply_to":"19e7d4f1_4ca407f5","updated":"2026-02-26 17:10:23.000000000","message":"I didn\u0027t observed that. What did you do?","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"767ec3a1e84af9022f58a089f1fbab901f3d1b24","unresolved":true,"context_lines":[{"line_number":173,"context_line":"\tpoll on"},{"line_number":174,"context_line":"}"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"proc silabs_s2_dci_read_se_status {} {"},{"line_number":177,"context_line":"\tif {[silabs_s2_dci_connect] !\u003d 0} {"},{"line_number":178,"context_line":"\t\tpoll on"},{"line_number":179,"context_line":"\t\treturn"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"9650b3f8_14478712","line":176,"in_reply_to":"327770e6_e6aa320a","updated":"2026-04-17 09:46:58.000000000","message":"E.g. run Tcl proc `silabs_s2_dci_read_se_status` manually:\n```\n\u003e silabs_s2_dci_read_se_status\nSuccessfully connected to DCI\nDCI WPENDING bit set, retrying\nDCI SESTATUS response:\nDebug lock (config): Disabled\nDevice erase: Enabled\nSecure debug: Disabled\nDebug lock (hw status): Disabled\n[efm32.cpu] external reset detected\n```\n\nNot saying it\u0027s a problem, the chip may force it for some reason. Just making sure it is an expected behaviour.","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"80472f5a9759d2c9dcbdc81c12dcb786843e5ab3","unresolved":true,"context_lines":[{"line_number":200,"context_line":"\t}"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\t# decrement length word"},{"line_number":203,"context_line":"\tset recvlen [expr {$recvlen - 4}]"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"\tfor {set i 0} {$recvlen \u003e 0} {incr i} {"},{"line_number":206,"context_line":"\t\tset recvlen [expr {$recvlen - 4}]"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"5ec8d7f1_52294c92","line":203,"range":{"start_line":203,"start_character":1,"end_line":203,"end_character":34},"updated":"2026-02-11 22:40:02.000000000","message":"`incr recvlen -4`","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"81117bb43e60d22b4bbb261c35ed25e73bd07de6","unresolved":false,"context_lines":[{"line_number":200,"context_line":"\t}"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"\t# decrement length word"},{"line_number":203,"context_line":"\tset recvlen [expr {$recvlen - 4}]"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"\tfor {set i 0} {$recvlen \u003e 0} {incr i} {"},{"line_number":206,"context_line":"\t\tset recvlen [expr {$recvlen - 4}]"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"0dfb5b5e_97199558","line":203,"range":{"start_line":203,"start_character":1,"end_line":203,"end_character":34},"in_reply_to":"5ec8d7f1_52294c92","updated":"2026-02-26 16:49:15.000000000","message":"Done","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"80472f5a9759d2c9dcbdc81c12dcb786843e5ab3","unresolved":true,"context_lines":[{"line_number":238,"context_line":"\t\techo \"  You will not be able to communicate with this device\""},{"line_number":239,"context_line":"\t\techo \"  unless you perform a device erase (if available, indicated above)!\""},{"line_number":240,"context_line":"\t\techo \"  Try silabs_s2_dci_device_erase to attempt erase.\""},{"line_number":241,"context_line":"\t\techo \" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\""},{"line_number":242,"context_line":"\t} else {"},{"line_number":243,"context_line":"\t\techo \"Debug lock (hw status): Disabled\""},{"line_number":244,"context_line":"\t}"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"2fae1e1d_063f536a","line":241,"updated":"2026-02-11 22:40:02.000000000","message":"Here I recommend `poll off` (or move `poll on` from line 210 to 243). OpenOCD cannot connect so there is no point in keeping re-trying.","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"},{"author":{"_account_id":1002493,"name":"Jérôme Pouiller","email":"jerome.pouiller@silabs.com","username":"jerome-pouiller"},"change_message_id":"81117bb43e60d22b4bbb261c35ed25e73bd07de6","unresolved":false,"context_lines":[{"line_number":238,"context_line":"\t\techo \"  You will not be able to communicate with this device\""},{"line_number":239,"context_line":"\t\techo \"  unless you perform a device erase (if available, indicated above)!\""},{"line_number":240,"context_line":"\t\techo \"  Try silabs_s2_dci_device_erase to attempt erase.\""},{"line_number":241,"context_line":"\t\techo \" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\""},{"line_number":242,"context_line":"\t} else {"},{"line_number":243,"context_line":"\t\techo \"Debug lock (hw status): Disabled\""},{"line_number":244,"context_line":"\t}"}],"source_content_type":"text/x-ttcn-cfg","patch_set":7,"id":"28412e37_6d6d2964","line":241,"in_reply_to":"2fae1e1d_063f536a","updated":"2026-02-26 16:49:15.000000000","message":"Done","commit_id":"46c523a1dce896b2359042c020f6b40274721e51"}]}
