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

Issue while debugging ble_app_uart program on nRF52832 in IAR IDE version 8.20.1.

I am facing issues in debugging  ble_app_uart program available in nRF5 SDK.  I am trying to debug it on IAR workbench using Jlink PLUS debugger in SWD mode. 

I could connect and download the program. but whenever program calls sd_softdevice_enable() function for enabling soft device it hangs. 

Details about setup. 

  • controller       : nRF52832 (512KB flash) on Fanstel module BC832 
  • Debugger      : Segger Jlink Plus in 6 pin SWD mode. 
  • IDE                : IAR workbench v 8.20.1 
  • SDK version  : nRF5_SDK_15.2.0_9412b96
  • Test program : nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_uart

I have added additional command to download Soft device \nRF5_SDK_15.2.0_9412b96\components\softdevice\s132\hex\s132_nrf52_6.1.0_softdevice.hex at address location 0x0000

I could program and debug normal application that does not involve Soft Device. e.g. nRF5_SDK_15.2.0_9412b96\examples\peripheral\uart.

When program involves soft device; after accessing softdevice related APIs, IDE hangs and we can not further debug the program.

 

Parents
  • Hi.

    It looks like the Fanstel BC832 does not have any on-board crystal, it therefore "hangs" when you call sd_softdevice_enable().

    You have to edit a define in sdk_config.h

    Change this:

    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 1
    #endif

    To this:

    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif

    Try this.

    Best regards,

    Andreas

  • Thanks for the input, but with the option NRF_SDH_CLOCK_LF_SRC set to 0,  I am getting following

    Error[Pe035]: #error directive: Please select NRF_CLOCK_LF_ACCURACY_500_PPM when using NRF_CLOCK_LF_SRC_RC C:\Users\cpendhs\git\ncs\nRF5_SDK_15.2.0_9412b96\components\softdevice\common\nrf_sdh.c 78 

    for this issue I am left with 2 option

    Option 1 
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC NRF_CLOCK_LF_SRC_RC
    #endif
    
    //AND 
    
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY NRF_CLOCK_LF_ACCURACY_500_PPM
    #endif


    Or second option would be 
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC NRF_CLOCK_LF_SRC_SYNTH
    #endif


    What would be better option out of these two. 

Reply
  • Thanks for the input, but with the option NRF_SDH_CLOCK_LF_SRC set to 0,  I am getting following

    Error[Pe035]: #error directive: Please select NRF_CLOCK_LF_ACCURACY_500_PPM when using NRF_CLOCK_LF_SRC_RC C:\Users\cpendhs\git\ncs\nRF5_SDK_15.2.0_9412b96\components\softdevice\common\nrf_sdh.c 78 

    for this issue I am left with 2 option

    Option 1 
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC NRF_CLOCK_LF_SRC_RC
    #endif
    
    //AND 
    
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY NRF_CLOCK_LF_ACCURACY_500_PPM
    #endif


    Or second option would be 
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC NRF_CLOCK_LF_SRC_SYNTH
    #endif


    What would be better option out of these two. 

Children
No Data
Related