esp-idf 소스의 sdkconfig파일에서
>> idf.py menuconfig
위 명령을 통해서 하기 CONFIG를 수정해 보았습니다.
CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y
# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set
CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
//currently not used
CONFIG_BLUEDROID_PINNED_TO_CORE_0=y
# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set
CONFIG_BLUEDROID_PINNED_TO_CORE=0
위의 CONFIG를 보시다시피,
WIFI 와 BT의 CPU코어를 CPU0 과 CPU1에 별도로
운용하도록 해 봤는데
그래도 BT / Wifi는 동시에 사용할 수가 없습니다.
검색해보니,
하기의 ESP32 포럼글을 보았습니다.
https://esp32.com/viewtopic.php?t=6707
위 내용을 읽어보니,
아래와 같이,
Again, this is not a software issue. The ESP32 only has one radio and only one antenna.
This radio and antenna, if viewed in a somewhat simplified fashion, can be used for one of six
things: send a WiFi packet, send a BT packet, listen for a WiFi packet, listen for a BT packet
, receive a WiFi packet, receive a BT packet.
I think we actually do some magic that allows us to listen for BT and WiFi packets
at the same time in some circumstances, but in general, we're limited to doing
only one of these things.
To get around this, we would need a separate radio and antenna,
something which is not in the current ESP32. No software hacks can change this,
because it's a hardware limitation, not a software one.
ESP32는 Wifi 와 BT (BLE 포함) 를 하드웨어 제약 때문에 동시에는 사용할 수가 없다고 합니다.
하나의 안테나와 하나의 radio 블럭만을 가지고 있어서 그렇답니다.~
(추가1)
(추가3)
I'm working on a project that uses both Wifi (specifically the http_client component) as well as BLE.
They both seem to work great separately.
However, once Wifi establishes a connection and starts working (a small http request every second or so), the BLE feels starved. It takes a very long time to get connected, reads take in the order of seconds, and I often get disconnected.
Any idea what could cause this behavior?
Either I must be doing something wrong, or there's an issue with the stack.
Is there an example that does WIFI and BLE at the same time? Is it expected to work fine?
I guess,
The problem is that they share a radio; in other words, while the ESP32 is sending/receiving a BT packet, it cannot listen or send a WiFi packet.
Thanks,
위와 같은 issue를 하기와 같이 올려보았습니다.
https://github.com/espressif/esp-idf/issues/8749
(추가2)
위와 같이 github에 이슈를 올리니 답변이 달렸습니다. 하기 링크와 같이.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/coexist.html
위 링크의 내용을 아래와 같이 가져와 봅니다.
Overview
ESP32 has only one 2.4 GHz ISM band RF module, which is shared by Bluetooth (BT & BLE) and Wi-Fi, so Bluetooth can’t receive or transmit data while Wi-Fi is receiving or transmitting data and vice versa. Under such circumstances, ESP32 uses the time-division multiplexing method to receive and transmit packets.
Supported Coexistence Scenario for ESP32
BLE | ||||||
Scan | Advertising | Connecting | Connected | |||
Wi-Fi | STA | Scan | Y | Y | Y | Y |
Connecting | Y | Y | Y | Y | ||
Connected | Y | Y | Y | Y | ||
SOFTAP | TX Beacon | Y | Y | Y | Y | |
Connecting | Y | Y | Y | Y | ||
Connected | C1 | C1 | C1 | C1 | ||
Sniffer | RX | C2 | C2 | C2 | C2 | |
ESP-NOW | RX | X | X | X | X | |
TX | Y | Y | Y | Y |
BR/EDR | |||||||
Inquiry | Inquiry scan | Page | Page scan | Connected | |||
Wi-Fi | STA | Scan | Y | Y | Y | Y | Y |
Connecting | Y | Y | Y | Y | Y | ||
Connected | Y | Y | Y | Y | Y | ||
SOFTAP | TX Beacon | Y | Y | Y | Y | Y | |
Connecting | Y | Y | Y | Y | Y | ||
Connected | C1 | C1 | C1 | C1 | C1 | ||
Sniffer | RX | C2 | C2 | C2 | C2 | C2 | |
ESP-NOW | RX | X | X | X | X | X | |
TX | Y | Y | Y | Y | Y |
결론은,
ESP32는 블루투스(BT&BLE)와 와이파이가 공유하는 2.4GHz ISM 대역 RF 모듈이 1개뿐이어서
와이파이가 데이터를 송수신하는 동안에는 블루투스가 데이터를 송수신할 수 없다.
이러한 상황에서 ESP32는 시분할 다중화 방법을 사용하여 패킷을 수신하고 전송합니다.
그럼,
공유합니다.
'개발 이야기 > 임베디드 개발' 카테고리의 다른 글
외부 라이브러리 없이 BLE를 통해 OTA ESP32 업데이트 (0) | 2022.04.06 |
---|---|
Reverse engineering the Arduino Portenta H7 Bootloader (0) | 2022.04.06 |
[ESP32] esp-idf 의 오픈소스 수정 (0) | 2022.03.30 |
esp32 프로젝트 개발의 모든 정리 (0) | 2022.03.15 |
샘플PCB - 회로개발/PCB제작 (0) | 2022.03.08 |