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

Zephyr project (nrfConnect) nrf52840 catch disconnect and not advertyse when use PPI channels for ADC and GPIO

I use PPI for ADC and GPIO pulling. When I connect and then disconnect - nrf52840 not advertise until reset the SoC.

        IRQ_CONNECT(DT_IRQN(DT_NODELABEL(adc)),
		    DT_IRQ(DT_NODELABEL(adc), priority),
		    nrfx_saadc_irq_handler, NULL, 0);

        adc_configure();
        ppi_init();
        timer_init();

        IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)),
		    DT_IRQ(DT_NODELABEL(gpiote), priority),
		    nrfx_isr, nrfx_gpiote_irq_handler, 0);
		    
        nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);

    nrf_gpio_cfg_output(DO_OUTPUT_0); 
    nrf_gpio_cfg_output(DO_OUTPUT_1);
    nrf_gpio_cfg_output(DO_OUTPUT_2); 
    nrf_gpio_cfg_output(DO_OUTPUT_3);
    nrf_gpio_cfg_output(DO_OUTPUT_4); 
    nrf_gpio_cfg_output(DO_OUTPUT_5);
    nrf_gpio_cfg_output(DO_OUTPUT_6); 
    nrf_gpio_cfg_output(DO_OUTPUT_7);
    nrf_gpio_cfg_output(LED_PIN_G); 

    nrf_gpio_cfg_input(DI_INPUT_0, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_1, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_2, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_3, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_4, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_5, NRF_GPIO_PIN_PULLUP);  
    nrf_gpio_cfg_input(DI_INPUT_6, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_7, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_8, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_9, NRF_GPIO_PIN_PULLUP); 
    nrf_gpio_cfg_input(DI_INPUT_10, NRF_GPIO_PIN_PULLUP); 									

    nrfx_gpiote_in_config_t cfg_wdt = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
    cfg_wdt.pull = NRF_GPIO_PIN_PULLDOWN;
    nrfx_gpiote_in_init(TIM_WAKE, &cfg_wdt, evt_handler1);
    nrfx_gpiote_in_event_enable(TIM_WAKE, true);

    nrfx_gpiote_in_config_t inConfig = NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);		
    inConfig.pull = NRF_GPIO_PIN_PULLUP;					

    nrfx_gpiote_in_config_t rtcConfig = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);		
    rtcConfig.pull  = NRF_GPIO_PIN_PULLUP;			

    nrfx_gpiote_in_init(RTC_PIN,     &rtcConfig,  evt_handler2);

    nrfx_gpiote_in_event_enable(RTC_PIN,     true);

I can connect after reset. But when I disconect then I will not able to connect again because of there is no advertising anymore until reset.

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UART0=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_NFCT_PINS_AS_GPIOS=y

CONFIG_NEWLIB_LIBC=y
CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y

#EXT WDT
CONFIG_GPIO=n
CONFIG_NRFX_GPIOTE=y

# Enable the BLE stack with GATT Client configuration
CONFIG_BT=y
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_SETTINGS=y

CONFIG_SETTINGS_NONE=y
CONFIG_BT_GATT_CACHING=n
CONFIG_BT_GATT_CLIENT=y

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=n

CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_USER_PHY_UPDATE=y
#CONFIG_BT_CTLR_SYNC_PERIODIC=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

#CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=5000
#CONFIG_BT_BACKGROUND_SCAN_INTERVAL=100
#CONFIG_BT_BACKGROUND_SCAN_WINDOW=80
CONFIG_BT_CREATE_CONN_TIMEOUT=3
CONFIG_BT_ATT_PREPARE_COUNT=18
CONFIG_BT_MAX_CONN=18

CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=247
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=n
CONFIG_BT_CTLR_CONN_RSSI=y
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR=y
CONFIG_BT_HCI=y

#PERIPHERAL
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="RECLOUSER"

CONFIG_BT_GATT_NOTIFY_MULTIPLE=y

CONFIG_WATCHDOG=y
CONFIG_NRFX_WDT=y
CONFIG_NRFX_WDT0=y

CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
#CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
#CONFIG_BT_PERIPHERAL_PREF_MAX_INT=15
#CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY=0
#CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=50

CONFIG_BT_L2CAP_TX_MTU=259
CONFIG_BT_BUF_ACL_RX_SIZE=259
CONFIG_MAIN_STACK_SIZE=8192

#CLOCK_CONTROL
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_TIMER1=y
CONFIG_NRFX_SAADC=y
CONFIG_BOARD_ENABLE_DCDC=n
CONFIG_NRFX_PPI=y

### Enable SMP server ###
# FOR NCS auto make image
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION="0.0.6"

#Useless
#CONFIG_MCUMGR_CMD_FS_MGMT=y
#CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
#CONFIG_FILE_SYSTEM=y

Where I may make mistake?

Parents
  • Hello!

    Are you getting any error messages printed over serial?

    Or is this only noticeable in that it stops advertising?

    Best regards,

    Einar

  • Hi! Thanks for reply.

    I dont receive any error messages. The programm continue to run. I see periodic debug messages, but no advertising.

    I include RESUME and START procedure of advertising but didnt get any result only message (22 or 12)

    When I reset SoC it works. But after connect and disconnect it stops work.

    It happen when I include PPI event for ADC and GPIO

Reply
  • Hi! Thanks for reply.

    I dont receive any error messages. The programm continue to run. I see periodic debug messages, but no advertising.

    I include RESUME and START procedure of advertising but didnt get any result only message (22 or 12)

    When I reset SoC it works. But after connect and disconnect it stops work.

    It happen when I include PPI event for ADC and GPIO

Children
No Data
Related