Hi,
why Write Dev Name and Read Ori Dev Name use same index ?
DIS_IDX_IEEE_CHAR,
DIS_IDX_IEEE_VAL,
DIS_IDX_PNP_ID_CHAR,
DIS_IDX_PNP_ID_VAL,
DIS_IDX_NB,
// PnP ID Characteristic Declaration
[DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_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, ENABLE), DIS_PNP_ID_LEN, 0, NULL},
// Read Write Dev Name Characteristic Declaration
[DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_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, ENABLE), DIS_PNP_ID_LEN, 0, NULL},
// Read Ori Dev Name Characteristic Declaration
[DIS_IDX_PNP_ID_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(diss_pnp_id_char),
sizeof(diss_pnp_id_char), (uint8_t *)&diss_pnp_id_char},
// Read Ori Dev Name Characteristic Value
[DIS_IDX_PNP_ID_VAL] = {ATT_CHAR_PNP_ID, PERM(RD, ENABLE), 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!
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.
Thanks MT_dialog
Hi,MT_dialog,
absolutely right !
and I need to save these info to flash.
can you give me some suggestions?
Thanks a lot !
Hi antony42,
I would advise you not to change the DISS profile (you may have compatibility problems with other devices), instead you can include it to your services and create a new custom profile (SAMPLE128 tutorial) with the extra informations you need. As i ve mentioned before the DISS is a service defined from the bluetooth SIG. You can use the Beacon project to handle the advertising of your message.
Thanks 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 ?
from beacon ref project:
#define PRODUCT_HEADER_POSITION 0x1F000
// Product header for SUOTA
struct product_header
{
uint8_t signature[2];
uint8_t版本[2];
uint32_t reserved[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)
but p_header.config_offset = ?
struct config_header is also different from AN-B-010
Thank you!
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.
Thanks MT_dialog.
Hi MT_dialog,
In UM-B-019 (beacon reference) 9.7.1 Memory map:
Configuration storage uses the memory map of the dual image boot loader. More specifically, it uses
the first four bytes of the ‘Reserved’ field (byte offset 12) in the Product Header, as described in
section 6.1 of [6], to define the memory address of the configuration area. The address must point at
the start of an SPI Flash sector and no other information must be stored in the same sector.
where is section 6.1 of [6]
the UM says use first four bytes of the ‘Reserved’ field to store Configuration address,
struct product_header
{
uint8_t signature[2];
uint8_t版本[2];
uint32_t reserved[4];
uint32_t config_offset;
};
now my header file(.txt file) is:
2 signature Product header signature. Must contain 0x7052
2 version Product header version
4 offset1 Memory offset of image header #1 in LE format
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!
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.
Thanks MT_dialog
Hi MT_Dialog,
I don't fully understand.
//product header structure
typedef struct __productHeader {
uint8 signature[2];
uint8 version[2];
uint32_t offset1;
uint32_t offset2;
}s_productHeader;
// Product header for SUOTA
struct product_header
{
uint8_t signature[2];
uint8_t版本[2];
uint32_t reserved[4];
uint32_t config_offset; //why this is different from above one?
};
seems a fully version.
在这个文件中12 -31 reserved
32-37 BD Address ...
Thank you!
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
header....configOffset for instance. Then after you make the product_header.txt you can go from the smart
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
data will populate the corresponding struct with the configuration data. You can make the product header to
correspond to the stuct like this:
Create a product_header.txt file and add the following fields
2 String Signature Product Header Signature(7052)
2 String Version Product Header Version
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.
Thanks MT_dialog
Hi MT_Dialog,
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?
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?
can you explain more about 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;
}
I need to add to button to change the advertise mode.
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
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_MODEin there. You dont need a button to change to connectable mode the device will rotate between connectable and non-connectable mode if the CFG_CONNECTABLE_ADV_MODE is defined. If its not defined then you have to use a button in order to change the adv mode (there is one defined). I suppose that you are using sleep, when your device wakes up the pins return to the state the periph_init() function commands....if you want to keep the button lit you must place a variable that will remember the previous state of your LED and set the coresponding value everytime your da wakes up. In app_asynch_trm if you defined theCFG_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.
Thanks MT_dialog
Hi MT_dialog
call app_timer_set(APP_RESTART_ADV_TIMER, TASK_APP, timer_ticks) to restart adv,
is this the method to advertise periodically?
I set a breakpoint in this func, seems this function was not called, but app_adv_stop() will do.
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
Hi antony,
The app_adv_undirect() is executed right after adv_stop() is finished and sets the timer in order to start advertising again, just tested, please set your breakpoint on the if statement. Yes you can change the advertise data when the advertising stops. The app_adv_undirect_complete is called every time you stop the advertise.
Thanks MT_dialog
Hi MT_dialog
In the 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);
when should I call app_adv_stop()?
Thanks,
Anthony
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.
Thanks MT_dialog
Hi MT_dialog,
Thank you for your reply, I will try it.
when I call app_adv_start(), the advertise start, not once, it is continuously,
Thanks,
Anthony
Hi Antony,
The advertising procedure is continious, meaning, if you dont send a cancelling command the advertising will continue. If you want to rotate between the 3 advertising strings you can make a switch case in the advertsing function check the current advertising mode and switch to next mode (each mode loads a different advertising string). When the advertsing string is set, a timer that specifies how long the device will advertise in specific mode will be set also. When the timer elapses, change the mode of advertising,invoke app_adv_stopand restart advertising when you get the indication that the advertising has been stopped.
Thanks 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),
and from the sniffer I can see that each adv data only advertising once!
Thanks,
Anthony
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)
is this correct?
Thanks,
Anthony
Hi,
That is correct. In extended sleep, all data in RAM, including global variables, is retained.