<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114965/custom-command-in-mcumgr</link><description>Hello, 
 My goal is to read out UICR address 0x10001080UL from command line / MCUMGR. 
 
 How to acheive that? 
 I have tried and successfully compiled ran these mcumgr handler examples: 
 https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr_handlers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Sep 2024 18:34:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114965/custom-command-in-mcumgr" /><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504227?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 18:34:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30c87416-00b8-4fcf-be9f-60336a34b612</guid><dc:creator>dagvegar</dc:creator><description>&lt;p&gt;After fiddling around with different combinations, this combination works:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;# Enable the serial mcumgr transport.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_TRANSPORT_UART&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_GRP_SHELL&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;# Enable the shell MCUmgr transport.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BASE64&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SHELL&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SHELL_BACKEND_DUMMY&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#CONFIG_MCUMGR_TRANSPORT_SHELL=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SHELL_BACKEND_SERIAL&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	chosen {
		zephyr,uart-mcumgr = &amp;amp;cdc_acm_uart0;
	};
};

&amp;amp;zephyr_udc0 {
	cdc_acm_uart0: cdc_acm_uart0 {
		compatible = &amp;quot;zephyr,cdc-acm-uart&amp;quot;;
	};
};

&amp;amp;uart0 {
	status = &amp;quot;disabled&amp;quot;;
};
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504223?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 18:10:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:852bc189-62cf-4074-82ff-e21dd76e3557</guid><dc:creator>dagvegar</dc:creator><description>&lt;p&gt;Though it&amp;#39;s now working, the current consumption with the uart enabled is too high. I want to do mcumgr over USB.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to disable uart:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;
&amp;amp;uart0 {
  status = &amp;quot;disabled&amp;quot;;
};&lt;/pre&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;It looks like&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_TRANSPORT_SHELL=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;requires uart in the device tree:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: &amp;#39;__device_dts_ord_70&amp;#39; undeclared&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Is it possible to keep this working over USB, but with uart disabled?&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504054?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 19:28:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9505740-4429-483a-93f3-18473f59dbc7</guid><dc:creator>dagvegar</dc:creator><description>&lt;p&gt;Thanks a lot, now it&amp;#39;s working!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504017?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 14:30:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc1cdb17-f870-4df5-8c39-45acc3db516d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please check if the CONFIG_MCUMGR_GRP_SHELL symbol got selected in your configuration file (build/zephyr/.config). The&amp;nbsp;&lt;span data-teams="true"&gt;&lt;span class="ui-provider cue cuf afi ayv ayw ayx ayy ayz aza azb azc azd aze azf azg azh azi azj azk azl cug cuh azo azp azq azr azs azt azu azv azw azx azy azz baa" dir="ltr"&gt;MGMT_ERR_ENOTSUP (8) error suggests that the shell handler did not get registered.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504014?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 14:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eed77821-4c4b-46d0-bebb-ae4c0bc0e890</guid><dc:creator>dagvegar</dc:creator><description>&lt;p&gt;mcumgr --conntype serial --connstring COM8,baud=115200 shell exec uicr_read&lt;br /&gt;status=8&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504009?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 13:41:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b6ca4df-60fd-4948-9bed-b0d0f84e0091</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Please try&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;mcumgr --conntype serial --connstring COM8,baud=115200 shell exec uicr_read&lt;/pre&gt;. I&amp;#39;m not sure if you can list available commands over the mcumgr transport. You can try shell exec help to see if that works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/504008?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 13:38:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12489243-1aef-4b98-94c1-29dcfbbc05be</guid><dc:creator>dagvegar</dc:creator><description>&lt;p&gt;Thanks a lot for the answer.&lt;/p&gt;
&lt;p&gt;The code integrates fine and flashes to my device.&lt;/p&gt;
&lt;p&gt;Is the uicr_read command supposed to be listed here under available commands?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; mcumgr --conntype serial --connstring COM8 shell
Execute shell commands remotely

Usage:
  mcumgr shell [flags]
  mcumgr shell [command]

Available Commands:
  exec        Execute a shell command remotely

Flags:
  -h, --help   help for shell

Global Flags:
  -c, --conn string         connection profile to use
      --connextra string    Additional key-value pair to append to the connstring
      --connstring string   Connection key-value pairs to use instead of using the profile&amp;#39;s connstring
      --conntype string     Connection type to use instead of using the profile&amp;#39;s type
  -i, --hci int             HCI index for the controller on Linux machine
  -l, --loglevel string     log level to use (default &amp;quot;info&amp;quot;)
      --name string         name of target BLE device; overrides profile setting
      --ompres string       Use this CoAP resource instead of /omgr (default &amp;quot;/omgr&amp;quot;)
  -t, --timeout float       timeout in seconds (partial seconds allowed) (default 10)
  -r, --tries int           total number of tries in case of timeout (default 1)
      --write-rsp           Send BLE acked write requests instead of unacked write commands&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t quite see how to execute the command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom command in MCUMGR</title><link>https://devzone.nordicsemi.com/thread/503959?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 11:35:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3fb7c6f-3e61-40d3-9771-fc595dc5b581</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can register the mcumgr shell handler by adding CONFIG_MCUMGR_GRP_SHELL=y to your project configuration file.&amp;nbsp;In&amp;nbsp;addition to this configuration setting, you need to include the following configurations from the overlay-shell.conf Kconfig fragment found in the SMP server sample:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Enable the shell MCUmgr transport.
CONFIG_BASE64=y
CONFIG_CRC=y
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_DUMMY=y
CONFIG_MCUMGR_TRANSPORT_SHELL=y

# mcumgr-cli application doesn&amp;#39;t accepts log in the channel it uses
CONFIG_SHELL_LOG_BACKEND=n
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You should then be able to register a shell command in your application. For example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static int cmd_uicr_read(const struct shell *shell, size_t argc, char **argv)
{
	ARG_UNUSED(argc);
	ARG_UNUSED(argv);

	shell_print(shell, &amp;quot;UICR@0x%x: 0x%x&amp;quot;, 
		(uint32_t) &amp;amp;NRF_UICR-&amp;gt;CUSTOMER[0], NRF_UICR-&amp;gt;CUSTOMER[0]);

	return 0;
}

SHELL_CMD_REGISTER(uicr_read, NULL, &amp;quot;Print UICR register&amp;quot;, cmd_uicr_read);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>