Skip to content

Patched release is for ESP32-C3, which allows to set your own BASE / BLE MAC address

Latest

Choose a tag to compare

@luxlux luxlux released this 20 Mar 22:10
4878dbd

The patched release is for ESP32-C3. I used the Espressif IDF_version: 5.4.0 to build it.
Use at your own risk!

Extract the zip file. It contains 3 files: bootloader.bin, partition-table.bin and micropython.bin
I have used this commands to flash from my macbook:

first i erased the flash (the board was found as "/dev/tty.usbmodem1101" after connecting via usb):
esptool.py --chip esp32c3 --port /dev/tty.usbmodem1101 erase_flash

Then i flashed the firmware:
python -m esptool --chip esp32c3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 4MB --flash_freq 80m 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 micropython.bin

I flashed it successfully onto 3 different ESP32-C3 Boards (all with 4MB flash)

I used this code in micropython to set the MAC address, before any other network related tasks:

import bluetooth
from machine import base_mac_addr

# the BLE MAC address you want to use
mac = bytearray([0x3C, 0x27, 0x6F, 0xF0, 0x91, 0xE7])

# Because you can only directly set the base MAC address, which is 2 numbers lower than the BLE MAC address
# the base MAC address will be calculated here. using this base MAC, will result in setting also the 2 numbers bigger BLE MAC 
def base_ble_offset(mac):
    mac[5] = mac[5] - 2
    return mac

base_mac_addr(base_ble_offset(mac))

ble = bluetooth.BLE()

ble.active(True)
ble.config(gap_name="My_Device_Name")

....