<?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>Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57123/cannot-control-gpios-on-custom-board-when-using-softdevice</link><description>Hi everyone, 
 my problem is pretty simple: we developed a custom board for the NRF52840 to work using a custom protocol or BLE. A few sensors are connected to the NRF using 
 I2C, and a few GPIOs are connected to LEDs for debugging. I created a custom</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jan 2020 07:51:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57123/cannot-control-gpios-on-custom-board-when-using-softdevice" /><item><title>RE: Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/thread/231788?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 07:51:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38a74986-d266-4c3a-99f0-fbcfcd036b80</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;I found the problem!&lt;/p&gt;
&lt;p&gt;For some reason in the preprocessor defines, there was an NRF52 before NRF52840_XXAA.&lt;/p&gt;
&lt;p&gt;The NRF52 define was overwriting something, so that the file nrf52832_peripherals.h was included instead of the nrf52840_peripherals.h. Because of this, in nrf_gpio.h the NUMBER_OF_PINS define was set to a wrong value, so essentially the pins &amp;gt; 32 where not taken into account.&lt;/p&gt;
&lt;p&gt;So, essentially, there was nothing wrong with the softdevice, but it was in the setup of our&amp;nbsp;preprocessor definitions.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/thread/231727?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 15:40:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3cbe665-9267-473c-997d-142411082b50</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t use any bsp function; I am working on a custom board, so I don&amp;#39;t use bsp functions at all.&lt;/p&gt;
&lt;p&gt;This is my main code; as you see there is nothing special. And the myBoard_ functions are the same with or without softdevice.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for application main entry.
 */
int main(void)
  {
    nrf_delay_ms(1000);
    ret_code_t err_code;

    log_init();
    APP_ERROR_CHECK(err_code);

    // Initialize.
    timers_init();
    myBoard_SetUpGPIOs();
    myBoard_SetupI2C();  
    nrf_delay_ms(500);

    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
    peer_manager_init();
    nrf_ble_pairing_init(); 

    APP_ERROR_CHECK(err_code);
    application_timers_start(); 
    advertising_start(false);

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As I said before, if I write directly in the P1 registers, I can control the pins normally. If I try using the NRF_GPIO_PIN_MAP function this does not have any effect.&lt;/p&gt;
&lt;p&gt;By the way, my LEDs are on P1.02, P1.04 and P1.06. Even if I avoid using the NRF_GPIO_PIN_MAP and I pass the value of the pin (for example, if I call nrf_gpio_pin_set(34)), there is no effect.&lt;/p&gt;
&lt;p&gt;It seems that for some reason all values &amp;gt; 31 are not taken into account by the gpio functions.....&lt;/p&gt;
&lt;p&gt;Again, if I don&amp;#39;t use the SD then all works perfectly.&lt;/p&gt;
&lt;p&gt;For the moment I am using a workaround, but this could create serious problems later, because I have&amp;nbsp;mapped the SPI on 4 pins which are in port P1, and if this does not work properly then I don&amp;#39;t know what to do.....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/thread/231712?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 15:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d41202b-78ce-4b1c-acfc-b993081fa534</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Lorenzo,&lt;/p&gt;
&lt;p&gt;The Softdevice should not have any impact on this. It does not use any GPIOs. Are there any other differences between these two apart from the Softdevice that you can think of? Can you read back the GPIO configuration registers to confirm they are not overwritten (by bsp_init(), bsp_btn_ble_init(), etc)?&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/thread/231706?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 14:55:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfd23365-4176-4c6b-aa69-02eda852322b</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;For those who are interested, I found the problem&amp;nbsp;and a workaround. I am working on SDK 15.0.0, soI am not sure if this was fixed in successive releases, but apparently the macro NRF_GPIO_PIN_MAP does not work properly for mapping Port 1 pins (all pins from P1.00 to P1.15) when the softdevice is used.&lt;/p&gt;
&lt;p&gt;I was able to switch on and off my pins by configuring the port directly, so for my custom board I&amp;nbsp;configured all the P1.xx pins as outputs with the instruction&lt;/p&gt;
&lt;p&gt;NRF_P1 -&amp;gt; DIRSET = 0xFFFF&lt;/p&gt;
&lt;p&gt;and I&amp;nbsp;switch off all the pins with&lt;/p&gt;
&lt;p&gt;NRF_P1 -&amp;gt; OUTSET = 0x0000&lt;/p&gt;
&lt;p&gt;Then by writing individual bits, I can control the desired pin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot control GPIOs on custom board when using SoftDevice</title><link>https://devzone.nordicsemi.com/thread/231697?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 14:42:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d077dfc9-180c-46a4-8f6a-89dbe49d6bf6</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;I add a new information that may be useful to propose solutions....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Apparently, I have the same problem with other signals which are on the port P1....so essentially when I use the SoftDevice, it seems that the NRF_GPIO_PIN_MAP function does not work correctly when it needs to configure Port 1.....As said before, when I don&amp;#39;t use the SD, there is no problem at all.&lt;/p&gt;
&lt;p&gt;Is there a known issue with NRF_GPIO_PIN_MAP on port 1 when using a softdevice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>