<?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>PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50687/pa-lna-in-bootloader</link><description>Hello. 
 I have pa/lna on my device. It works properly in application (rssi is about 30 dbm). But when application goes into bootloader (dfu over ble using nrfconnect on android) rssi is about 95-100 dbm. 
 I tried to add pa/lna init to secure_bootloader</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Aug 2019 11:48:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50687/pa-lna-in-bootloader" /><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/203289?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 11:48:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ebe6b97-f758-4e0d-b84b-435311796b68</guid><dc:creator>Zhenya Zh</dc:creator><description>&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/203271?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 10:53:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c12569f5-6568-4bb3-9e81-44deae181c76</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see your point, but I do not see a good way to do this without modifying the DFU library code. The reason is that there is no sensible way to put this in the example bootloader project since it has to be done after the SoftDevice is initialized. (It wold be tempting to implement the nrf_dfu_init_user() function and put it there, but this will not work since it is called before&amp;nbsp;nrf_dfu_init(), which is when the transport is initialized).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/203257?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 10:23:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68b1d2a6-cfd7-4439-9e9c-21dab57d95bf</guid><dc:creator>Zhenya Zh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think it is not a good idea beacause i need to modify sdk. Can I do it in my *.c files?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/202951?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 06:24:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2c4e2ce-597f-4605-936a-3a2284e953f3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am sorry for the late reply.&lt;/p&gt;
&lt;p&gt;I am glad to hear you got it working.&amp;nbsp;Why is it not a good idea to do the PA/LNA configuration in&amp;nbsp;ble_dfu_transport_init()? I would say that is exactly where you should put it in the bootloader since that is where the SoftDevice (BLE stack) is initialized.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/202660?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 13:56:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53ebe1b4-3a72-40e3-9910-9089cb4358f4</guid><dc:creator>Zhenya Zh</dc:creator><description>&lt;p&gt;I fix this problem by adding pa/lna init at&amp;nbsp;ble_dfu_transport_init() fucntion in nrf_dfu_ble.c after ble_stack_init().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But I do not think this is a good solution. How to solve this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/202645?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 13:19:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe24be46-7221-4a34-b9f4-40dd1c93d833</guid><dc:creator>Zhenya Zh</dc:creator><description>&lt;p&gt;I did some experiments:&lt;/p&gt;
&lt;p&gt;1. I use this script:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil settings generate --family NRF52840 --application ../Output/Debug/Exe/app.hex --application-version 0 --bootloader-version 0 --bl-settings-version 1 bootloader_setting.hex
mergehex --merge s140_nrf52_6.1.0_softdevice.hex secure_bootloader_ble_s140_pca10056_debug.hex bootloader_setting.hex --output bl_with_sd.hex
mergehex --merge ../Output/Debug/Exe/app.hex bl_with_sd.hex --output my_app.hex
nrfjprog --family NRF52 --reset --program my_app.hex --chiperase --verify&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And in my app I call function&amp;nbsp;ble_dfu_buttonless_bootloader_start_prepare() after&amp;nbsp;ble_dfu_support_service_init() and device enter bootloader mode. &lt;strong&gt;Result&lt;/strong&gt;: rssi over 90-100.&lt;/p&gt;
&lt;p&gt;2. I use this script:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;mergehex --merge s140_nrf52_6.1.0_softdevice.hex secure_bootloader_ble_s140_pca10056_debug.hex bootloader_setting.hex --output bl_with_sd.hex
nrfjprog --family NRF52 --reset --program bl_with_sd.hex --chiperase --verify&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;span&gt;: rssi over 20-30.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My changes in secure_bootloader code are adding&amp;nbsp;pa_lna_start() function and initialization pins before&amp;nbsp;nrf_bootloader_init().&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/202584?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 11:18:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69b3b4c9-1129-4a67-af8e-cc8bfffe2ad1</guid><dc:creator>Zhenya Zh</dc:creator><description>&lt;p&gt;Where could I add&amp;nbsp;&lt;span&gt;PA/LNA&lt;/span&gt; init in secure_bootloader code? Before&amp;nbsp;nrf_bootloader_init()?&lt;/p&gt;
&lt;p&gt;My configuration for the PA/LNA. This code the same in the bootloader and application.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void pa_lna_start(uint32_t gpio_pa_pin, uint32_t gpio_lna_pin)
{
    uint8_t err_code;

    static const uint32_t gpio_toggle_ch = 0;
    static const uint32_t ppi_set_ch = 0;
    static const uint32_t ppi_clr_ch = 1;
    
    // Configure SoftDevice PA/LNA assist
    ble_opt_t opt;
    memset(&amp;amp;opt, 0, sizeof(ble_opt_t));
    // Common PA/LNA config
    opt.common_opt.pa_lna.gpiote_ch_id  = gpio_toggle_ch;        // GPIOTE channel
    opt.common_opt.pa_lna.ppi_ch_id_clr = ppi_clr_ch;            // PPI channel for pin clearing
    opt.common_opt.pa_lna.ppi_ch_id_set = ppi_set_ch;            // PPI channel for pin setting
    // PA config
    opt.common_opt.pa_lna.pa_cfg.active_high = 1;                // Set the pin to be active high
    opt.common_opt.pa_lna.pa_cfg.enable      = 1;                // Enable toggling
    opt.common_opt.pa_lna.pa_cfg.gpio_pin    = gpio_pa_pin;      // The GPIO pin to toggle
  
    // LNA config
    opt.common_opt.pa_lna.lna_cfg.active_high  = 1;              // Set the pin to be active high
    opt.common_opt.pa_lna.lna_cfg.enable       = 1;              // Enable toggling
    opt.common_opt.pa_lna.lna_cfg.gpio_pin     = gpio_lna_pin;   // The GPIO pin to toggle
    
    err_code = sd_ble_opt_set(BLE_COMMON_OPT_PA_LNA, &amp;amp;opt);
    NRF_LOG_INFO(&amp;quot;pa_lna_assist end, result: %d, error: %s&amp;quot;, err_code, nrf_strerror_get(err_code));
//    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t understand why when downloading&amp;nbsp;the bootloader to erased device everything works, but when I enter the bootloader mode from the application it doesn&amp;rsquo;t work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PA/LNA in bootloader</title><link>https://devzone.nordicsemi.com/thread/202581?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 11:12:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3847b94-dca9-40d4-98fa-1cb6c1da11f9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I assume the PA/LNA is controlled by GPIO pins using the PA/LNA support in the SoftDevice? Essentially this is just the SoftDevice asserting selected GPIO pins when there is radioactivity, so it is no different than controlling any other GPIO pins. It should be the same in the bootloader and application, but it has to be configured in both since the SoftDevice is initialized separately in the bootloader and application. Have you checked with a logic analyzer to see if the GPIO pins are controlled as expected? How do you configure the PA/LAN control in the SoftDevice and application?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>