DA14580 as a master : connexion stage

5 posts / 0 new
Last post
s.miermont
Offline
Last seen:3 years 9 months ago
加入:2015-11-17 13:21
DA14580 as a master : connexion stage

Hi,

I'm trying to initiate a connexion from a DA14580 to another BLE device.

I started from the barebone project and modified the user_app_init() function like this:


void user_app_init( void )
{
// Initialize Manufacturer Specific Data
mnf_data_init();
default_app_on_init();

struct gapm_start_connection_cmd connect;
连接。nb_peers = 1;

连接。peers[0].addr.addr[0] = 0x03;
连接。peers[0].addr.addr[1] = 0xE5;
连接。peers[0].addr.addr[2] = 0x5B;
连接。peers[0].addr.addr[3] = 0x16;
连接。peers[0].addr.addr[4] = 0x4A;
连接。peers[0].addr.addr[5] = 0x54;

连接。peers[0].addr_type = 0; //public
连接。con_intv_min = 100;
连接。con_intv_max = 100;
连接。ce_len_min = 0x0;
连接。ce_len_max = 0 x5;
连接。con_latency = 0;
连接。op.addr_src = GAPM_PUBLIC_ADDR;
连接。peers[0].addr_type = GAPM_PUBLIC_ADDR;
连接。superv_to = 0x1F4;// 500 -> 5000 ms ;
连接。scan_interval = 0x180;
连接。scan_window = 0x160;
连接。op.code = GAPM_CONNECTION_DIRECT;
gapm_execute_connect_op( &connect );
}

I also added two callbacks:


void user_app_scanning_completed( void )
{
arch_puts( "\ncomplite" );
}

void user_on_adv_report_ind( struct gapm_adv_report_ind const * report )
{
arch_puts( "\nok" );
}

When I run this code, none of the callbacks are called and it fires an exception.
What did I do wrong?
Is it the good way to connect?

-------- update -----------

Ok, I changed static allocation of the message by:

struct gapm_start_connection_cmd *connect = app_connect_start_msg_create();

and replaced gapm_execute_connect_op()

by

ke_msg_send( connect);

I, no more have the exception but the code still do nothing...

-----------------------------

Thanks
问候

Device:
MT_dialog
Offline
Last seen:2 months 10 hours ago
Staff
加入:2015-06-08 11:34
Hi s.miermont,

Hi s.miermont,

The barebone project is a peripheral project, as a peripheral you can't connect to a central, only a central can issue a gapm_start_connection_command in order to connect to a peripheral. You have to configure your device to act as a central. This can be done in the by setting the role of your device in the GAP_CENTRAL_MST. After you do that you have to start scanning in order to get advertising indications in the gapm_adv_report_ind_handler (app_on_adv_report_ind callback). When the advertising indication hits, check if the device is the one you want to connect to and then you can cancel the scanning procedure, when the end of the scanning procedure hits (in the app_on_scanning_completed) you then issue a connect command to the device you want to connect to. You can see the implementation of how to scan and connect from a central by the host side of the DSPS project. Please have a look at the below functions and searh them in the DSPS project always in the host side.

- app_configuration_func() -> set your device as a central

- app_scanning() -> start scanning

-app_connect() -> start a connection with a peripheral.

Thanks MT_dialog

s.miermont
Offline
Last seen:3 years 9 months ago
加入:2015-11-17 13:21
Hi,

Hi,
Thanks for your answer.

I forgot to write that I already change config to GAP_CENTRAL_MST.

Sorry, but I can't find the dsps project in my sdk. Where can I ?

Thanks

MT_dialog
Offline
Last seen:2 months 10 hours ago
Staff
加入:2015-06-08 11:34
Hi s.miermont,

Hi s.miermont,

的需求方isn't part of the SDK but a reference design. Check the reference designs pagehttp://support.dialog-semiconductor.com/connectivity/reference-designs.

Thanks MT_dialog

s.miermont
Offline
Last seen:3 years 9 months ago
加入:2015-11-17 13:21
Ok, thanks. It helps.

Ok, thanks. It helps.

Topic locked