Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Not able to run BLE when i configure any pin as input pin with PULLUP/PULLDOWN.

Hi Everyone

I have the following issue in my application code.

If i configure a pin as an input pin , i am not able to run the ble init function in which it advertises.

If i comment out the input pin configuration, i am able to run the ble part of program and it sends data successfully to the nrfconnect App.

Here is the code that i am using,.

Am i using the correct method to configure the pin as an input pin.(nrf_gpio_cfg_input(1,NRF_GPIO_PIN_PULLDOWN)) ?

If not ,then what is the proper way to perform this action.

Thanks

Rajat!

int main(void)
{

nrf_gpio_cfg_input(1, NRF_GPIO_PIN_PULLDOWN);
ble_init();
while(1)
{
ble_send("hello");   /*This works perfectly if i comment the nrf_gpio_cfg_input line*/
}
}

  • Hi,

     

    Are you by any chance using the external 32k crystal configuration (which is the default configuration in our examples)?

    If yes; try to avoid using P0.00 and P0.01, as the external 32k LFCLK uses those.

     

    Best regards,

    Håkon

  • I am assuming you are using the nRF52840 Preview Development kit. 

    Refer http://infocenter.nordicsemi.com/pdf/nRF52840_PDK_User_Guide_v1.0.pdf

    On the nRF52840 Preview DK board, P0.00 and P0.01 are by default used for the 32.768 kHz crystal and are not available as GPIO on the connectors.

    If P0.00 and P0.01 are needed as normal I/Os, the 32.768 kHz crystal can be disconnected and the GPIO routed to the connectors. Cut the shorting track on SB1 and SB2, and solder SB3 and SB4. See the figure below for reference.

    So I suggest you use a different pin.

  • Thanks for sharing this information 

    But i have tried this using P0.10 pin as well, still it gives me same results

    What should i do next?

    Thanks 

    Rajat!

  • Just got to know that 10 and 9 pins are default for NFC , so i am using P0.28 pin and tried . This did resolve my issue.

    But i have another question.

    I am using the same configuration p0.28 as BUSY pin for EPAPER display which uses the SPI protocol.

    But its not working while it works if i configure the BUSY pin on 0 pin.

    What can be the issue and is there something i am doing wrong

    Here is a piece of code that i am using for EPAPER.

    void ePaperInit(void)
    {
    //bsp_board_init(BSP_INIT_LEDS);
        //APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
        //NRF_LOG_DEFAULT_BACKENDS_INIT();
    
    //io init
    
    nrf_gpio_cfg_output(CS_PIN );
    nrf_gpio_cfg_output(EPAPER_DC);
    nrf_gpio_cfg_output(EPAPER_RST);
    nrf_gpio_cfg_input(EPAPER_BUSY, NRF_GPIO_PIN_PULLUP);   /*EPAPER BUSY =28*/
    //nrf_gpio_pin_dir_set(EPAPER_BUSY,NRF_GPIO_PIN_DIR_INPUT);
    nrf_gpio_cfg_output(LEDP);
    
    
    
    // spi init
    
    
    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
        spi_config.ss_pin   = SPI_SS_PIN;
      //  spi_config.miso_pin = SPI_MISO_PIN;
        spi_config.mosi_pin = SPI_MOSI_PIN;
        spi_config.sck_pin  = SPI_SCK_PIN;
     //   APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));
    nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL);
    
    nrf_gpio_pin_write(LEDP,0);
    nrf_delay_ms(2000);
    
    // off the led 1
    nrf_gpio_pin_write(LEDP,1);
    
    }
    

  • Hi,

     

    But its not working while it works if i configure the BUSY pin on 0 pin.

    Are you using P0.28 for something else? This is normally used for the default SPI communication, and if you're not using the MISO pin, set it equal to "NRF_DRV_SPI_PIN_NOT_USED".

     

    Best regards,

    Håkon

     

Related