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

if initial uart_config() before ble_stack_init(), softdevice_handler_init will be failed!

if initial uart_config() before ble_stack_init(), softdevice_handler_init will be failed! with SDK 6.0

softdevice_handler_init() will returns 0x00001001 ("NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION).

it is nothing to do with "NRF_CLOCK_LFCLKSRC_XTAL_20_PPM". .so i initial uart_config() after ble_stack_init(), then it is ok..

what's the problem?

Parents
  • Hi,

    What interrupt priority are you setting in your uart_init() function? To work with the softdevice this shall be either '1' or '3' (APP_IRQ_PRIORITY_LOW or APP_IRQ_PRIORITY_HIGH)

    Cheers, Håkon

  • void uart_config(uint8_t txd_pin_number, uint8_t rxd_pin_number) { rxwp = 0; rxrp = 0; nrx = 0;

    nrf_gpio_cfg_output(txd_pin_number);
    nrf_gpio_cfg_input(rxd_pin_number, NRF_GPIO_PIN_NOPULL);  
    
    NRF_UART0->PSELTXD          = txd_pin_number;
    NRF_UART0->PSELRXD          = rxd_pin_number;
    
    NRF_UART0->BAUDRATE         = (UART_BAUDRATE_BAUDRATE_Baud38400 << UART_BAUDRATE_BAUDRATE_Pos);
    NRF_UART0->ENABLE           = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);
    NRF_UART0->TASKS_STARTTX    = 1;
    NRF_UART0->TASKS_STARTRX    = 1;
    NRF_UART0->EVENTS_RXDRDY    = 0;     
    NRF_UART0->INTENSET        |= (UART_INTENSET_RXDRDY_Enabled << UART_INTENSET_RXDRDY_Pos );
    
    NVIC_EnableIRQ(UART0_IRQn);
    

    }

Reply
  • void uart_config(uint8_t txd_pin_number, uint8_t rxd_pin_number) { rxwp = 0; rxrp = 0; nrx = 0;

    nrf_gpio_cfg_output(txd_pin_number);
    nrf_gpio_cfg_input(rxd_pin_number, NRF_GPIO_PIN_NOPULL);  
    
    NRF_UART0->PSELTXD          = txd_pin_number;
    NRF_UART0->PSELRXD          = rxd_pin_number;
    
    NRF_UART0->BAUDRATE         = (UART_BAUDRATE_BAUDRATE_Baud38400 << UART_BAUDRATE_BAUDRATE_Pos);
    NRF_UART0->ENABLE           = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);
    NRF_UART0->TASKS_STARTTX    = 1;
    NRF_UART0->TASKS_STARTRX    = 1;
    NRF_UART0->EVENTS_RXDRDY    = 0;     
    NRF_UART0->INTENSET        |= (UART_INTENSET_RXDRDY_Enabled << UART_INTENSET_RXDRDY_Pos );
    
    NVIC_EnableIRQ(UART0_IRQn);
    

    }

Children
No Data
Related