esp32 spp application

598 views
Skip to first unread message

Alex

unread,
Jun 9, 2017, 4:21:52 PM6/9/17
to btstack-dev
Hi,
I'm in process of making bluetooth connection to esp32 device using serial port profile.
I use esp-idf and BTStack on Linux machine. Compiling, flashing works fine.
Now I use spp_streamer project as base, but behavior is the same on spp_counter as well. So my problem is: there is no connection.
I use Windows 10 laptop to connect. After flashing app to esp32 I can see my Bluetooth device, I can request pairing and it works.
But as soon as I press "ok" on Windows machine I can see status "Connected" for 2-3 second and then status changes to "Paired". Com ports are created on PC but I can't connect to them, ports just refuse to open.
On esp32 side I can see request for pairing with device, but never anything about rfcom connected/disconnected. Doing logging I could see l2cap opening and closing connection, but that it.

What could be problem, where to dig, what should I check to find and fix problem.

Thanks,
Alex


Matthias Ringwald

unread,
Jun 9, 2017, 4:54:24 PM6/9/17
to btsta...@googlegroups.com
Hi Alex

To get more info, you can 
- enable LOG_INFO in btstack_config
- enable packet log in main.c:btstack_setup(): just uncomment the call to hci_dump_open(..) and post your log file here.
The text in the console can be converted to .pklg with tool/create_packet_log.py which can be opened with Wireshark.

Best
 Matthias

--
You received this message because you are subscribed to the Google Groups "btstack-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
To post to this group, send email to btsta...@googlegroups.com.
Visit this group at https://groups.google.com/group/btstack-dev.
For more options, visit https://groups.google.com/d/optout.

JHenkel

unread,
Jun 10, 2017, 1:07:56 PM6/10/17
to btstack-dev
Alex - I've seen the same thing.  I haven't had time to dig into it yet - just getting started.

Alex

unread,
Jun 10, 2017, 8:46:23 PM6/10/17
to btstack-dev

Hi Matthias,

Thanks for reply,

Please find attached log and actual source file.
After enabling debug output and trying different projects I think my problem is missing something in event handler.

Could you please give some hints?

Thanks,
Alex
spp_streamer1.c
streamer.log

Matthias Ringwald

unread,
Jun 12, 2017, 6:34:50 AM6/12/17
to btsta...@googlegroups.com
Hi Alex

Thanks for the log. In the log, I see the first connection request with successful pairing and an SDP query. So far so good. It does not show the connection request / when you're trying to open a COM port on your PC.
Could you try again and check if there is ANY log output when you do? If there is no incoming connection on the ESP32, BTstack cannot do much :)

Best
 Matthias

<spp_streamer1.c><streamer.log>

Alex

unread,
Jun 14, 2017, 12:31:44 PM6/14/17
to btstack-dev
Hi Matthias,

I had to clear everything and start again as I got crazy problem, but now I'm back on track.

Here is logs of spp_and_le_counter project from ports/esp32 with debug and dump enabled.
First I start board and try to connect to it using Android phone. Connection successful but finally Android shows status "Paired". Change of status from  "Conected" to Paired" at time mark

[00:00:24.165] EVT <= 05 04 00 81 00 13
Before status was "Connected", after -"Paired"
Looks like 2-3 second timeout to get some response from board, but missing it.

Log2 is my attempt to use Windows8 laptop to connect to board.
Pairing started at 01:27:46 time mark and accepted around 01:28:00

Then I double-click on device around 01:28:30 and second time 01:28:42

After that I created COM port on Windows PC (It was not created by windows so I did it manually) and connected to that port, but no any lines in log at that time.
Again I have noticed every time disconnect after 2-3 second of waiting.

Could it be that I miss some action to perform to help Widows PC to start connection to board?

Thanks,
Alex
spp_and_le_count2.log
spp_and_le_count.log

Alex

unread,
Jun 14, 2017, 3:46:53 PM6/14/17
to btstack-dev
Hi Matthias,

after re-installation and rebuilding of everything I manage to get spp-counter project to start working with Win8 pc.

I see counter values coming from esp32 to PC.

will continue testing on Win10 this evening to check if it continue working. :)

Thanks,
Alex

Alex

unread,
Jun 15, 2017, 2:25:41 PM6/15/17
to btstack-dev
Hi Matthias,

As I can see any changes of Bluetooth profiles for same MAC address puts Windows in some state when it does not want to connect again. It is still capable of pairing with device, but not connecting to it.
I find that "Forget" device and reboot recover windows state and allow to pair and connect to device again.

If it is help for anyone, this is my 2 cents :)

Thanks,
Alex
Reply all
Reply to author
Forward
0 new messages