This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_gpio_set and clear function are not working with softdevice enabled

Hey Everyone

I have written a code for using lora rn2483 with nrf52840 using the uart protocol which is configured on 7 and 5 pin. The program was working fine untill i enabled softdevice and included all the files in it.

The gpio set and clear function seems not to be working with softdevice enabled.

I need to use these functions in order to enable the rn2483 module.

I also tried these functions with the ble_app_uart example but they are not working .

Do i need to change some settings or something else?

Kindly help ,its URGENT!

Rajat!

Parents
  • Hi,

    There is nothing in the softdevice that prevents you from controlling GPIOs. Which pins are you trying to set/clear?

    Please post code showing what you are doing, and explain in more details how it is not working.

    Best regards,
    Jørgen

  • Hi

    Thanks for quick action!
    I am provding the piece of code. 

    If i put a breakpoint on the line read_until function.

    The debugger never stops at that point , however if i put a breakpoint on bsp_board_led_on function ,the debugger pauses at that point.

    If i put a breakpoint on nrf_gpio_pin_set function, The breakpoint red dot shows a question mark on it.

    What does it mean and what can be the issue.

    I am using UART on pin 5 as TX and pin 7 as RX. with HWFC DISABLED.

    PIN RST IS P0.04

    int main(void)
    {
    bsp_board_init(BSP_INIT_LEDS);                    /*INITIALIZE ON BOARD LEDS*/
    uart_init_terra(rx_pin,tx_pin);                   /*UART MODULE  INITIALIZED WITH 57600 and pin7 and pin5 as rx and tx*/
    nrf_delay_ms(200);                                
    nrf_gpio_cfg_output(PIN_RST);                     /*RST(P0.04) AS OUTPUT*/
    //uart_write_data("",1);                            /**/
    app_uart_flush();
    nrf_delay_ms(200);
    bsp_board_led_on(BSP_BOARD_LED_0);                /*TURN ON THE LED*/
    
    nrf_gpio_pin_clear(PIN_RST);                      /*RST PIN LOW*/
    nrf_delay_ms(500);
    nrf_gpio_pin_set(PIN_RST);                        /*RST PIN HIGH*/
    nrf_delay_ms(500);
    
    #ifdef DEBUG_CODE
    read_until(0x0A);
    printf("Data : %s", vikram);
    clear_buffer();
    #endif
    }
    
    void read_until(char end)
    {
    
    volatile int cnt=0;
    
    while((vikram[cnt++]=uart_read_data())!=end );                  /*READING AND APPENDING DATA 
                                                                    UNTILL END IS REACHED*/
    vikram[cnt]=0;
    }
    
    void clear_buffer()
    {
    volatile int m=0;
    while(m!=25)
    {
    vikram[m++]=0;
    
    }
    
    
    char  uart_read_data(void)
    {
    char  rx_data;
    
    while (app_uart_get(&rx_data) != NRF_SUCCESS);
    return rx_data;
    }
    
    

Reply
  • Hi

    Thanks for quick action!
    I am provding the piece of code. 

    If i put a breakpoint on the line read_until function.

    The debugger never stops at that point , however if i put a breakpoint on bsp_board_led_on function ,the debugger pauses at that point.

    If i put a breakpoint on nrf_gpio_pin_set function, The breakpoint red dot shows a question mark on it.

    What does it mean and what can be the issue.

    I am using UART on pin 5 as TX and pin 7 as RX. with HWFC DISABLED.

    PIN RST IS P0.04

    int main(void)
    {
    bsp_board_init(BSP_INIT_LEDS);                    /*INITIALIZE ON BOARD LEDS*/
    uart_init_terra(rx_pin,tx_pin);                   /*UART MODULE  INITIALIZED WITH 57600 and pin7 and pin5 as rx and tx*/
    nrf_delay_ms(200);                                
    nrf_gpio_cfg_output(PIN_RST);                     /*RST(P0.04) AS OUTPUT*/
    //uart_write_data("",1);                            /**/
    app_uart_flush();
    nrf_delay_ms(200);
    bsp_board_led_on(BSP_BOARD_LED_0);                /*TURN ON THE LED*/
    
    nrf_gpio_pin_clear(PIN_RST);                      /*RST PIN LOW*/
    nrf_delay_ms(500);
    nrf_gpio_pin_set(PIN_RST);                        /*RST PIN HIGH*/
    nrf_delay_ms(500);
    
    #ifdef DEBUG_CODE
    read_until(0x0A);
    printf("Data : %s", vikram);
    clear_buffer();
    #endif
    }
    
    void read_until(char end)
    {
    
    volatile int cnt=0;
    
    while((vikram[cnt++]=uart_read_data())!=end );                  /*READING AND APPENDING DATA 
                                                                    UNTILL END IS REACHED*/
    vikram[cnt]=0;
    }
    
    void clear_buffer()
    {
    volatile int m=0;
    while(m!=25)
    {
    vikram[m++]=0;
    
    }
    
    
    char  uart_read_data(void)
    {
    char  rx_data;
    
    while (app_uart_get(&rx_data) != NRF_SUCCESS);
    return rx_data;
    }
    
    

Children
No Data
Related