Open Bggopal opened 1 year ago
@Bggopal - If possible and you feel confortable, please try the IDF FTM example with 2 ESP32-C3: https://github.com/espressif/esp-idf/tree/master/examples/wifi/ftm
We could check if it works in IDF or if it also fails with the C3.
Hi @SuGlider,
Thanks for your suggestion. I Have tried with IDF - In v5.1-3 it works consistently but not in other versions, Checking on with the benchmarks. Mean time , the distance showed cms away is in meters. Once finding a workaround for that, will post the same
I get the same error (No valid FTM Measurements found!) when using the Arduino framework, even when the two modules are next to each other.
15:18:19.639 -> Connecting to FTM Responder
15:18:24.178 -> Connected
15:18:24.178 -> Initiating FTM session with Frame Count=24, Burst Period=200ms
15:18:24.875 -> FTM Estimate: Distance: 27.60 m, Return Time: 184 ns
15:18:25.633 -> FTM Estimate: Distance: 27.60 m, Return Time: 184 ns
15:18:26.331 -> E (8298) wifi:No valid FTM Measurements found!
15:18:26.331 -> FTM Error: FAIL
I'm using two ESP32-C3-WROOM-02 modules (Chip is ESP32-C3 (revision v0.3)).
I have not yet test the ESP-IDF version yet, as it is not my usually setup and would need to do some configuration before I can try it.
I finally tried the esp-idf ftm example, and it works as expected. Here is the test results on my test with two esp32-c3 chips.
One of the esp32-c3 is configured as ftm-ap (responder).
FTM AP
ftm> ap ftm-responder blinkie291boo
I (587450) ftm_ap: Starting SoftAP with FTM Responder support, SSID - ftm-responder, Password - blinkie291boo,
Primary Channel - 1, Bandwidth - 20MHz
ftm>
Another one is setup to be the ftm-sta (initiator). The two devices are not more than 30cm apart.
FTM STA
ftm> scan
I (1114425) ftm_station: sta start to scan
I (1117325) ftm_station: [ftm-responder][rssi=-27][FTM Responder]
I (1117325) ftm_station: [DIDI1][rssi=-46]
I (1117325) ftm_station: [Hufamily][rssi=-54]
I (1117335) ftm_station: [Hustarhub][rssi=-57]
I (1117335) ftm_station: [jamestankiantat][rssi=-58]
I (1117345) ftm_station: [SINGTEL-TR5X][rssi=-65]
I (1117345) ftm_station: [JA room][rssi=-67]
I (1117355) ftm_station: [[AV] Samsung Soundbar Q700A.l081][rssi=-67]
I (1117355) ftm_station: [ORBI97][rssi=-67]
I (1117365) ftm_station: sta scan done
ftm> sta ftm-responder blinkie291boo
I (1141955) ftm_station: sta connecting to 'ftm-responder'
I (1141955) ftm_station: sta disconnected
I (1141985) ftm_station: Connected to ftm-responder (BSSID: 7c:df:a1:b2:dc:59, Channel: 1)
ftm> ftm -I -s ftm-responder
I (1152115) ftm_station: Requesting FTM session with Frm Count - 32, Burst Period - 200mSec (0: No Preference)
W (1152115) wifi:Starting FTM session with 7c:df:a1:b2:dc:59 in 63 mSec
W (1152125) wifi:Mode: non-ASAP, Bursts: 8, FTM's per burst: 4, Burst Period: 200mSec, Burst Duration: 32000uSec
W (1153605) wifi:FTM session ends with 31 valid readings out of 31 readings received, Avg raw RTT: 1.8 nSec, Avg
RSSI: -28
I (1153615) ftm_station: Estimated RTT - 1 nSec, Estimated Distance - 0.15 meters
ftm> ftm -I -s ftm-responder
I (1166435) ftm_station: Requesting FTM session with Frm Count - 32, Burst Period - 200mSec (0: No Preference)
W (1166435) wifi:Starting FTM session with 7c:df:a1:b2:dc:59 in 74 mSec
W (1166445) wifi:Mode: non-ASAP, Bursts: 8, FTM's per burst: 4, Burst Period: 200mSec, Burst Duration: 32000uSec
W (1167945) wifi:FTM session ends with 31 valid readings out of 31 readings received, Avg raw RTT: 0.0 nSec, Avg
RSSI: -28
I (1167945) ftm_station: Estimated RTT - 0 nSec, Estimated Distance - 0.00 meters
ftm> ftm -I -s ftm-responder
I (1181555) ftm_station: Requesting FTM session with Frm Count - 32, Burst Period - 200mSec (0: No Preference)
W (1181555) wifi:Starting FTM session with 7c:df:a1:b2:dc:59 in 10 mSec
W (1181565) wifi:Mode: non-ASAP, Bursts: 8, FTM's per burst: 4, Burst Period: 200mSec, Burst Duration: 32000uSec
W (1182995) wifi:FTM session ends with 31 valid readings out of 31 readings received, Avg raw RTT: 0.0 nSec, Avg
RSSI: -28
I (1183005) ftm_station: Estimated RTT - 0 nSec, Estimated Distance - 0.00 meters
I then try to use the Arduino FTM Responder sketch on one of the esp32-c3, while keeping another esp32-c3 running the esp-idf ftm example. The esp-idf initiator is able to connect to to the Arduino FTM Responder, it is however always failed in ftm measurement. I did not change the Arduino Responder code except adding the printout of BSSID.
Responder(Arduino)
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
Starting SoftAP with FTM Responder support
7C:DF:A1:B2:D9:C0
Initiator(eps-idf)
ftm> scan
I (5489215) ftm_station: sta start to scan
I (5491715) ftm_station: [DIDI1][rssi=-47]
I (5491715) ftm_station: [jamestankiantat][rssi=-59]
I (5491715) ftm_station: [SINGTEL-861A][rssi=-64]
I (5491725) ftm_station: [[AV] Samsung Soundbar Q700A.l081][rssi=-65]
I (5491725) ftm_station: [SINGTEL-TR5X][rssi=-70]
I (5491735) ftm_station: [ORBI97][rssi=-70]
I (5491735) ftm_station: [SINGTEL-TR5X][rssi=-72]
I (5491745) ftm_station: [Hustarhub][rssi=-72]
I (5491745) ftm_station: [DIRECT-20-HP M236 LaserJet][rssi=-73]
I (5491755) ftm_station: [jhhowshold][rssi=-76]
I (5491755) ftm_station: sta scan done
ftm> scan
I (5499695) ftm_station: sta start to scan
I (5502195) ftm_station: [FTM_Responder][rssi=-28][FTM Responder]
I (5502195) ftm_station: [DIDI1][rssi=-48]
I (5502195) ftm_station: [Hufamily][rssi=-55]
I (5502205) ftm_station: [jamestankiantat][rssi=-56]
I (5502205) ftm_station: [[AV] Samsung Soundbar Q700A.l081][rssi=-64]
I (5502215) ftm_station: [SINGTEL-861A][rssi=-65]
I (5502215) ftm_station: [SINGTEL-TR5X][rssi=-68]
I (5502225) ftm_station: [DIRECT-20-HP M236 LaserJet][rssi=-70]
I (5502225) ftm_station: [ORBI97][rssi=-70]
I (5502235) ftm_station: [Hustarhub][rssi=-71]
I (5502235) ftm_station: [SINGTEL-TR5X][rssi=-72]
I (5502245) ftm_station: sta scan done
ftm> sta FTM_Responder blinkie291boo
I (5524605) ftm_station: sta connecting to 'FTM_Responder'
I (5524995) ftm_station: Connected to FTM_Responder (BSSID: 7c:df:a1:b2:d9:c1, Channel: 1)
ftm> ftm -I -s FTM_Responder
I (5544295) ftm_station: Requesting FTM session with Frm Count - 32, Burst Period - 200mSec (0: No Preference)
W (5544305) wifi:Starting FTM session with 7c:df:a1:b2:d9:c1 in 6 mSec
W (5544315) wifi:Mode: non-ASAP, Bursts: 8, FTM's per burst: 4, Burst Period: 200mSec, Burst Duration: 32000uSec
E (5545765) wifi:No valid FTM Measurements found out of 19 received measurements!
I (5545765) ftm_station: FTM procedure with Peer(7c:df:a1:b2:d9:c1) failed! (Status - 4)
ftm>
I then tried using the Arduino Initiator code on one esp32c3, and running the esp-idf ftm example as responder. The Arduino Initiator can't connect to the esp-idf responder at all.
Responder (with esp-idf code)
ftm> ap FTM_Responder blinkie291boo
I (178575) ftm_ap: Starting SoftAP with FTM Responder support, SSID - FTM_Responder, Password - blinkie291boo, Primary Channel - 1, Bandwidth - 20MHz
ftm>
Initiator (with Arduino Initiator code)
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
Connecting to FTM Responder FTM_Responder blinkie291boo
.E (1215) wifi:Association refused temporarily, comeback time 1536 mSec
.......................................................
When using both Arduino FTM Responder and Initiator code. I have to set the frame count to 64 in order to get a reliable connection session and it is able to generate the ftm measurement, the distance however is wrong as reported in this issue post by others as well.
Responder
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
Starting SoftAP with FTM Responder support
SSID: FTM_Responder, MAC: 7C:DF:A1:B2:DC:58
Initiator
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
Connecting to FTM Responder FTM_Responder blinkie291boo
.........Connected
Initiating FTM session with Frame Count=64, Burst Period=200ms
FTM Estimate: Distance: 29 m, Return Time: 197 ns
FTM Estimate: Distance: 29 m, Return Time: 196 ns
FTM Estimate: Distance: 29 m, Return Time: 196 ns
FTM Estimate: Distance: 29 m, Return Time: 195 ns
FTM Estimate: Distance: 29 m, Return Time: 197 ns
FTM Estimate: Distance: 29 m, Return Time: 196 ns
FTM Estimate: Distance: 29 m, Return Time: 194 ns
FTM Estimate: Distance: 29 m, Return Time: 195 ns
FTM Estimate: Distance: 29 m, Return Time: 195 ns
Clearly there is something wrong with the Arduino implementation of the FTM measurement. Hope this is helpful for confirming that there is some bug with this. Any comment or what direction that I should look into it would be welcome.
Board
ESP32-C3-DevkitM-1, DFRobot Beetle ESP32-c3
Device Description
Using Two DEVKITS
Hardware Configuration
Nil
Version
v2.0.10
IDE Name
Arduino IDE
Operating System
Windows 11
Flash frequency
160MHz
PSRAM enabled
no
Upload speed
921600
Description
FTM example programs ( initiator, responder) fails with error no valid measurement found.
Devices are cms apart , what I get is 27 m, and also for next round trip it shows no valid measurements found,
And when devices are moved away, I get no distance
Sketch
Debug Message