Closed masc-it closed 3 years ago
I've had issues in sending structs between 2 different MCU's as well. I believe it's due to how each compiler packs the data--odd it can't match a simple char. Some claim you can only use uint16_t between different boards. Try using EasyTransfer.h (that lib has a .h for hardware serial and software serial application). I'm having to use that lib on a current project and it works. I send / receive data using EasyTransfer and the EBYTE lib for module management. madsci1016/Arduino-EasyTransfer
|
madsci1016/Arduino-EasyTransfer
An Easy way to Transfer data between Arduinos. Contribute to madsci1016/Arduino-EasyTransfer development by crea... |
|
|
Thanks, Kris
On Thursday, April 30, 2020, 07:52:31 AM CDT, Mauro Sciancalepore <notifications@github.com> wrote:
I have a sender (Arduino Mega) and a Receiver (esp32, heltec v2).
These are the params: MEGA
Model no.: 45 Version : D Features : 14
Mode (HEX/DEC/BIN): 0/0/0 AddH (HEX/DEC/BIN): 0/0/0 AddL (HEX/DEC/BIN): 0/0/0 Sped (HEX/DEC/BIN): 1A/26/11010 Chan (HEX/DEC/BIN): 6/6/110 Optn (HEX/DEC/BIN): 47/71/1000111 Addr (HEX/DEC/BIN): 0/0/0
Model no.: 45 Version : D Features : 14
Mode (HEX/DEC/BIN): 0/0/0 AddH (HEX/DEC/BIN): 0/0/0 AddL (HEX/DEC/BIN): 0/0/0 Sped (HEX/DEC/BIN): 1A/26/11010 Chan (HEX/DEC/BIN): 6/6/110 Optn (HEX/DEC/BIN): 47/71/1000111 Addr (HEX/DEC/BIN): 0/0/0
Everything seems the same on both the modules, but the receiver doesn't receive anything at all.
Receiver loop code if (ESerial.available()) {
Transceiver.GetStruct(&MyData, sizeof(MyData));
Serial.print("Count: "); Serial.println(MyData.c);
}
Sender loop code strcpy(MyData.c , "test");
Transceiver.SendStruct(&MyData, sizeof(MyData));
Serial.print("Sending: "); Serial.println(MyData.c); delay(500);
The structure sent: struct DATA {
char c[10];
};
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@KrisKasprzak can you provide some samples using EasyTransfer? I think it would be useful for lots of people :)
EDIT Turned out that the I had to change the M0 pin on one of my boards and now I can finally transmit data :)
@onipot I have the same problem with two ESP32 MCUs.
Transceiver.PrintParameters() prints the default values on both modules.
----------------------------------------
Model no.: 45
Version : D
Features : 14
Mode (HEX/DEC/BIN): C0/192/11000000
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 1A/26/11010
Chan (HEX/DEC/BIN): 6/6/110
Optn (HEX/DEC/BIN): 44/68/1000100
Addr (HEX/DEC/BIN): 0/0/0
SpeedParityBit (HEX/DEC/BIN) : 0/0/0
SpeedUARTDataRate (HEX/DEC/BIN) : 3/3/11
SpeedAirDataRate (HEX/DEC/BIN) : 2/2/10
OptionTrans (HEX/DEC/BIN) : 0/0/0
OptionPullup (HEX/DEC/BIN) : 1/1/1
OptionWakeup (HEX/DEC/BIN) : 0/0/0
OptionFEC (HEX/DEC/BIN) : 1/1/1
OptionPower (HEX/DEC/BIN) : 0/0/0
----------------------------------------
Have you tried just sending/receiving single bytes instead of the struct, just to see, if the transmission works?
I first tried Transceiver.SendStruct()
, then the EasyTransfer library and finally just Transceiver.SendByte(58)
in the TX loop, and on the RX side:
if (Serial2.available()) {
Serial.println(Transceiver.GetByte());
}
But all to no avail :(
I'm ordering some new modules now to see if one is broken.
I have tested sending recieving struct and bytes. I'll have another look
Thanks, Kris On Wednesday, September 16, 2020, 11:10:06 AM CDT, Thomas Schüßler notifications@github.com wrote:
@onipot I have the same problem with two ESP32 MCUs.
Model no.: 45 Version : D Features : 14
Mode (HEX/DEC/BIN): C0/192/11000000 AddH (HEX/DEC/BIN): 0/0/0 AddL (HEX/DEC/BIN): 0/0/0 Sped (HEX/DEC/BIN): 1A/26/11010 Chan (HEX/DEC/BIN): 6/6/110 Optn (HEX/DEC/BIN): 44/68/1000100 Addr (HEX/DEC/BIN): 0/0/0
Have you tried just sending/receiving single bytes instead of the struct, just to see, if the transmission works?
I first tried Transceiver.SendStruct(), then the EasyTransfer library and finally just Transceiver.SendByte(58) in the TX loop, and on the RX side: if (Serial2.available()) { Serial.println(Transceiver.GetByte()); }
But all to no avail :(
I'm ordering some new modules now to see if one is broken.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
I have a sender (Arduino Mega) and a Receiver (esp32, heltec v2).
These are the params:
Everything seems the same on both the modules, but the receiver doesn't receive anything at all.
Receiver loop code
Sender loop code
The structure sent:
Parameters:
@KrisKasprzak any ideas?