Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to enable CONFIG_ESP_PHY_ENABLE_CERT_TEST for Arduino (ESP32-S3) build? (Read 161 times)
Proteus74
Newbies
*
Offline


Posts: 2
Joined: Nov 7th, 2024
How to enable CONFIG_ESP_PHY_ENABLE_CERT_TEST for Arduino (ESP32-S3) build?
Sep 24th, 2025 at 9:46am
Print Post  
Hello,

I'm facing a bigger problem. For an EMC test, I need to send a Bluetooth test signal for verification.
This is done using the function:

esp_phy_bt_tx_tone

When I do this with VS Code and the Espressif IDF, there's no issue.
I just need to set the entry
CONFIG_ESP_PHY_ENABLE_CERT_TEST=y
in the SDKConfig (menuconfig).

Here’s the example in VS Code with IDF:
Code (C++)
Select All
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "esp_err.h"
#include "esp_log.h"
#include "esp_bt.h"//#include "esp_bt_main.h"
#include "esp_phy_cert_test.h"
static const char *TAG = "BLE_CW_TONE";

static esp_err_t bt_ctrl_start(void)
{
    esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
    esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    esp_err_t err = esp_bt_controller_init(&bt_cfg);
    if (err != ESP_OK) return err;
    err = esp_bt_controller_enable(ESP_BT_MODE_BLE);
    return err;
}

static void bt_ctrl_stop(void)
{
    esp_bt_controller_disable();
    esp_bt_controller_deinit();
}

extern "C" void app_main(void)
{
    ESP_ERROR_CHECK(nvs_flash_init());
    ESP_LOGI(TAG, "Starting BLE controller…");
    ESP_ERROR_CHECK(bt_ctrl_start());
    uint32_t chan  = 19; // 2402 + 2*19 = 2440 MHz
    uint32_t power = 0;  //
    while(1)
    {
        ESP_LOGI(TAG, "Start BLE CW tone: chan=%"PRIu32" (%.0f MHz), power(attn)=%"PRIu32"*0.25 dB", chan, 2402.0 + 2.0*chan, power);
        esp_phy_bt_tx_tone(/*start=*/1, /*chan=*/chan, /*power=*/power);
        vTaskDelay(pdMS_TO_TICKS(2000));
        ESP_LOGI(TAG, "Stop BLE CW tone");
        esp_phy_bt_tx_tone(/*start=*/0, /*chan=*/0, /*power=*/0);
        vTaskDelay(pdMS_TO_TICKS(2000));
    }
    bt_ctrl_stop();
    ESP_LOGI(TAG, "Done.");
}
 


This compiles fine and runs on the esp32-s3.


Now, unfortunately, I need all of this to work in VisualMicro / Arduino, but I always get a linker error when I try it.
Here is also the Arduino-Version:
Code (C++)
Select All
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"

#include "esp_err.h"
#include "esp_log.h"

#include "esp_bt.h"
#include "esp_phy_cert_test.h"   // enthält esp_phy_bt_tx_tone()

static void startBleTone(uint32_t chan, uint32_t powerAttenQuarterdB)
{
    esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    esp_err_t err = esp_bt_controller_init(&bt_cfg);
    if (err != ESP_OK) {
        Serial.printf("Controller init failed: %d\n", err);
        return;
    }
    err = esp_bt_controller_enable(ESP_BT_MODE_BLE);
    if (err != ESP_OK) {
        Serial.printf("Controller enable failed: %d\n", err);
        return;
    }
    esp_phy_bt_tx_tone(1,chan,powerAttenQuarterdB);
}

static void stopBleTone()
{
    esp_bt_controller_disable();
    esp_bt_controller_deinit();
}

void setup() {
    Serial.begin(115200);
    delay(1000);
    uint32_t chan = 19;
    uint32_t power = 0;
    Serial.println("Start BLE CW tone...");
    startBleTone(chan, power);
    delay(10000);
    Serial.println("Stop BLE CW tone");
    stopBleTone();
}

void loop() {
}

 



At compiling, I get this Link Error:

ld.exe: EMC_BLE_TEST.cpp.o:(.literal._Z5setupv+0x20): undefined reference to esp_phy_bt_tx_tone
ld.exe: EMC_BLE_TEST.cpp.o: in function setup()
EMC_BLE_TEST.ino:49: undefined reference to esp_phy_bt_tx_tone


The problem is that I have to integrate all of this into my main project, which is currently written using VisualMicro / Arduino.
Of course, I’ve already tried asking ChatGPT for help. Apparently, I would need to compile the core libraries myself and then move them into the global libs folder — but that could affect other projects.
Any suggestions?

Project Setup:
ESP32-S3 
Latest Arduino-IDF (3.3.1)
Latest VisualMicro (2025.0721.04)

Regards
John
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2789
Joined: Feb 13th, 2019
Re: How to enable CONFIG_ESP_PHY_ENABLE_CERT_TEST for Arduino (ESP32-S3) build?
Reply #1 - Sep 24th, 2025 at 9:56am
Print Post  
Thanks for the report, and to our understanding the suggestion from ChatGPT is correct.

The Arduino Board Package in use in vMicro/Arduino IDE contains a precompiled version of the IDF libraries, which can be found in the BoardPackage folder\tools\esp32-ardunolibs\idf-release_vxxxx\variant folder, along with the sdkconfig used to build it.

To amend the functionality you would need to rebuild the libraries with the relevant changes under IDF.

To avoid polluting other projects you could isolate this one using the Portable Solution approach, which allows you to isolate the core, libraries and sketches all into a single folder structure, which does not affect any other project on your machine.  It also makes integration with version control a lot simpler.

General Special Folders: https://www.visualmicro.com/page/Special-Folders-and-Portability.aspx
Portable Solution Wizard: https://www.visualmicro.com/page/New-Arduino-Portable-Solution.aspx
  
Back to top
IP Logged
 
Proteus74
Newbies
*
Offline


Posts: 2
Joined: Nov 7th, 2024
Re: How to enable CONFIG_ESP_PHY_ENABLE_CERT_TEST for Arduino (ESP32-S3) build?
Reply #2 - Sep 24th, 2025 at 10:10am
Print Post  
Oh, thank you very much for the quick response.

But Visual Micro currently (still) isn't capable of doing what VSCode with IDF can — meaning, allowing you to adjust your sdkconfig and then automatically recompiling everything, right?

Is that something that will eventually be supported?

In any case, I will now definitely try this with the portable solution.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2789
Joined: Feb 13th, 2019
Re: How to enable CONFIG_ESP_PHY_ENABLE_CERT_TEST for Arduino (ESP32-S3) build?
Reply #3 - Sep 24th, 2025 at 10:13am
Print Post  
In short no Visual Micro does not use IDF directly currently (with CMake compilation etc) like VSCode can.

We follow the Arduino build process which expects any IDF specific compilation to have already been performed to create the Arduino board package.

We will look into IDF compatibility again in Visual Studio however last time it was reviewed it took a lot of manual configuration which would need to be resolved.

Once the library is recompiled via IDF then everything should work as expected in vMicro/Arduino IDE.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint