Home › Forums › The libraries hosted on the site › EByte LoRa e32 UART devices sx1262/sx1268 › ESP32 with Lora E32 not receiving data
Tagged: ESP32 E32900T30D
- This topic has 5 replies, 3 voices, and was last updated 9 months, 3 weeks ago by
adi1316.
-
AuthorPosts
-
-
15 June 2024 at 14:13 #30809
Hi Renzo,
I have 2 esp32-c6 devboards and i am using the below code.
I am facing 2 issues
1.)Whenever sender is trying to send data and making AUX High, i get Serial disconnected.
2.)Receiver Unit is not receiving the data.Sending Data
//Sender #include "Arduino.h" #define E32_TTL_1W #include "LoRa_E32.h" #define AUX 23 #define M0 10 #define M1 11 //HardwareSerial serial1(2); //LoRa_E32 e32ttl1w(&serial1,RX,TX, 18, UART_BPS_RATE_9600,SERIAL_8N1); LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1); void printParameters(struct Configuration configuration); void printModuleInformation(struct ModuleInformation moduleInformation); // Variables globales unsigned long interval = 15000; // interval between sends unsigned long lastSendTime = 0; // last send time byte msgCount = 0; // count of outgoing messages long randNumber; void setup() { //Inicio comunicacion serie con monitor Serial.begin(9600); delay(500); Serial.println(); e32ttl1w.begin(); //Configuro el nodo LoRa nodeConfig(); } void loop() { // Wait a few seconds between measurements. if (millis() - lastSendTime > interval) { // print a random number from 10 to 19 randNumber = random(10, 20); String trama = String(randNumber); ResponseStatus rs = e32ttl1w.sendFixedMessage(0x0, 0x3, 0x4, trama); Serial.println("Sending " + trama); Serial.println(rs.getResponseDescription()); lastSendTime = millis(); // timestamp the message msgCount++; } delay(100); } void nodeConfig(){ ResponseStructContainer c; c = e32ttl1w.getConfiguration(); Configuration configuration = *(Configuration*) c.data; configuration.ADDH = 0x0; configuration.ADDL = 0x1; configuration.CHAN = 0x4; configuration.SPED.airDataRate = AIR_DATA_RATE_010_24; configuration.SPED.uartBaudRate = UART_BPS_9600; configuration.SPED.uartParity = MODE_00_8N1; configuration.OPTION.fec = FEC_1_ON; configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION; configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; configuration.OPTION.transmissionPower = POWER_21; configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250; //printParameters(configuration); // Set configuration changed and set to not hold the configuration ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE); Serial.print("Config: "); Serial.println(rs.getResponseDescription()); }
Receiver Unit Code
//Receiver Code #include "Arduino.h" #define E32_TTL_1W #include "LoRa_E32.h" #define AUX 1 #define M0 10 #define M1 11 LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1); void setup() { //Inicio comunicacion serie con monitor Serial.begin(9600); delay(500); // Startup all pins and UART e32ttl1w.begin(); //Configuro el nodo LoRa nodeConfig(); //delay(4000); //fetchConfig(); } void loop() { if (e32ttl1w.available() > 0) { Serial.println("———-"); ResponseContainer rc = e32ttl1w.receiveMessage(); // If something goes wrong print error if (rc.status.code != 1) { rc.status.getResponseDescription(); } else { // Print the data received Serial.println(rc.data); } } delay(100); } void nodeConfig() { ResponseStructContainer c; c = e32ttl1w.getConfiguration(); Configuration configuration = *(Configuration*) c.data; configuration.ADDH = 0x0; configuration.ADDL = 0x3; configuration.CHAN = 0x4; configuration.SPED.airDataRate = AIR_DATA_RATE_010_24; configuration.SPED.uartBaudRate = UART_BPS_9600; configuration.SPED.uartParity = MODE_00_8N1; configuration.OPTION.fec = FEC_1_ON; configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION; configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; configuration.OPTION.transmissionPower = POWER_30; configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250; // Set configuration changed and set to not hold the configuration Serial.println("Updtaed config is "); ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE); Serial.print("Config: "); Serial.println(rs.getResponseDescription()); }
-
17 June 2024 at 08:12 #30811
Hi,
the code is correct, the only thing you must do is close the
ResponseStructContainer c;
like so
c.close();
Check the power supply. The 1W module needs a lot of power to work, so now use an external power supply and add a 100uF electrolytic capacitor (or more) and a 0.1uF ceramic capacitor to it.
Then use a getConfiguration sketch and send me the result.
Bye Renzo -
17 June 2024 at 10:54 #30822
Thanks Renzo for your support.
//Sender Config
//Sender Config 13:42:53.345 -> RX MIC ---> -1 13:42:53.345 -> TX MIC ---> -1 13:42:53.345 -> TX Const ---> 6 13:42:53.345 -> AUX ---> 23 13:42:53.418 -> M0 ---> 10 13:42:53.418 -> M1 ---> 11 13:42:53.418 -> Init AUX pin! 13:42:53.418 -> Init M0 pin! 13:42:53.418 -> Init M1 pin! 13:42:53.498 -> Begin ex 13:42:53.498 -> Begin Hardware Serial 13:42:53.498 -> Begin 13:42:53.498 -> MODE NORMAL! 13:42:53.535 -> AUX HIGH! 13:42:53.535 -> Complete! 13:42:53.568 -> MODE PROGRAM/SLEEP! 13:42:53.608 -> AUX HIGH! 13:42:53.608 -> Complete! 13:42:53.728 -> Available buffer: 6 structure size: 6 13:42:53.728 -> AUX HIGH! 13:42:53.728 -> Complete! 13:42:53.728 -> ---------------------------------------- 13:42:53.797 -> HEAD : 11000000 192 C0 13:42:53.797 -> 13:42:53.880 -> AddH : 0 13:42:53.880 -> AddL : 1 13:42:53.880 -> Chan : 4 -> 414MHz 13:42:53.880 -> 13:42:53.880 -> SpeedParityBit : 0 -> 8N1 (Default) 13:42:53.915 -> SpeedUARTDatte : 11 -> 9600bps (default) 13:42:53.998 -> SpeedAirDataRate : 10 -> 2.4kbps (default) 13:42:53.998 -> OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel) 13:42:54.113 -> OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups 13:42:54.182 -> OptionWakeup : 100 -> 1250ms 13:42:54.263 -> OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default) 13:42:54.332 -> OptionPower : 11 -> 10dBm 13:42:54.332 -> ---------------------------------------- 13:42:54.398 -> ---------------------------------------- 13:42:54.479 -> HEAD BIN INSIDE: 11000000 192 C0 13:42:54.479 -> ---------------------------------------- 13:42:54.479 -> MODE NORMAL! 13:42:54.514 -> AUX HIGH! 13:42:54.514 -> Complete! 13:42:54.514 -> Complete! 13:42:54.579 -> MODE PROGRAM/SLEEP! 13:42:54.612 -> AUX HIGH! 13:42:54.653 -> Complete! 13:42:54.696 -> AUX HIGH! 13:42:54.764 -> Complete! 13:42:54.764 -> Clear buffer...ok!
//Receiver Config
13:29:58.427 -> RX MIC ---> -1 13:29:58.427 -> TX MIC ---> -1 13:29:58.427 -> TX Const ---> 6 13:29:58.427 -> AUX ---> 1 13:29:58.427 -> M0 ---> 10 13:29:58.495 -> M1 ---> 11 13:29:58.495 -> Init AUX pin! 13:29:58.495 -> Init M0 pin! 13:29:58.495 -> Init M1 pin! 13:29:58.574 -> Begin ex 13:29:58.574 -> Begin Hardware Serial 13:29:58.574 -> Begin 13:29:58.574 -> MODE NORMAL! 13:29:58.574 -> AUX HIGH! 13:29:58.610 -> Complete! 13:29:58.646 -> MODE PROGRAM/SLEEP! 13:29:58.685 -> AUX HIGH! 13:29:58.685 -> Complete! 13:29:58.819 -> Available buffer: 6 structure size: 6 13:29:58.819 -> AUX HIGH! 13:29:58.819 -> Complete! 13:29:58.819 -> ---------------------------------------- 13:29:58.861 -> HEAD : 11000000 192 C0 13:29:58.861 -> 13:29:58.956 -> AddH : 0 13:29:58.956 -> AddL : 3 13:29:58.956 -> Chan : 4 -> 414MHz 13:29:58.956 -> 13:29:58.956 -> SpeedParityBit : 0 -> 8N1 (Default) 13:29:58.989 -> SpeedUARTDatte : 11 -> 9600bps (default) 13:29:59.059 -> SpeedAirDataRate : 10 -> 2.4kbps (default) 13:29:59.059 -> OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel) 13:29:59.179 -> OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups 13:29:59.258 -> OptionWakeup : 100 -> 1250ms 13:29:59.324 -> OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default) 13:29:59.391 -> OptionPower : 11 -> 10dBm 13:29:59.474 -> ---------------------------------------- 13:29:59.540 -> HEAD BIN INSIDE: 11000000 192 C0 13:29:59.540 -> ---------------------------------------- 13:29:59.575 -> MODE NORMAL! 13:29:59.575 -> AUX HIGH! 13:29:59.626 -> Complete! 13:29:59.626 -> Updtaed config is 13:29:59.662 -> MODE PROGRAM/SLEEP! 13:29:59.662 -> AUX HIGH! 13:29:59.705 -> Complete! 13:29:59.739 -> AUX HIGH! 13:29:59.805 -> Complete! 13:29:59.805 -> Clear buffer...ok! 13:29:59.805 -> ---------------------------------------- 13:29:59.872 -> HEAD BIN INSIDE: 11000000 192 C0 13:29:59.872 -> ---------------------------------------- 13:29:59.941 -> MODE NORMAL! 13:29:59.972 -> AUX HIGH! 13:30:00.006 -> Complete! 13:30:00.006 -> Config: Success
I have powering the sender/transmitter node with power bank and its working fine now.
Can you please check the configuration once and confirm if it is production deploy ready?
Also below is the updated code for your reference, if it needs any change
Updated Sender Code
//Sender #include "Arduino.h" #define E32_TTL_1W #include "LoRa_E32.h" #define FREQUENCY_868 #define AUX 23 #define M0 10 #define M1 11 #define txpin 5 #define rxpin 4 //HardwareSerial serial1(2); //LoRa_E32 e32ttl1w(txpin, rxpin, &Serial1, AUX, M0, M1, UART_BPS_RATE_9600); LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1); void printParameters(struct Configuration configuration); void printModuleInformation(struct ModuleInformation moduleInformation); // Variables globales unsigned long interval = 15000; // interval between sends unsigned long lastSendTime = 0; // last send time byte msgCount = 0; // count of outgoing messages long randNumber; void setup() { //Inicio comunicacion serie con monitor Serial.begin(9600); delay(500); Serial.println("In setup"); e32ttl1w.begin(); //Configuro el nodo LoRa nodeConfig(); } void loop() { // Wait a few seconds between measurements. if (millis() - lastSendTime > interval) { // print a random number from 10 to 19 randNumber = random(10, 20); String trama = String(randNumber); ResponseStatus rs = e32ttl1w.sendFixedMessage(0x0, 0x3, 0x4, trama); Serial.println("Sending " + trama); Serial.println(rs.getResponseDescription()); lastSendTime = millis(); // timestamp the message msgCount++; } delay(100); } void nodeConfig(){ ResponseStructContainer c; c = e32ttl1w.getConfiguration(); Configuration configuration = *(Configuration*) c.data; configuration.ADDH = 0x0; configuration.ADDL = 0x1; configuration.CHAN = 0x4; configuration.SPED.airDataRate = AIR_DATA_RATE_010_24; configuration.SPED.uartBaudRate = UART_BPS_9600; configuration.SPED.uartParity = MODE_00_8N1; configuration.OPTION.fec = FEC_1_ON; configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION; configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; configuration.OPTION.transmissionPower = POWER_21; configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250; //printParameters(configuration); c.close(); // Set configuration changed and set to not hold the configuration ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE); Serial.print("Config: "); Serial.println(rs.getResponseDescription()); }
Updated Receiver Code
//Receiver Code #include "Arduino.h" #define E32_TTL_1W #include "LoRa_E32.h" #define AUX 1 #define M0 10 #define M1 11 LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1); ResponseContainer rc; void setup() { //Inicio comunicacion serie con monitor Serial.begin(9600); Serial.println("In setup mode"); delay(500); // Startup all pins and UART e32ttl1w.begin(); //Configuro el nodo LoRa nodeConfig(); //delay(4000); //fetchConfig(); } void loop() { if (e32ttl1w.available() > 0) { Serial.println("———-"); rc = e32ttl1w.receiveMessageUntil(); //rc.close(); // If something goes wrong print error if (rc.status.code != 1) { rc.status.getResponseDescription(); } else { // Print the data received Serial.println(rc.data); } //rc.close(); } delay(100); } void nodeConfig() { ResponseStructContainer c; c = e32ttl1w.getConfiguration(); Configuration configuration = *(Configuration*) c.data; configuration.ADDH = 0x0; configuration.ADDL = 0x3; configuration.CHAN = 0x4; configuration.SPED.airDataRate = AIR_DATA_RATE_010_24; configuration.SPED.uartBaudRate = UART_BPS_9600; configuration.SPED.uartParity = MODE_00_8N1; configuration.OPTION.fec = FEC_1_ON; configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION; configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; configuration.OPTION.transmissionPower = POWER_21; configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250; // Set configuration changed and set to not hold the configuration c.close(); Serial.println("Updtaed config is "); ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE); Serial.print("Config: "); Serial.println(rs.getResponseDescription()); }
-
17 June 2024 at 11:04 #30823
Hi,
It’s seems ok, remember to do some long range test and use correct antenna.
Bye Renzo -
18 July 2024 at 14:20 #30990
Hi adi3116,
I’m using in my project an esp32 devkit v1 and also an E32-900t30d from Ebyte. I would like to test your sender and receiver codes but my question is: which pins are you using in your esp32 for Vcc, gnd, aux, txd, rxd, m0 and m1?
Another question is if the rxd and txd pins must be attached to the tx2 and rx2 respectively in the esp32.
-
26 July 2024 at 07:00 #31087
Hi Julio,
I am using tx2,rx2 pins . But i am using esp32-c6 board. So pins would be different.
E32 PIN ESP32 PINS
AUX 1
M0 10
M1 11Drop me an email on adi1316@gmail.com for any issue.
-
-
AuthorPosts
- You must be logged in to reply to this topic.