Page 1 of 1

Custom GATT with esp32-at

Posted: Wed Feb 28, 2018 12:36 pm
by kealist
I have designed a custom GATT service for the AT Command image (esp32-at) and am trying to follow instructions, but it does not appear to be working. Here is an example of my service below in GattServiceExample.csv

Code: Select all

index   uuid_len    uuid    perm    val_max_len val_cur_len value
0   128 0x526B87BE39CE491BA8715B9A209EEDC8  0x01    2   2   ADD0
1   128 0x526b87bf39ce491ba8715b9a209eedc8  0x12    2   2   0
2   128 0x526b87c039ce491ba8715b9a209eedc8  0x12    2   2   0
I have generated an image with the following command:

Code: Select all

$ python BLEService.py -t GattServiceExample.bin GattServiceExample.csv
I have flashed it to the appropriate memory address:

Code: Select all

$ ../../esptool/esptool.py --port COM6 write_flash 0x21000 GattServiceExample.bin
esptool.py v2.3
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1676 bytes to 248...
Wrote 1676 bytes (248 compressed) at 0x00021000 in 0.0 seconds (effective 437.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
However, it seems that this isn't working. When using the default Gatt image, I can see the device using a gatt tool. I also see relevant data in the uart output

Code: Select all

at
at

OK
AT+BLEINIT?
AT+BLEINIT?
+BLEINIT:0

OK
AT+BLEINIT=2
AT+BLEINIT=2

OK
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVCRE

OK
AT+BLEGATTSSRV?
AT+BLEGATTSSRV?
+BLEGATTSSRV:1,0,0xA002,1

OK
AT+BLEGATTSSRVSTART
AT+BLEGATTSSRVSTART

OK
AT+BLEADVSTART
AT+BLEADVSTART

OK
+BLECONN:0,"57:22:cb:0d:f0:aa"
+BLECFGMTU:0,185
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"
+READ:0,"57:22:cb:0d:f0:aa"

But with my customized gatt service, I cannot, and uart looks like it's not correct:

Code: Select all

at
at

OK
AT+BLEINIT=2
AT+BLEINIT=2

OK
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVCRE

OK
AT+BLEGATTSSRV?
AT+BLEGATTSSRV?
+BLEGATTSSRV:1,0,0x,1
Any thoughts or suggestions on how to get it running?