Comments (4)
Ciao @toi-go thank you very much, this is bad. I will fix it ASAP.
Could you provide with testing? I am now far from my electronics stash.
from pjon.
Here is the fix: 5f790b3
If you can give it a try.
from pjon.
Hi @gioblu ,
thank you for providing the patch. Unfortunately, with it, my two ESP32 cannot communicate with each other - no matter if I call bus.strategy.set_pmk or not. So, there must be another problem.
To test, I've used the ping example at examples/ESP32/ESPNOW/PlatformIO.
My setup() functions looks like this:
void setup()
{
Serial.begin(115200);
Serial.println("Receiver started.");
// Note PMK is 16 bytes, to store it in a char use char[17] or add an extra byte for the null terminator
char pmk[17] = "\x2b\xb2\x1e\x7a\x83\x13\x76\x9f\xf8\xa9\x3b\x1b\x5b\x52\xd0\x70";
bus.strategy.set_channel(6);
bus.strategy.set_pmk(pmk);
bus.set_receiver(receiver_function);
bus.begin();
};
void setup()
{
Serial.begin(115200);
Serial.println("Transmitter started.");
// Note PMK is 16 bytes, to store it in a char use char[17] or add an extra byte for the null terminator
char pmk[17] = "\x2b\xb2\x1e\x7a\x83\x13\x76\x9f\xf8\xa9\x3b\x1b\x5b\x52\xd0\x70";
bus.strategy.set_channel(6);
bus.strategy.set_pmk(pmk);
bus.set_receiver(receiver_function);
bus.begin();
bus.send_repeatedly(44, "P", 1, 100000); // Send P to device 44 10 times per second
};
from pjon.
It seems that the remaining problem is somehow related to autoregistration mode, as it works if it is disabled.
// Note PMK is 16 bytes, to store it in a char use char[17] or add an extra byte for the null terminator
char pmk[17] = "\x2b\xb2\x1e\x7a\x83\x13\x76\x9f\xf8\xa9\x3b\x1b\x5b\x52\xd0\x70";
bus.strategy.set_autoregistration(false);
bus.strategy.set_channel(6);
bus.strategy.set_pmk(pmk);
bus.set_receiver(receiver_function);
bus.begin();
uint8_t dev_mac[6] = { 0x10, 0x10, 0x10, 0x10, 0x10, 0x11 }; // MAC address of the remote node.
bus.strategy.add_node(44, dev_mac);
bus.send_repeatedly(44, "P", 1, 100000); // Send P to device 44 10 times per second
If you register remote nodes manually, you have to use the MAC address of the interface (AP or Station) which is actually in use (depending on CONFIG_STATION_MODE):
From ESPNOWHelper.h
/* ESPNOW can work in both station and softap mode.
It is configured in menuconfig. */
#if CONFIG_STATION_MODE
#define ESPNOW_WIFI_MODE WIFI_MODE_STA
#define ESPNOW_WIFI_IF ESP_IF_WIFI_STA
#else
#define ESPNOW_WIFI_MODE WIFI_MODE_AP
#define ESPNOW_WIFI_IF ESP_IF_WIFI_AP
#endif
In my case, CONFIG_STATION_MODE was not defined, so I had to use the MAC address of the AP interface.
To determine the MAC address, I used the following code:
Serial.println("ESP Board MAC Address: ");
#if CONFIG_STATION_MODE
WiFi.mode(WIFI_MODE_STA);
Serial.print(" Station interface: ");
Serial.println(WiFi.macAddress());
#else
WiFi.mode(WIFI_MODE_AP);
Serial.print(" AP interface: ");
Serial.println(WiFi.softAPmacAddress());
#endif
from pjon.
Related Issues (20)
- ESP32 to ESP32 using SoftwareBitBang and cable connection, no packets arrive HOT 13
- ATMega328P @ 8Mhz to ESP8266 no luck HOT 1
- Undefined behavior when using Ports HOT 5
- ESP32 <-> ESP8266 softwarebitbang communication failure HOT 5
- Question: How to read a character array from a received struct. HOT 3
- Dynamic addressing HOT 11
- PJON on RP2040 HOT 3
- SBB SAM3X8E (Arduino Due) Support HOT 1
- ESP <-> Mega - is level shifter supported ? HOT 3
- PJONSoftwareBitBang between stm32f4 and arduino nano not working HOT 3
- Unable to compile MQTT examples HOT 5
- ESP32 ESP-IDF without Arduino not work
- Video link broken for SoftwareBitBang feature showcase HOT 1
- PJDL half duplex HOT 1
- STM8 support?
- can PJON broadcast between different bus_ids
- TinyAVR1 class support
- Question: PJONThroughSerial half duplex UART HOT 1
- PJON SoftwareBitBang does not work for NodeMCU v3 (esp8266) when it acts as a transmitter.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pjon.