17 posts / 0 new
Last post
ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Changing MTU

Hi,

I have a problem to exchange the MTU size when connected with a iOS device. We have developed a iOS app to connect with our device.
The iOS app can find my device and connect it. I configure my device as a slave with a MTU of ATT_MAX_VALUE (ATT_DEFAULT_MTU+1 = 24 byte).
Look at my source code above.

msg->operation = GAPM_SET_DEV_CONFIG;
msg->role = GAP_PERIPHERAL_SLV; // Device Role
memset( msg->irk.key, 0, sizeof(struct gap_sec_key));
msg->appearance = 832;
msg->appearance_write_perm = GAPM_WRITE_DISABLE;
msg->name_write_perm = GAPM_WRITE_DISABLE;
msg->max_mtu = ATT_MAX_VALUE;
msg->con_intv_min = 0;
msg->con_intv_max = 0;
msg->con_latency = 0;
msg->superv_to = 10000;
msg->flags = 0;

The iOS device can read after connection the MTU of 512 byte but itself it can only send the default size of 20 byte.
After connection with the iOS app I get an connection request from the app and I send a confirm to the app. After the confirm I send also the GATT_EXC_MTU_REQ command.
Look at my source code above.

void gattc_exc_mtu_cmd(void)
{
struct gattc_exc_mtu_cmd *msg = BT_BleMsgAlloc(GATTC_EXC_MTU_CMD,
TASK_GATTC, TASK_GTL,sizeof(struct gattc_exc_mtu_cmd));

msg->req_type = GATTC_MTU_EXCH;

BT_BleSendMsg(msg);
}
In this link of the your forum there is descriped a similar problem and I had tried this.
http://support.dialog-semiconductor.com/when-i-enable-notification-chara...
But it doesn't work.

In Apple BluetoothDesignGuidelines 3.10 and the bluetooth core specification V4.0 it´s described that a MTU exchange is possible.

Is my GATT_EXC_MTU_REQ command the right one with source and destination id?
Have you a example of exchange of the MTU size for iOS device? For example the DSPS app?
Do you have a idea what I'm doing wrong?

Thank you.

Regards Eckart

Device:
MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

Can you check with a sniffer to verify that the command is transmited ? There isn't any specific command for exchange MTU with a iOS device. Are you trying with an integrated design or with a full hosted implementation.

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi,

Hi,

I have an PAN1740 controlling with a EFM microcontroller over UART. I have flashed the OTP of the PAN1740 with the full_emb.bin file with smart snippets. Every thing like config as slave and advertise command are looking fine.
I don't have a bluetooth sniffer. I can look with a digital analyser if my command is send over UART to the PAN1740. Is there a possibility to use connection manager and the PAN1740 development dongle to look if the command is sent right to this?
Is my exchange MTU command the right one especially the source and destination id?
Thank you

Regards
Eckart

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

The command you send is correct, i had a look with a sniffer and seems that the command is sent correctly. The command manager doens't support the exchange MTU feature, it uses only the default MTU. I can send you the DSPS source code for iOS if you think that this will help you defining your problem.

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_dialog,

Hi MT_dialog,

thank your for your fast help.
Yes, please send me the the source code to my e-mail address.
Perhaps I can find some hints to solve my problem.

Regards
ehanl

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_Dialog,

Hi MT_Dialog,

thank you for your help.
I have still the problem but the reason is perhaps a other one.
In my application I send a command from the client (iOS App) to the server (PAN1740) and than I begin to stream data.
This means that the server begins to send continuously data to the client by using notification. I set the attribute value and afterwards I use the GATTC_SEND_EVT_COMMAND to send the streaming data to the client. The streaming data are always circa 100 byte but the client only recieves 21 byte.
But when I send a write request from the client to the server and the server sends a write confirm The cIient gets the 100 byte.
Also I send MTU exchange command after I get a connection request from the client and before I send connection confirm.
Is notification value limited?
If the client gets the 100 byte when write confirm is send the MTU size must be more than default? Otherwise the client can't get this data size?
Do you have a idea what's wrong.
In this Forum I have read several problems like my problem but no solution found.
Thank you.

Regards
ehanl

.

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

When you perform an MTU exchange both of the devices have to agree in the MTU they have to use, the host can either accept the request or reject it and continue using the minimum MTU of the two devices involved in the communication. The notification value is limited by the current MTU that has been arranged between the two devices. When you send a write request all the data that you send will go to the server regardless your MTU size.

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_dialog,

Hi MT_dialog,

I have found the solution. I initialize my config command with the #define MTU_MAX_VALUE ( MTU_DEFAULT_VALUE+1) and thats 24 -3 byte header =21 byte. And my iOS App recieved exactly this 21 byte. I read in the datasheet that a MTU size lager than 23 byte set the MTU size automatically to 512 byte. But that's not right. So I set the MTU size to140 byte and my App recieved 140 byte. Now this part works and I get streaming data of 140 byte.
But I can stream only for a short time than my slave with EFM and PAN1740 hangs. I always load my 140 byte data to my attribute using the gatt_set_value_req. After this I wait for the ready event gatt_set_value_rsp and then I send the gattc_send_evt_cmd and wait for the gattc_cmp_evt. If this is ok I begin new. But after a several time I don't get the gatt_set_value_rsp or I get is incomplete. What's about the flow control? I use the full_emb.bin firmware from connection manager for the PAN1740 but I don't know if a hardware flow control is supported and which GPIO pins are used for RTS and CTS? I think the PAN1740 have a overflow and can't send then data.
Can you help me to solve the problem?
I have tried different things for example send more slowly but every tIme my application hangs.
Do you have a hint for me?
Thank you.

Regards
ehanl

Joacimwe
Offline
Last seen:1 year 5 months ago
Guru
加入:2014-01-14 06:45
If the DA14580 crashes due to

If the DA14580 crashes due to memory allocation failure, you can try to increase the message heap. Since you always wait for gattc_cmp_evt you have implemented flow control.
To set it to 4000 bytes, add this in da14580_config.h:
#define MSG_HEAP_SZ 4000

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi,

Hi,

but I have program the OTP of the PAN1740 with the full_emb.bin file with smart snippets and when I understand you right I have to update the heap size and must compile the bin file new. But I have no source code of the full_emb.bin. Or is there a other way to do this?
Is there also a way to update the OTP of the PAN1740?

Regards
ehanl

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

如果您正在使用任何proximity_ext implementations as your basic project you can use the prox_monitor_ext_usb or the prox_reporter_ext_usb. But what do you mean that the response is incomplete when you set the value?

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_dialog,

Hi MT_dialog,

can I use both of this projects you told me with connection manager to test it? I tried to flash with the prox_monitor_ext_usb.hex file and I tried to boot as central or peripheral but it doesn't work. Every time I only get a reset command and no full functionality. Can I overwrite or update the OTP? Or must I take a new PAN1740? Where can I get the source code of the full_emb.bin? Because my application is running very well with this file.
Sometimes there is no command or only a part recieved for example I get msg_id, srcid, destid and than nothing.
I also tried to send only 20 byte packages but my application hangs too.

Update:
I have program the OTP of a new PAN1740 with the prox_monitor_ext_usb.bin file and a MSG_HEAP_SIZE of 4000 but I also get no answer of my gapm_reset_cmd command like in connection manager too. The UART TX , RX pins and the baud rate are the same like in the full_emb.bin file?
In the periph_setup.h file I found the defines for this.
#define UART1_TX_GPIO_PORT GPIO_PORT_0
#define UART1_TX_GPIO_PIN GPIO_PIN_4

#define UART1_RX_GPIO_PORT GPIO_PORT_0
#define UART1_RX_GPIO_PIN GPIO_PIN_5

#ifndef CFG_ROM
#define UART_BAUDRATE UART_BAUDRATE_115K2
#else //CFG_ROM
#define UART_BAUDRATE UART_BAUDRATE_460K8
#endif //CFG_ROM

所以我认为´s相同的配置。
What´s going wrong?

Regards
ehanl

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

Yes, you can use them with connection manager to test them. Please follow the app note UM-B-010 Proximity example in Integrated and External processor. You have to load the firmware and then run the windows application for monitor or reporter. Also please try to run connection manager from windows as Administrator. Since the OTP is written you can't overwrite it but you can try to download the app to the sysram by pressing the reset button (use keil and program after reset). You mean the full_emb.bin located in the connection manager, the source code is similar to the proximity reporter (prox_reporter_ext). As far as the partial receive of the command or the response have you considered a faulty or problems in UART ?

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_Dialog,

Hi MT_Dialog,

现在我有一个与proximity_rep运行的系统orter_ext bin file. I can boot as peripheral and connect my application with the iOS app light blue. I also set the heap size for message to 4000 but when I start streaming my device hangs after several times too. I also have the problem to debug my application with keil. In debug mode bluetooth doesn`t work with this bin file because in my uart receive buffer I sometimes get no answer for my commands. This makes it more difficult to develop and test my application. With the full_emb.bin file I have no problems to debug. I don't know what's the problem.
I don't know if I have problems with my uart. Maybe. But I don't know where.
Do you have a new idea?

Regards
ehanl

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi enhal,

Hi enhal,

Can you check your UART with an analyser to see if something goes wrong? Try to run the proximity_reporter_ext.proj using keil and catch the handlers that the commands from your host are triggering maybe this will help you find the solution to your problem.

Thanks MT_dialog

ehanl
Offline
Last seen:4 months 2 weeks ago
加入:2015-02-23 14:16
Hi MT_Dialog,

Hi MT_Dialog,

good news I found the problem after using a digital analyser I found that all events from the PAN1740 received at my UART RX pin. But my buffer check of the message id in every command wasn't byte for byte. I only compared both bytes of this message id and when in my UART RX interrupt came for the first time the LSB byte and in the next interrupt the MSB of the message id, it was splitted and I didn`t found the id. Now I check the incomming buffer byte for byte and it works.
Thank you for your help.

Regards
ehanl

MT_dialog
Offline
Last seen:1 month 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi ehanl,

Hi ehanl,

Glad you found it and thanks for indicating.

Best Regards MT_dialog