BLE: What could cause BLE connection establishment to fail - bluetooth-lowenergy

I am trying to implement a Bluetooth Low Energy Host on a system with SAM E54 with FreeRTOS. The bluetooth stack I am using is Nimble (Mynewt-NimBLE from Apache). I am trying to connect the SAM E54 to a nRF52840 Dongle (driven with nRF Connect Desktop application).
When I set my device as Central (as a 4.x device, with no 5.x capabilities), the device can connect to another device without error.
But when I switch on the 5.x capabilities, (basically by changing a define's value and calling another API function), and try to connect to the same peripheral, it fails 9 out of 10 times, triggering a "connection supervisor timeout" on both the server and the client.
I tried changing the supervisor timeout value, but it won't fix the problems. When a connection is bound to be successful, the central's information is displayed immediately on nRF Connect. When connection establishment is going to fail, I know it right away (before the connection supervisor timeout is triggered) because no information about the central is displayed on nRF Connect.
Once the connection is established, it can stay on for hours, so I don't think this is an RF noise issue.
I know NimBLE is not initially designed for SAM E54 and FreeRTOS, and surely the problem comes from a wrong implementation or configuration of the stack. But right now I feel like I've tested everything, and I don't know where to dig for solutions.
The actual questions are :
To start a connection using 4.x BLE capabilities, some HCI commands packets are sent. Should these packets be any different than the packets sent when I enable the 5.x capabilities ? In both cases, I am connecting to a 4.x device.
What step of the connection establishment process fails when both server & client "think' they are connected, yet don't exchange information?

Related

Fastest way to check internet connection with ESP32 Arduino

Update:
I know, the WIFI AP is still on & active in this case and the chip should not know about the change, but the question is still open. How should I check the connectivity?
In my project, the internet connection is really important.
After some testing, I have experienced that if I plug out the ethernet cable from my router the ESP32 still thinks, that it is still connected to WIFI, even the
WiFi.status() == WL_CONNECTED
is always true in this case.
So, I have tried out pinging google.com to examine the connection. This works but takes ages to get back the result.
How should I check the connectivity with the lowest resource cost and time?
Even WiFi.status() is unreliable due to the not documented details by Espressif. The API is error prone as the issues on github show.So actually the question is . what do you really want to check? - in my definition internet connection means my line (or aerial) connectionto my ISP is unbroken. This includes
my AP
my router
the ISPs fiber converter in my basement,
the line itself and the
ISPs gateway
This is what I use to determine wether a connection is open. I ping the IP address of the ISP gateway server. So you save time (no DNS resolution, no hops over nodes on the internet. If you mean wether a certain service on a defined server is available, thats slow but then you are 100% sure.
Just a clarification: "ESP32 still thinks, that it is still connected to WIFI" - YES that has to be true because according to the API this ensures client to AP connection and not AP connection to some where else. Normally a good configured router informs its clients about connection loss (in this case the connected AP(s)) and these notify (depending on their config) their clients (or sometimes not or very late)
Technically that result is correct because you are still connected to wifi!
Just because you unplug the ethernet cable doesn't mean your wifi stops. All it means is that your wifi can't get to the internet.
You can try pinging your isp's dns server. It's a lot closer to you than Google is.
Just the ramblings of an old man...

Serial communication crashes in LabVIEW

I am controlling a device over serial connection using LabVIEW (version 7.0). It is connected using USB, and is installed as a virtual serial port on the computer (running Windows XP). Every now and then my device crashes when my program sends a command, and it is unable to accept any more input (the device itself also stops working) until it has timed out.
I've looked at the serial port traffic using Portmon. Whenever the device crashes the serial driver sends the command I send using my program four times instead of just once, with an IOCTL_SERIAL_GET_COMMSTATUS command in between. I cannot see what this last command returns, but I assume something happens in the communication earlier on. I'm thinking my configuration of the port is not entirely right, but I have no idea how or why. I open and close the connection to my device every time I want to write something to it.
For completeness' sake: it has a baud rate of 9600, 8 bits, no parity, 1 stop bit, and no flow control. I'm aware that the correct settings of these parameters depend on the device, but the manufacturer has not supplied any recommended settings.
The driver is a DLL of some sort? If so, this is the most likely source of your problem, and you likely will need to contact the author of the driver. LabVIEW does have crashing bugs, but by far the most common source of crashes in simple communications apps is a buggy third-party DLL.
In other words, I doubt this is a LabVIEW problem at all and that you would have the same difficulty if you wrote a C program to talk to this driver. I only know what you've posted here about your system, but after many years of chasing down such issues, I would start with the device manufacturer/driver author.
If you have evidence to the contrary, please share.

Configure Wifly module to receive UDP packets

I have an RN-171 wifly module connected with a micro-controller.
I am using the UDP-protocol to communicate with the module. Also, I am using the firmware's UDP auto-pair feature to set the host ip. As soon as the module receives a UDP packet, it sets the host IP address to the ip from where it received the data. Now, this host ip cannot be changed without entering into the command mode.
I want the module to behave in the following way:
Every time it receives a UDP packet, it updates the host ip to the ip address from where that signal came from.
Also, I can use the TCP protocol but it only allows a single connection at a time. One more problem that I faced using the TCP protocol was that if I try to initiate a second TCP connection with the module, it not only refuses the second connection but also hangs the first stable connection. Even if the second connection initiation does not hang the module and it just gets refused, I will be ready to work with TCP.
I have been researching a lot on the web regarding this problem but since these modules are not widely used, they have a very limited support.
I've used RN-171 extensively and have many resolved tickets in their support system.
According to the WiFly Command Reference, Advanced Features and Applications User’s Guide, you cannot open more than one TCP port with the module. (the default number being 2000)
Unfortunately, regarding the UDP functionality, there's not much you can do. If you have a new host wishing to communicate over UDP, connect to the module over TCP, go into command mode and set the address using "$$$", "set ip host 0.0.0.0", "save", "exit" commands. Alternatively, instead of 0.0.0.0, you can enter the new host's own ip address: "$$$", "set ip host ###.###.###.###", "exit". Replace "###.###.###.###" with the ip address of the device.
This way, you won't get wrong host ip in case more than one device communicates over UDP at the same time. Also, by not using "save", the auto-pairing will still be saved to EEPROM memory. Also, you can send "ip flags 0x##" before "exit", this way you can also set bit[6] to 0 (UDP auto pairing disabled) temporarily by using the hex value that has this bit set to zero.
One of my problems that Microchip technical support tested around the summer of 2013 is that you cannot use RN-171 as an access point for other RN-171s since they have a firmware error preventing one from doing that and, as of firmware v4.41, released in January of 2014, there is no fix yet nor planned.
I myself do not recommend the latest firmware version v4.41, since it does not appear to work with most routers; however Soft AP mode on this works fine. On the other hand, v4.00.1 is much more compatible, however you should take care when cutting off the power since it has a potentially disastrous bricking problem if you cut the power when flash writing is in progress - the module may lock its memory forever.
I recommend registering and opening a Microchip ticket which usually will be answered within two business days and they're quite supportive. Their firmware update cycle is however quite long, and it usually takes a year or so for a new update.

Asterisk voice delay via 3G network issue

I build Asterisk system, and running Linphone app on iOS and Android system.
I find some issue on my solution. Only used voice service.
Running WiFi environment voice no any delay, When I accept ringing then immediately hear voice.
But running 3G environment voice had 3~5 seconds delay, and fix Jitter buffer configure on Asterisk, enable it, still not solve this issue.
At same device and environment, used Line and Wechat app, when press answer call still have voice delay. but more fast than my system.
Codec used min data packet GSM. Enable QoS.
I know maybe the biggest issue is client 3G network quality. and I still find flexible configure, can fix this.
I want running 3G environment on asterisk system, get best no delay experience.
How can I do fix this issue?
3G network have internal delay.
You can do nothing here.
But usualy it 0.5-1.
Your 3sec delay can be caused by bad 3g connection or overload on 3G or issues with your provider(or you just use 3G connection twice- in and out)

Connect to Internet with GSM: modem connected, no Internet

I am connecting to my USB modem on a COM port and sending him commands:
AT+CGDCONT=1,"IP","internet"
AT$QCPDPP=1,1,internet,internet
AT_OWANCALL=1,1,1
AT_OHCIP?
modem is answering and I can see that leda are lighting as where there is connection established. I took these command by sniffing communication between GlobeTrotter Connect and COM port. LEDS are the same in both situations. But in Control Panel connection named with GlobeTrotter HSxPA Network Interface #2 is offline (no connection). What am I doing wrong?
When I'm watching GlobeTrotter program and in the same moment watching commands there is no more commands sent. When I click Disconnect in appliaction (GlobeTrotter) in the same moment I see that status if Local Network is changed, but no command are sent. Maybe I should enable it in Windows in my program?
Thanks for any help
Do you know for sure that the internet connection initiated as a Dial-Up Network (DUN) connection and not as an USB ethernet connection? The reason I ask is because for DUN then all communication is done with AT commands and what you have captured should be enough to reproduce. If the connection is an ethernet connection the AT commands are more likely to be only for configuration.
Of the four commands listed, only the first is a standard 27.007 command. DUN with standard commands would typically have invoked AT+CGACT to activate the connection. Maybe the
AT_OWANCALL command is similar, although that is just wild guessing from the name on my part. You should try to get some documentation for these proprietary commands.

Resources