鬼才小武 发表于 2019-4-28 17:51:58

各位帮看看遇到一个棘手问题 1301 动态配置频段 发现延迟...

由于客户要求将1301做成了单信道平台下发修改频段指令配置不同频段 平台 配置频段1301参数比较频繁 代码在下面遇到问题是每次重新配置必须要 lgwstop 然后 再lgwstart 但是发现配置完后 这个时间比较长 要3秒左右 由于我集中器配置完就马上抄表了 这个3秒时间太长了平台而且是 每10秒就要配置一次频段参数 导致时间大大拉长而且我发现 调用 lgwsop    lgwstart 这组函数频繁的话 会出现如下错误   我的整体配置代码在最下面 有遇到过解决了这个问题的请指教
lgw_start:999: ERROR: Version of AGC firmware not expected, actual:2 expected:4
2019-04-28 13:53:23.564 lgw_pkt_entry.c: ERROR: failed to start the concentrator

void lgwparaConfigure(uint32_t freq) {

    int ret = -1;
    static uint32_t Prefreq = 0;
    struct lgw_conf_rxif_s ifconf;
    struct lgw_conf_rxrf_s rfconf;

    ret = lgw_stop();

    if(ret != LGW_HAL_SUCCESS) {

      goto ERRON_EXIT;
    }

    if(!access(global_cfg_path, R_OK)) {

      CULog("INFO:found global configuration file %s and parse it", global_cfg_path);

      int ret = pare_sx1301_configuration(global_cfg_path);

      if(ret != 0) {

            goto ERRON_EXIT;
      }
    }

    memset(&rfconf, 0, sizeof(rfconf));
    memset(&ifconf, 0, sizeof(ifconf));
    rfconf.enable = true;
    rfconf.freq_hz = freq;
    rfconf.rssi_offset = -166.0;
    rfconf.type = LGW_RADIO_TYPE_SX1255;
    rfconf.tx_enable = true;
    rfconf.tx_notch_freq = DEFAULT_NOTCH_FREQ;
    lgw_rxrf_setconf(0, rfconf); /* radio A, f0 */

    ifconf.enable = true;
    ifconf.rf_chain = 0;
    ifconf.freq_hz = 0;
    ifconf.datarate = DR_LORA_SF8;
    lgw_rxif_setconf(0, ifconf);

    ret = lgw_start();

    if(ret == LGW_HAL_SUCCESS) {
      CULog("INFO: concentrator started, packet can now be received\n");
    }
    else {
      CULog("ERROR: failed to start the concentrator\n");
      goto ERRON_EXIT;
    }
       
    pthread_mutex_lock(&pthread_mutex_recvlock);
    lgw_recvflag = true;
    pthread_mutex_unlock(&pthread_mutex_recvlock);


    return;

ERRON_EXIT:

    if(raise(SIGINT) == -1) {

      CULog("WARNING:singnal raise fail.");
      exit(EXIT_FAILURE);
    }
}




页: [1]
查看完整版本: 各位帮看看遇到一个棘手问题 1301 动态配置频段 发现延迟...