This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf51822 crystal issue?

FIrst timer with the nordic.. so i could use some help.

i've tried my code on the eval kit and it worked fine. On my custom board (has external 16MHz crystal www.digikey.com/.../1693950) during the

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, false);

it seems to get all the way through the softdevice_handler_init() where it sets m_softdevice_enabled=true.

However, during the next line (return sd_nvic_EnableIRQ(SWI_IRQn)) it immediatly goes into the app_error_handler with error code 2.

I think i have the 32KHz internal RC working, and i followed the guidelines (i think) on the external 16MHz. yet when i scope the crystal, i am not seeing what i would expect (see attachment). Do i have to configure the 51822 to actually use it? I am trying the ble_hrs sample app for this.IMG_1684.JPG

Parents
  • You should compare the returned error code with the errors listed above the function in the API documentation (the function can be found by using Find in Files).

    /**@brief Enable External Interrupt.
     * @note Corresponds to NVIC_EnableIRQ in CMSIS.
     *
     * @pre{IRQn is valid and not reserved by the stack}
     *
     * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS.
     *
     * @retval ::NRF_SUCCESS The interrupt was enabled.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE The interrupt is not available for the application.
     * @retval ::NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED The interrupt has a priority not available for the application.
     */
    SVCALL(SD_NVIC_ENABLEIRQ, uint32_t, sd_nvic_EnableIRQ(IRQn_Type IRQn));
    

    The returned error code will be in hexadecimal format, use "Go To Definition Of '...'" to find the error code of the different errors. You can use CTRL+- to navigate backwards.

    Error code 0x2002 corresponds to NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED.

    What happends if you change SWI_IRQn to SWI2_IRQn?

  • The error code is 0x00000002, which means "SoftDevice has not been enabled". What issues can lead to this problem?

Reply Children
No Data
Related