Hi, i build my own custom board with a NRF52832, i'm having problem with the softdevice (i think so)... my code is base on BLE s132 central and peripheral...
I developed the code and test on a NRF52 DK and it worked all right, everything was ok..
I test a simple code (toggle Leds) in my custom board and it worked ok (No softdevice)
I load the softdevice s130 and the code (central device) and my custom board get reset and start again.. I can see when the scanning led turn on and inmediatily restart and start again..
I'm going to paste my init code. Hope you can help me.
MAIN:
int main(void)
{
entrada3=1;
entrada4= 1;
ret_code_t err_code;
leds_init();
ble_stack_init();
setear_direccion_central();
db_discovery_init();
nus_c_init();
// Start scanning for peripherals and initiate connection to devices which
scan_start();
for (;;)
{
// Wait for BLE events.
power_manage();
}
}
BLE_STACK_INIT()
static void ble_stack_init(void)
{
ret_code_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
// Initialize the SoftDevice handler module.
// THE CODE STOPS WHEN THE LINE DOWN is EXCECUTED.
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
ble_enable_params_t ble_enable_params;
err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
PERIPHERAL_LINK_COUNT,
&ble_enable_params);
APP_ERROR_CHECK(err_code);
//Check the ram settings against the used number of links
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
// Enable BLE stack.
err_code = softdevice_enable(&ble_enable_params);
APP_ERROR_CHECK(err_code);
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
}
NRF_CLOCK_LFCLKSRC:
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL , \
.rc_ctiv = 0, \
.rc_temp_ctiv = 0, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
SCAN_START()
static void scan_start(void)
{
scantime++;
ret_code_t err_code;
int8_t tx_power =-40;
err_code = sd_ble_gap_scan_stop();
// It is okay to ignore this error since we are stopping the scan anyway.
if (err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
sd_ble_gap_tx_power_set(tx_power);
err_code = sd_ble_gap_scan_start(&m_scan_param);
APP_ERROR_CHECK(err_code);
led_scanning();
}