蓝牙芯片nRF5283的那些坑

1. P0.09/ P0.10的默认配置

nRF52832的P0.09,P0.10引脚除了GPIO还可以被用作NFC天线,在SDK的默认配置中为NFC天线引脚,发现配置称ouput不正常工作。发现在system_rf52.c中有段代码将其配置称了默认的NFC功能。

    /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
       two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
       normal GPIOs. */
    #if defined (CONFIG_NFCT_PINS_AS_GPIOS)
        if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NVIC_SystemReset();
        }
    #endif

注释掉该段代码或者在适当的地方增加CONFIG_NFCT_PINS_AS_GPIOS 的定义即可。

#define CONFIG_NFCT_PINS_AS_GPIOS 1

(2020/2/26日记)

2. 广播时间设置

默认的广播事件为3分钟, 在 advertising_init中,将flags从BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE改为BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE,并修改APP_ADV_DURATION 为自己所需的时间,如果APP_ADV_DURATION 设置成0,则永远广播。

#define APP_ADV_DURATION                18000                                       /**< The advertising duration (180 seconds) in units of 10 milliseconds. */
static void advertising_init(void)
{
    ...
    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    ...
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;
}

3. Jlink ARM.DLL返回错误

按照大家的建议:

  1. 检查注册表:http://blog.sina.com.cn/s/blog_146fdbb660102wuw1.html

2.检查 jflash的序列号:https://blog.csdn.net/sinat_33323544/article/details/81082280

发现都没有问题,最后排查下来,发现jlink的3.3V供电电和reset都接了,把这两个pin连接断开开,采用外部供电就好了。

你可能感兴趣的:(蓝牙芯片nRF5283的那些坑)