OPTION.MAC in ESP32

Here we can discuss about the problem found
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 269 times

OPTION.MAC in ESP32

Post by Fernando Perez »

On an ESP8266 I record this program:

Code: [Local Link Removed for Guests]

' Receptor
OPTION.MAC "AA:BB:CC:DD:EE:F1"
espnow.begin
onEspNowMsg message
wait

message:
  print "Received message: " + espnow.read$ 
return
On another ESP8266 I record this one:

Code: [Local Link Removed for Guests]

' Emisor
espnow.begin
espnow.add_peer "AA:BB:CC:DD:EE:F1"
timer0 10000, sendMessage
wait
END

sendMessage:
  msg$ = date$ + " " + time$ + " " + str$(rnd(1001))
  print "Sent message: " + msg$ 
  espnow.write msg$
return
In both modules, I leave the entire configuration page blank, except for the autorun, the AP name and the "Protected Access" data.

As always, I marvel at how Annex can achieve so much in so few lines. It works perfectly. For hours and days.

But if I try to do the same with an ESP32, on the receiving side I get the warning through the serial port:

Switched to AP Mode Vozpornoche
IP address: 192.168.4.1
Number of program lines: 9
Basic File Loaded: /receptor.bas
Program Running
Invalid MAC address line 2
Program Ended


My questions: Does the OPTION.MAC instruction not work on the ESP32?
Is it written differently than on the ESP8266?
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: OPTION.MAC in ESP32

Post by cicciocb »

HI Fernando,
The name of your WiFi access point is always a bit disconcerting as it hide an ambiguous word within it... :lol:

There is probably an error in the command, I've just checked with WOKWI and the MAC address changes (and the module disconnects as expected) but there is an error message; you can check just with
print MAC$
after the command. You can skip the error message, I'll try to see why it happens.
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 269 times

Re: OPTION.MAC in ESP32

Post by Fernando Perez »

Vozpornoche is a town of 8 residents. In Cantabria, Spain.
43.143877470922845, -3.902896401340462.
I have lived in Santander for 50 years and I have never been to visit it. I'm lazy!
And don't worry, on ESP8266 it is working without problems for me and I can use these modules for my project.
User avatar
Oli
Posts: 91
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 23 times
Been thanked: 62 times
Contact:

Re: OPTION.MAC in ESP32

Post by Oli »

Hi,

I just wanted to integrate my C3 into the network, as I use ESP Now, together with the ESP8266.
Unfortunately the ESP32-C3 does not work anymore after OPTION.MAC.

Code: [Local Link Removed for Guests]

OPTION.MAC "00:00:00:01:00:50"
it disconnects and does not try to reconnect, it does not renew DHCP anymore.
even after restarting the module,
I have to reflash the settings part.
makes me perplexed, on the lab bench I can work with the C3 for some hours, but it does not work stable at all, even without Option.mac problem.
this at wlog you can see the problems well, with my test program, is 3meters from Router, have good dB

The ESP8266 have been running for years without any irregularities.

Code: [Local Link Removed for Guests]

Anf:
pause 1000
wlog time$ , "bin da"
goto Anf
.

Code: [Local Link Removed for Guests]

14:54:26    bin da
14:54:27    bin da
14:54:28    bin da
14:54:29    bin da
14:54:30    bin da
14:54:31    bin da
14:54:32    bin da
14:54:33    bin da
14:54:34    bin da
14:54:35    bin da
14:54:36    bin da
14:54:37    bin da
14:54:38    bin da
14:54:39    bin da
14:54:40    bin da
03/10/2024 16:54:43 => Connection Error
03/10/2024 16:54:43 => Connection OFF
03/10/2024 16:54:44 => Connection Lost
03/10/2024 16:54:48 => Connection ON
14:54:48    bin da
14:54:49    bin da
14:54:50    bin da
14:54:51    bin da
14:54:52    bin da
14:54:53    bin da
14:54:54    bin da
14:54:55    bin da
14:54:56    bin da
14:54:57    bin da
14:54:58    bin da
14:54:59    bin da
14:55:00    bin da
14:55:01    bin da
14:55:02    bin da
14:55:03    bin da
03/10/2024 16:55:09 => Connection Lost
03/10/2024 16:55:15 => Connection ON
14:55:04    bin da
03/10/2024 16:55:15 => Connection OFF
03/10/2024 16:55:23 => Connection ON
14:55:24    bin da
14:55:25    bin da
14:55:26    bin da
14:55:27    bin da
14:55:28    bin da
03/10/2024 16:55:34 => Connection Lost
03/10/2024 16:55:43 => Connection Error
03/10/2024 16:55:43 => Connection OFF
03/10/2024 16:55:44 => Connection Lost
03/10/2024 16:55:48 => Connection ON
14:55:49    bin da
14:55:50    bin da
14:55:51    bin da
03/10/2024 16:55:51 -> Program Stopped
I am very happy for your project,
I'm sure it will take a lot of time.
many thanks for that,
it's a pity that as a beta tester DAU I always stumble over things.
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: OPTION.MAC in ESP32

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Oct 03, 2024 3:08 pm Hi,

I just wanted to integrate my C3 into the network, as I use ESP Now, together with the ESP8266.
Unfortunately the ESP32-C3 does not work anymore after OPTION.MAC.

Code: [Local Link Removed for Guests]

OPTION.MAC "00:00:00:01:00:50"
it disconnects and does not try to reconnect, it does not renew DHCP anymore.
even after restarting the module,
I have to reflash the settings part.
You should probably try with another ESP32-C3 as I suppose that the one you have are defective.

Anyway, I'll try with my modules and I'll let you know.
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: OPTION.MAC in ESP32

Post by cicciocb »

OK, I did a very fast test using your command

Code: [Local Link Removed for Guests]

OPTION.MAC "00:00:00:01:00:50"
and I have this error

Code: [Local Link Removed for Guests]

ERR:Invalid MAC address
So, there is a problem :!: :shock:

I found that there is an bug inside the command OPTION.MAC but this do not inhibit the command to work, just the program stops because of the wrong error is generated.
I need to fix the command but, in the while, you can do as below:

Code: [Local Link Removed for Guests]

onerror skip 1
OPTION.MAC "00:00:00:01:00:50"
wifi.connect "your_WIFI", "your_PASSWORD"
print "MAC ADDRESS CHANGE TERMINATED"
print MAC$
and this is what is shown in the console :
image.png
You do not have the required permissions to view the files attached to this post.
User avatar
Oli
Posts: 91
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 23 times
Been thanked: 62 times
Contact:

Re: OPTION.MAC in ESP32

Post by Oli »

I had that suspicion too,
I bought 30 pieces, they were only 1.50€/pcs, some work better others worse,
then there are these false antennas.
Maybe I got C-grade goods.

I have problems with the terminal because of the soft USB.
after the reset "the hardware is plugged in again" it takes time until I can reconnect.
so i am blind,
With hardware Uart boards it works perfectly. bad not for C3

putting the IP configuration in the program and not in the config is a good idea

i had the program on autostart, so that the module starts and remains in the first program line....

Code: [Local Link Removed for Guests]

onerror skip 1
OPTION.MAC "00:00:00:01:00:50"
works :D
You do not have the required permissions to view the files attached to this post.
User avatar
Oli
Posts: 91
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 23 times
Been thanked: 62 times
Contact:

WIFI.CONNECT

Post by Oli »

I was busy rebuilding my wifi network these days.

I can recommend the routers from this seller:
https://www.ebay.de/sch/i.html?_ssn=bru ... sssolution
the devices have "breed" installed, so you can flash any firmware with hold the reset button without anything, openwrt, ddWRT, Pandora, ROOrer. the devices are sensitive and transmit with 1W 30dB, have built a MASH with it, at least matching SSID,
https://openwrt.org/docs/guide-user/net ... /bridgedap
I have built like this,

Code: [Local Link Removed for Guests]

wifi.connect "Router", "password", "24:65:11:D8:FA:4F" , "192.168.1.50" ,  "255.255.252.0" , "192.168.0.250"
now i want to connect the ESP, but the BSSID$ are different depending on the location, how can i use the command ? without the specification an error message comes up, i have also tried to enter a wrong one. how can i use the command without the BSSID$?
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: OPTION.MAC in ESP32

Post by cicciocb »

You can simply do :

Code: [Local Link Removed for Guests]

wifi.connect "Router", "password",  , "192.168.1.50" ,  "255.255.252.0" , "192.168.0.250"
User avatar
Oli
Posts: 91
Joined: Tue Feb 09, 2021 10:07 am
Location: Germany, Meissen
Has thanked: 23 times
Been thanked: 62 times
Contact:

Re: OPTION.MAC in ESP8266

Post by Oli »

Hello friends,
I would like to set the MAC address on the ESP8266, unfortunately it no longer worksAnnex WiFi 1.50 .
In the old version Annex WiFi 1.42.5B it still worked,
I have also tried

onerror skip 1
OPTION.MAC "00:00:00:01:00:27"
there is no error, but MAC is not exchanged.

if I only use OPTION.MAC "00:00:00:01:00:27"
and the program stops with the error, the same program, when restarted, will take over another MAC and run without error.
sometimes I have to switch back and forth between 2 different MACs for it to take over,
the next time i reboot, i have to see the error first, then it will work, but unfortunately i use autostart for my application.

the test program with 2 different MAC and delay works, but my router goes crazy with so many MAC changes,

i use ESP-NOW and the MAC is importantly, the new router does not show device names,
You do not have the required permissions to view the files attached to this post.
Post Reply