WIFI_STA mode for FCC co-location testing

digsub
Posts: 14
Joined: Sat Apr 22, 2017 9:17 am

WIFI_STA mode for FCC co-location testing

Postby digsub » Sun Dec 06, 2020 2:34 pm

My product incorporates an ESP32 transmitting UDP Wi-Fi (BT is off) and a second co-colocated transmitter TX2 with functions TX2_ON() & TX2_OFF() that turn TX2 transmission on/off immediately.

Now to avoid major $$$ FCC co-location testing, I must insure that both transmitters are mutually dependent i.e. guaranteed not to transmit at the same time. I'm using WIFI_STA mode since broadcast beacons sent by ESP32 in AP mode add difficulty.

Here are conditions I anticipate:
Wi-Fi not connected --> TX2=OFF
Wi-Fi connected, ESP32 listening for incoming packet --> TX2=ON
Wi-Fi connected, ESP32 received packet --> TX2=OFF until ESP32 transmits "PACKET RESPONSE", then TX2 is back ON

Please confirm that the following code precludes simultaneous transmission and that I'm not missing something going on elsewhere in the ESP32 core.

Code: Select all

#include <WiFi.h>
#include <WiFiUdp.h>

#define MYPORT  37000

char buf[256];
int wiFiStatus;

char ssid[] = "MYSSID";
char pass[] = "MYPASS";

WiFiUDP udp;
IPAddress broadcast_ip(255, 255, 255, 255);

uint32_t timeOfLastWiFiRetry;

void TX2_ON() {}
void TX2_OFF() {}

void checkIncomingPacket() {

  int packetSize = udp.parsePacket();

  if (packetSize > 0) {
    udp.read(buf, 256);

    udp.beginPacket(broadcast_ip, MYPORT);
    udp.write((uint8_t *) "PACKET RESPONSE", strlen("PACKET RESPONSE"));

    TX2_OFF();
    udp.endPacket();
    Serial.println("PACKET RESPONSE SENT WITH TX2 OFF");
    TX2_ON();
  }
}

void setup() {

  Serial.begin(115200);
  WiFi.persistent(false);
  WiFi.mode(WIFI_STA);
  udp.begin(MYPORT);

}

void loop() {

  if (wiFiStatus != WiFi.status()) {
    wiFiStatus = WiFi.status();
    if (wiFiStatus != WL_CONNECTED) {
      TX2_OFF();
    } else {
      TX2_ON();
      Serial.println("\nConnected to Wifi " + WiFi.SSID());
      Serial.println("IP address of this ESP32: " + WiFi.localIP().toString());
    }
  }

  if (WiFi.status() != WL_CONNECTED) {
    if (timeOfLastWiFiRetry == 0 || (millis() - timeOfLastWiFiRetry) >= 3000 ) {
      timeOfLastWiFiRetry = millis();
      WiFi.begin(ssid, pass);
    }
  } else {
    checkIncomingPacket();
  }
}

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: WIFI_STA mode for FCC co-location testing

Postby WiFive » Tue Dec 08, 2020 4:04 am

Is that what the test lab said? Even if they are mounted separately at a minimum distance they are considered colocated because they share a power supply?

There are antenna switch gpio outputs that can be used to know when esp32 is transmitting but I don't know if there is a way to prevent esp32 from transmitting via a coexistence gpio input or a function call.

digsub
Posts: 14
Joined: Sat Apr 22, 2017 9:17 am

Re: WIFI_STA mode for FCC co-location testing

Postby digsub » Tue Dec 08, 2020 12:26 pm

Thanks WiFive. The FCC statement for ESP32 says The antenna(s) used for this device must be installed to provide a separation distance of at least 20 cm from all persons and must not be co-located with any other transmitters, except in accordance with FCC multi-transmitter product procedures. TX2's limited modular approval says This device must not be co-located or operating in conjunction with any other antenna or transmitter.

I've spoken to several EMC labs and the problem lies in the semantics of transmitters "operating in conjunction." TX2 is a sensor that transmits microwave to generate readings. ESP32 (wired to TX2 with Serial-to-TTL) transmits the readings over Wi-Fi. It's been explained to me that this is "operating in conjunction" regardless of whether ESP32 and TX2 are in separate enclosures and/or there's a specific minimum distance between them (e.g. 10cm or more)

My design requires that TX2 transmit continuously except when turned off while ESP32 transmits. I can't use ESP32 antenna switch gpio output since its indication that ESP32 is transmitting would already be too late to prevent simultaneous transmission.

I still believe, however, that ESP32 in WIFI_STA mode should ONLY transmit when I tell it to using above code. Please do your utmost to confirm or invalidate my theory.

ESP_Sprite
Posts: 9775
Joined: Thu Nov 26, 2015 4:08 am

Re: WIFI_STA mode for FCC co-location testing

Postby ESP_Sprite » Wed Dec 09, 2020 1:26 am

I don't think you can characterize WiFi TX/RX by the upper layers alone... for instance, when you send an UDP packet off to the lower layer, it may take a while before it's actually transmitted even if the call to send it to the lower layers returns immediately. Furthermore, you can't guarantee that the IP stack won't respond to something itself, e.g. an ARP request or ping packet.

I'm actually halfway sure we do support some kind of external radio coexistence interface, but as those things are normally used for BT/WiFi coexistence and we already handle that internally, it's not really documented. Let me ask around and see if I can dig something up. You can also try to email sales@espressif.com as they are more familiar with things like FCC testing.

Sorry for that, seems the ESP32 does not have such an interface; the ESP32S2 has one but as the chip is fairly new, it's not documented or supported in software at this point in time.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: WIFI_STA mode for FCC co-location testing

Postby WiFive » Wed Dec 09, 2020 2:52 am

That is unfortunate. Imagine how many transmitters in the real world are installed near each other which have never been tested together.

So does it require a new fcc id or just that they are tested together?

If esp32 is a station connected to an access point I don't think you can assume it is not transmitting. It is going to transmit an ack to any frame it received from the AP and may do other things like updating keys and renewing dhcp leases.

digsub
Posts: 14
Joined: Sat Apr 22, 2017 9:17 am

Re: WIFI_STA mode for FCC co-location testing

Postby digsub » Wed Dec 09, 2020 10:54 am

Ouch! Without external radio coexistence interface control, my hopes appear to be dashed.

I considered using WIFI_OFF to turn off all Wi-Fi transmission (any pending tx on the lower layer, IP stack, etc) until I had fresh sensor data to send. Disconnecting-reconnecting WiFi, however, is messy and introduces too much lag.

Maybe I'll ask sales for possible early access to ESP32S2 capability? Any other ideas please let me know.

Who is online

Users browsing this forum: kammutierspule and 73 guests