<?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>nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86135/nrf21540ek-integration-with-nrf5340dk</link><description>Hi there, 
 We are trying to integrate an nRF21540EK shield onto our nRF5340DK. Following the instructions on the following link ( https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_radio_fem.html#ug-radio-fem-nrf21540-ek-programming </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Apr 2022 12:25:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86135/nrf21540ek-integration-with-nrf5340dk" /><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/361508?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 12:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d993378-6e37-4cdd-b087-f2da459e1ce4</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Matt,&lt;/p&gt;
&lt;p&gt;In nRF21540 DK, there are two antenna ports such as ANT1 and ANT2. The two antenna ports enable applications using antenna diversity and can be selected using pin ANT_SEL. ANT_SEL pin is used to select which of the two antenna interface is used during RX and TX. You can find this in product specification &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf21540/keyfeatures_html5.html?cp=7_0_0"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf21540/keyfeatures_html5.html?cp=7_0_0&lt;/a&gt; .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanking you.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/361253?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2022 13:40:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:497c61cf-1082-4a1e-8e33-4f8313449dba</guid><dc:creator>matt_m</dc:creator><description>&lt;p&gt;Thanks Kazi, and what about the antenna port selection?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/361190?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2022 10:21:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e74fd834-610e-4c5a-bf35-ebe23f8c28ac</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Matt,&lt;/p&gt;
&lt;p&gt;RX gain is +13 dB and when you set the value zero in config (&lt;span&gt;CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=0)&amp;nbsp;&lt;/span&gt;file you will get this.&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf21540/chapters/keyparameters/doc/electrical_specification.html?cp=7_0_0_6_1#unique_1296948405"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf21540/chapters/keyparameters/doc/electrical_specification.html?cp=7_0_0_6_1#unique_1296948405&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/360885?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 16:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93fcfc81-af93-48fd-b43c-bd4268460609</guid><dc:creator>matt_m</dc:creator><description>&lt;p&gt;Hi Kazi,&lt;/p&gt;
&lt;p&gt;Thank you for the project files, we gave up using the nRF5340DK and nRF21540EK approach but got everything working using the &lt;span&gt;nRF21540DK. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there currently support for configuring the Rx gain and antenna port selection on the nRF21540DK?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Many thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Matt&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/360197?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2022 08:45:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1de89fe0-2e21-482f-a9b0-e4b0b43daa45</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Matt,&lt;/p&gt;
&lt;p&gt;I am adding here the complete project of this application. You can control the external FEM with GPIOs which is supported. I assume LNA is fixed or not supported so, has set this RX gain zero like this&amp;nbsp;&lt;span&gt;CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=0. Power amplifier gain is supported which has 20 dbM value (CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/adv_5F00_nRF21540_5F00_20dBm.zip"&gt;devzone.nordicsemi.com/.../adv_5F00_nRF21540_5F00_20dBm.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can get the idea of overlay file and CMakeList.tst file from here.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kazi Afroza Sultana&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/360073?ContentTypeID=1</link><pubDate>Fri, 25 Mar 2022 15:46:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c714f0cb-9de8-433b-a472-21125fbeef21</guid><dc:creator>matt_m</dc:creator><description>&lt;p&gt;Hi Kazi, thanks for the reply. We tried to replicate your setup on the nRF5340 but we seem to be getting some errors. I have a few questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Do we need to use an overlay file to&amp;nbsp;&lt;span&gt;describe how the FEM is connected to the nRF5340 or this handled by&amp;nbsp;adding the shield to the project&amp;rsquo;s &lt;code class="file docutils literal notranslate"&gt;&lt;span class="pre"&gt;CMakeLists.txt&lt;/span&gt;&lt;/code&gt; file?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Are the variables&amp;nbsp;TRANSMIT_POWER_dBm and&amp;nbsp;CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB referring to the tx power/gain of the nRF5340 and the nRF21540 respectively and do they have to be configured&amp;nbsp;separately?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;The project builds but we are getting the error &amp;quot;Set Tx power err: -5 reason 0x00&amp;quot;. We previously had trouble configuring&amp;nbsp;the tx power of the nRF5340 using the zephyr controller and had to use the&amp;nbsp;soft device controller, is this error related?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Many thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Matt&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF21540EK integration with nRF5340dk</title><link>https://devzone.nordicsemi.com/thread/359690?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2022 00:37:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e545619-635f-42a5-88b5-4036d5463b5b</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Mathew,&lt;/p&gt;
&lt;p&gt;We have an example for peripheral_uart which was tested on NCS 1.8.0&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The added configuration for nrf21540 are like the following configurations&amp;nbsp;&lt;/p&gt;
&lt;p&gt;# FEM&lt;br /&gt;CONFIG_MPSL_FEM=y&lt;br /&gt;CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y&lt;br /&gt;CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=0&lt;br /&gt;CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20&lt;/p&gt;
&lt;p&gt;It also needs a function for setting transmit power and for the getting transmit power.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;static void set_tx_power(uint8_t handle_type, uint16_t handle, int8_t tx_pwr_lvl)
{
&amp;#160; &amp;#160; struct bt_hci_cp_vs_write_tx_power_level *cp;
&amp;#160; &amp;#160; struct bt_hci_rp_vs_write_tx_power_level *rp;
&amp;#160; &amp;#160; struct net_buf *buf, *rsp = NULL;
&amp;#160; &amp;#160; int err;

&amp;#160; &amp;#160; buf = bt_hci_cmd_create(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; sizeof(*cp));
&amp;#160; &amp;#160; if (!buf) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Unable to allocate command buffer\n&amp;quot;);
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; cp = net_buf_add(buf, sizeof(*cp));
&amp;#160; &amp;#160; cp-&amp;gt;handle = sys_cpu_to_le16(handle);
&amp;#160; &amp;#160; cp-&amp;gt;handle_type = handle_type;
&amp;#160; &amp;#160; cp-&amp;gt;tx_power_level = tx_pwr_lvl;

&amp;#160; &amp;#160; err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_WRITE_TX_POWER_LEVEL,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;buf, &amp;amp;rsp);
&amp;#160; &amp;#160; if (err) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; uint8_t reason = rsp ?
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ((struct bt_hci_rp_vs_write_tx_power_level *)
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; rsp-&amp;gt;data)-&amp;gt;status : 0;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Set Tx power err: %d reason 0x%02x\n&amp;quot;, err, reason);
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; rp = (void *)rsp-&amp;gt;data;
&amp;#160; &amp;#160; printk(&amp;quot;RADIO Tx Power: %d + PA_GAIN(%d) = %d\n&amp;quot;, rp-&amp;gt;selected_tx_power, CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB, rp-&amp;gt;selected_tx_power + CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB);

&amp;#160; &amp;#160; net_buf_unref(rsp);
}&lt;/pre&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void get_tx_power(uint8_t handle_type, uint16_t handle, int8_t *tx_pwr_lvl)
{
&amp;#160; &amp;#160; struct bt_hci_cp_vs_read_tx_power_level *cp;
&amp;#160; &amp;#160; struct bt_hci_rp_vs_read_tx_power_level *rp;
&amp;#160; &amp;#160; struct net_buf *buf, *rsp = NULL;
&amp;#160; &amp;#160; int err;

&amp;#160; &amp;#160; *tx_pwr_lvl = 0xFF;
&amp;#160; &amp;#160; buf = bt_hci_cmd_create(BT_HCI_OP_VS_READ_TX_POWER_LEVEL,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; sizeof(*cp));
&amp;#160; &amp;#160; if (!buf) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Unable to allocate command buffer\n&amp;quot;);
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; cp = net_buf_add(buf, sizeof(*cp));
&amp;#160; &amp;#160; cp-&amp;gt;handle = sys_cpu_to_le16(handle);
&amp;#160; &amp;#160; cp-&amp;gt;handle_type = handle_type;

&amp;#160; &amp;#160; err = bt_hci_cmd_send_sync(BT_HCI_OP_VS_READ_TX_POWER_LEVEL,
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;buf, &amp;amp;rsp);
&amp;#160; &amp;#160; if (err) {
&amp;#160; &amp;#160; &amp;#160; &amp;#160; uint8_t reason = rsp ?
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ((struct bt_hci_rp_vs_read_tx_power_level *)
&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; rsp-&amp;gt;data)-&amp;gt;status : 0;
&amp;#160; &amp;#160; &amp;#160; &amp;#160; printk(&amp;quot;Read Tx power err: %d reason 0x%02x\n&amp;quot;, err, reason);
&amp;#160; &amp;#160; &amp;#160; &amp;#160; return;
&amp;#160; &amp;#160; }

&amp;#160; &amp;#160; rp = (void *)rsp-&amp;gt;data;
&amp;#160; &amp;#160; *tx_pwr_lvl = rp-&amp;gt;tx_power_level;

&amp;#160; &amp;#160; net_buf_unref(rsp);
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void connected(struct bt_conn *conn, uint8_t err)
{
	struct bt_conn *default_conn;
	uint16_t default_conn_handle;
	int ret;
	int8_t txp;

	char addr[BT_ADDR_LE_STR_LEN];

	if (err) {
		printk(&amp;quot;Connection failed (err %u)\n&amp;quot;, err);
		sys_reboot();
		return;
	}

	default_conn = bt_conn_ref(conn);
	ret = bt_hci_get_conn_handle(default_conn,
						&amp;amp;default_conn_handle);
	if (ret) {
		printk(&amp;quot;No connection handle (err %d)\n&amp;quot;, ret);
		sys_reboot();
		return;
	}
	
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
			printk(&amp;quot;Connected via connection (%d) at %s\n&amp;quot;,
			       default_conn_handle, addr);
			get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,
				     default_conn_handle, &amp;amp;txp);
			printk(&amp;quot;Connection (%d) - Initial Radio Tx Power: %d + PA_GAIN (%d) = %d\n&amp;quot;,
			       default_conn_handle, txp, CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB, txp + CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB);

			set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,
				     default_conn_handle,
				     TRANSMIT_POWER_dBm);
			get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_CONN,
				     default_conn_handle, &amp;amp;txp);
			printk(&amp;quot;Connection (%d) - Initial Radio Tx Power: %d + PA_GAIN (%d) = %d\n&amp;quot;,
			       default_conn_handle, txp, CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB, txp + CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB);

	current_conn = bt_conn_ref(conn);

	dk_set_led_on(CON_STATUS_LED);
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Set_tx_power has to be called from disconnected function to define the transmit power value.&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	char addr[BT_ADDR_LE_STR_LEN];
	int err = 0;

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk(&amp;quot;Disconnected: %s (reason %u)\n&amp;quot;, log_strdup(addr), reason);

	if (auth_conn) {
		bt_conn_unref(auth_conn);
		auth_conn = NULL;
	}

	if (current_conn) {
		bt_conn_unref(current_conn);
		current_conn = NULL;
		dk_set_led_off(CON_STATUS_LED);
	}

	err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd,
			      ARRAY_SIZE(sd));
	if (err) {
		printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);
		sys_reboot();
		return;
	}

	set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, TRANSMIT_POWER_dBm);
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;From main function set_tx_power has to be called.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void main(void) {
....
..

set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, TRANSMIT_POWER_dBm);

}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;You can try this modification in peripheral_uart sample and see the output.&lt;/div&gt;
&lt;div&gt;Let us know the consequence.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thanks.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Best Regards,&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Kazi Afroza Sultana&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>