Beacon Play Set Sev Name

21个帖子/ 0新
最后一篇
anthony42
Offline
最后一次露面:5 years 6 months ago
加入:2015-07-17 08:21
Beacon Play Set Sev Name

Hi,

  • how to add Write Dev Name and Read Ori Dev Name Characteristic
  • 为什么写开发名称和读取ori dev name使用相同的索引?

    DIS_IDX_IEEE_CHAR,
    dis_idx_ieee_val,
    DIS_IDX_PNP_ID_CHAR,
    dis_idx_pnp_id_val,
    dis_idx_nb,

    // PNP ID特征声明
    [dis_idx_pnp_id_char] = {att_decl_characterativom,perm(rd,启用),sizeof(dist_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    //PnP ID Characteristic Value
    [dis_idx_pnp_id_val] = {att_char_pnp_id,perm(rd,启用),dis_pnp_id_len,0,null},

    //Read Write Dev Name Characteristic Declaration
    [dis_idx_pnp_id_char] = {att_decl_characterativom,perm(rd,启用),sizeof(dist_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    //Read Write Dev Name Characteristic Value
    [dis_idx_pnp_id_val] = {att_char_pnp_id,perm(rd,启用),dis_pnp_id_len,0,null},

    //Read Ori Dev Name Characteristic Declaration
    [dis_idx_pnp_id_char] = {att_decl_characterativom,perm(rd,启用),sizeof(dist_pnp_id_char),
    sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
    //读取ori dev name特征值
    [dis_idx_pnp_id_val] = {att_char_pnp_id,perm(rd,启用),dis_pnp_id_len,0,null},

    • another question: can I add a 128bit characteristic in diss, and how?

    why? the smart phone app need to read write dev name from a 128bit uuid.
    can I change base on the original code, or do I have to rewrite the code like spotar_create_db_req_handler() ?
    Thank you!

    Device:
    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42,

    Hi antony42,

    I guess that you want to change the device's name from smartphone is that correct? You have to change the permmisions to the appropriate characteristics and handle the write commands to the da for the specific IDX, use SAMPLE128 as a reference (gattc_write_cmd_ind_handler). I suppose you can but you are going to change a profile that is defined by the SIG.

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi,MT_dialog,

    Hi,MT_dialog,
    绝对正确 !

  • in fact I need to configure several parameters from smartphone, include :Dev Name, Beacon UUID, Major ID, Minor ID, Measured Power, Adv interval , User Defined
  • 我需要将这些信息保存到Flash。
    can you give me some suggestions?
    非常感谢 !

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42,

    Hi antony42,

    我建议您不要更改普通的配置文件(您可能对其他设备有兼容性问题),而是可以将其与您的服务一起包含并创建新的自定义配置文件(Sample128教程),其中包含您需要的额外信息。正如我之前提到的那样,幻灯片是从蓝牙SIG定义的服务。您可以使用信标项目来处理您的邮件的广告。

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog,

    Hi MT_dialog,
    I tried but I can't get the right handle index when initialize the data.
    another question:
    why the product header in the following structure is different from AN-B-010 page10 ?
    来自Beacon Ref项目:
    #define PRODUCT_HEADER_POSITION 0x1F000
    //Product header for SUOTA
    struct product_header
    {
    uint8_t signature[2];
    UINT8_T版[2];
    UINT32_T保留[4];
    uint32_t config_offset;
    };
    struct product_header p_header;
    spi_flash_read_data((uint8_t*)&p_header, (unsigned long)PRODUCT_HEADER_POSITION, (unsigned long)sizeof(struct product_header));

    app_config_header_offset = p_header.config_offset;

    I printf the data, looks like:
    0x70 0x52 0x0 0x1 0x0 0x80 0x0 0x0 0x0 0x30 0x1 0x0 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
    same with AN-B-010 (signature 7052, version 0100, offset 1, offset 2)
    但是p_header.config_offset =?
    struct config_header也与AN-B-010不同

    Thank you!

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42

    Hi antony42

    你什么意思是不同的,你不能看到不her fields under the Offset #2 field? Thats because the other fields aren't being used from the Beacon application. You cant read the config_offset because you have to load the header in the SPI in order to read it, you can use the Smart Snippets Proprietary header programmer in order to set the config_offset and the beacon configurations.

    谢谢mt_dialog.。

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog,

    Hi MT_dialog,

    In UM-B-019 (beacon reference) 9.7.1 Memory map:
    配置存储使用双映像引导加载程序的存储映射。更具体地说,它使用
    如上所述,产品标题中的“保留”字段(Byte Offset 12)的前四个字节
    section 6.1 of [6], to define the memory address of the configuration area. The address must point at
    SPI Flash扇区的开始,并且没有其他信息必须存储在同一扇区中。
    where is section 6.1 of [6]
    the UM says use first four bytes of the ‘Reserved’ field to store Configuration address,

  • 什么product_header.config_offset for?
  • what field do I need to add to the following header txt file ?
  • struct product_header
    {
    uint8_t signature[2];
    UINT8_T版[2];
    UINT32_T保留[4];
    uint32_t config_offset;
    };
    now my header file(.txt file) is:
    2签名产品标题签名。必须包含0x7052
    2 version Product header version
    4 LE格式的图像标题#1的offset1内存偏移
    4 offset2 Memory offset of image header #2 in LE format
    opened with proprietary header programmer and set the right value 7052,0001,00800000,00300100.

    Thank you!

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42,

    Hi antony42,

    产品标题应在se的形式condary bootloader header. You can use the 12byte offset (BDaddress) or place some padding and use the 17byte (Reserved) offset in order to put the address of the Configuration header format. The product_header.config_offset will contain the offset of the product header that resides the address of the configuration header. You should add an extra field in the product_header.txt in order to place the address of the configuration header file. That configuration offset will point to the configuration header. The configuration data are placed below the configuration header in byte offset 64.

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_Dialog,

    Hi MT_Dialog,
    I don't fully understand.

    1. the header in second bootloader is :
    2. //product header structure
      typedef struct __productHeader {
      UINT8签名[2];
      uint8 version[2];
      uint32_t offset1;
      uint32_t offset2;
      S_ProductHeader;

    3. in beacon ref is:
    4. //Product header for SUOTA
      struct product_header
      {
      uint8_t signature[2];
      UINT8_T版[2];
      UINT32_T保留[4];
      uint32_t config_offset;//why this is different from above one?
      };

    5. 在AN-B-010 Page 10:
    6. 似乎是一个完整的版本。
      在此文件12-31保留
      32-37 BD Address ...

  • when I tried to add a field in the product_header.txt, it alerts error, "only support 4 parameters at most!" , so how to do it?
  • 我可以在程序中使用固定地址,所以始终读取0x1f000 + sizeof的配置数据(struct product_header)吗?
  • Thank you!

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42

    Hi antony42

    The above 2 structs are different because in beacon we don't specify the image offsets and we just add some
    padding uint32_t reserved[4].

    1-uint32_t for image offset1, 2-uint32_t for image offset2, 3-4 uint32_t for the dbaddress and some additional
    reserved data.

    In the beacon application if the CONFIGURATION is enabled you must add an extra field in the product
    例如,标题.... configOffset。然后在您制作产品_header.txt之后,您可以从智能播放
    snippets tool and add the values to the corresponding fields. The app_read_config_header will find the
    product_header and read the config_offset of the configuration header......from then the app_read_config
    数据将使用配置数据填充相应的结构。您可以使产品标题
    correspond to the stuct like this:

    创建一个product_header.txt文件并添加以下字段

    2 String Signature Product Header Signature(7052)
    2字符串版本产品标题版本
    16 Integer Reserved Reserved Padding
    4 Integer ConfigOffset Config

    Yes i suppose you can use a hardcoded address and read the configuration data from there.

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_Dialog,

    Hi MT_Dialog,

    1. I want to add a led to a beacon, when a device connected then turn the led on.
      I called led_on() in app_connection_func, set pin low,
      but the led only flash one time, I can not find where the io output was set high?
    2. in app_button_press_callback()

      app_adv_stop();
      Switch(app_advertise_mode)
      {
      case GAPM_ADV_NON_CONN:

      app_advertise_mode = GAPM_ADV_UNDIRECT;
      break;

      case GAPM_ADV_UNDIRECT:
      app_advertise_mode = GAPM_ADV_NON_CONN;
      break;
      }
      this will change the advertise mode, but it doesn't call app_adv_start(), so when the advertise mode will change?

    3. when do I need to define CFG_CONNECTABLE_ADV_MODE ?
      你能解释一下关于app_asynch_trm()的更多信息吗?

      this func also has the code:
      Switch(app_advertise_mode)
      {
      case GAPM_ADV_NON_CONN:

      app_advertise_mode = GAPM_ADV_UNDIRECT;
      break;

      case GAPM_ADV_UNDIRECT:
      app_advertise_mode = GAPM_ADV_NON_CONN;
      break;
      }
      我需要添加到按钮来更改广告模式。

    4. 当我在app_button_press_callback中设置计时器(500ms)时,
      the timer was triggered immediately, then I set a flag,
      in the following, works fine,why?
      app_adv_undirect_complete.
      {
      if (flag) {
      set_timer();
      标志= false;
      }
      and in the timer handler, I clear another timer, not ok,
      set another flag like above, I cleared the timer successfully,why?

    Thanks,
    Anthony

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony,

    Hi antony,

    You can define that your device will work in connectable in da14580_config.h check the dev kit you are using and define theCFG_CONNECTABLE_ADV_MODE在那里。如果定义了CFG_CONECTABLE_ADV_MODE,则无需按钮更改为可连接模式,设备将在可连接和不可连接的模式之间旋转。如果未定义,则必须使用按钮以更改ADV模式(有一个定义)。我想你正在使用睡眠,当你的设备唤醒引脚返回句子的句子periph_init()函数命令....如果要保持按钮点亮,则必须放置一个将记住以前状态的变量每当您的da醒来时,LED并设置对应的值。在app_asynch_trm中,如果您定义了CFG_CONNECTABLE_ADV_MODE as i 've mentioned the device cycles between the non and connectable mode. The device starts advertising again because of the app_adv_undirect_complete() which is issued from the app_adv_stop() check the app_task.c case GAPM_ADV_UNDIRECT; case GAPM_ADV_NON_CONN. If you are trying to set a timer from an external interrupt please advice the SmartTag Reference design at the app_button_press_cb() function and check this also FAQhttp://support.dialog-semiconductor.com/faq-page#n1508

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog

    Hi MT_dialog

    1. In the app_adv_undirect_complete():
      call app_timer_set(APP_RESTART_ADV_TIMER, TASK_APP, timer_ticks) to restart adv,
      is this the method to advertise periodically?
      我在这个func中设置了一个断点,似乎这个函数未调用,但app_adv_stop()将要做。
    2. As you mentioned "The device starts advertising again because of the app_adv_undirect_complete()
      which is issued from the app_adv_stop() ",
      now I need to store 10 different adv data in an array, and advertise array[0], then array[1] ...
      each one is 32 bytes.
      I think add code to app_adv_undirect_complete() is a good choice,
      I can set the adv interval individually and change adv data in APP_RESTART_ADV_TIMER handler.
      so how to let app_adv_undirect_complete() be called after each advertising?
      is this possible or any other better solution?

    Thanks,
    Anthony

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony,

    Hi antony,

    app_adv_undirect()在Adv_Stop()完成后执行并将计时器设置为Timer以便再次启动广告,请在IF语句上设置您的断点。是的,您可以在广告停止时更改广告数据。每次停止广告时都会调用app_adv_undirect_complete。

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog

    Hi MT_dialog

    在app_restart_adv_timer_handler中:
    app_adv_start();
    app_adv_stop(); //can I add this here to call app_adv_undirect_complete?
    return(ke_msg_consumed);

    • I need to advertise adv_data_array1 once, after x ms, advertise adv_data_array2 once, . . .
    • how can I know one advertising has finished?
      我应该何时调用app_adv_stop()?

    Thanks,
    Anthony

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi antony42,

    Hi antony42,

    When the da boots you can start advertise and start a timer, when the timer elapses you can call app_adv_stop(), when the advertising stops, the app_adv_undirect_complete will execute (this functions executes right after you invoke app_adv_stop whether is undirect advertising or non-connectable) and then you can call the app_adv_start(); You can change your advertising string in the app_adv_func() if you like where the advertising string is populated.

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog,

    Hi MT_dialog,
    Thank you for your reply, I will try it.
    当我打电话给app_adv_start()时,广告开始,而不是一次,它是连续的,

    1. there is a timer in the kernel to restart advertising, right?
    2. how to guarantee advertising data1 only once, then advertising data2, data3 ...

    Thanks,
    Anthony

    mt_dialog.
    Offline
    最后一次露面:2个月3周前
    职员
    加入:2015-06-08 11:34
    Hi Antony,

    Hi Antony,

    广告程序是持续的,意思是,如果您不发送取消命令,广告将继续。如果要在3广告字符串之间旋转,您可以在广告功能中制作开关盒检查当前的通告模式并切换到下一个模式(每个模式加载不同的广告字符串)。当设置广告字符串时,将设置指定设备在特定模式中宣传的长度的计时器。当计时器经过时,更改广告模式,invoke app_adv_stop并在获得广告已停止的指示时重新启动广告。

    谢谢mt_dialog.

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog,

    Hi MT_dialog,

    Thank you very much!
    it is working now.

    in app_adv_undirect_complete()
    {
    app_set_timer(x,y);
    app_adv_start();
    }

    in timer handler()
    {
    app_adv_stop();
    }

    I set the timer the same value with adversitng interval (100ms),
    从嗅探器中,我可以看到每个adv数据只广告一次!

    Thanks,
    Anthony

    anthony42
    Offline
    最后一次露面:5 years 6 months ago
    加入:2015-07-17 08:21
    Hi MT_dialog,

    Hi MT_dialog,

    Thank you for yor reply.
    now it works fine, I set flags in button_press_callback() and set/clear timer in app_adv_undirect_complete().
    I also found two old but useful topics:
    http://support.dialog-semiconductor.com/ketimerset-not-executewhy
    http://support.dialog-semiconductor.com/problem-about-wakeup-timer-inter...

    by the way, if I use ext sleep there is no need to use __attribute__((section("retention_mem_area0"),zero_init)
    这样对吗?

    Thanks,
    Anthony

    MHv_Dialog
    Offline
    最后一次露面:2 months 2 weeks ago
    职员
    加入:2013-12-06 15:10
    Hi,

    Hi,

    That is correct. In extended sleep, all data in RAM, including global variables, is retained.

    主题锁定