Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E32-900T30D V8 settings #70

Open
Edgineer10 opened this issue Sep 17, 2024 · 0 comments
Open

E32-900T30D V8 settings #70

Edgineer10 opened this issue Sep 17, 2024 · 0 comments

Comments

@Edgineer10
Copy link

Hello, I am using E32-900T30D V8 with arduino mega2560 I am trying to set the configurations like frequencies so that it would use the write parameters but how would I set the 868 frequency? the default frequency is still appearing whenever I try to use the getconfig function this is my code.

#include <Arduino.h>
#include "LoRa_E32.h"
#include <SoftwareSerial.h>
//TX RX PIN DECLARATION

boolean isBuzz = false;

//EBYTE E32 SETUP
#define RXD2 11
#define TXD2 10
SoftwareSerial Serial22(TXD2, RXD2);
#define AUX 12
#define M0 8
#define M1 9

#define E32_TTL_100
#define FREQUENCY_868

LoRa_E32 e32ttl(&Serial22, AUX, M0, M1, UART_BPS_RATE_9600); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX

//Function Declarations
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch

void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB
}
delay(100);
e32ttl.begin();
setConfiguration();
delay(5000);

//SAMPLE SEND
ResponseStatus rs = e32ttl.sendMessage("BUZZON");
Serial.println(rs.getResponseDescription());
}

// The loop function is called in an endless loop
void loop() {

//SAMPLE SEND
//ResponseStatus rs = e32ttl.sendMessage("BUZZON");
//Serial.println(rs.getResponseDescription());
delay(1000);

if (e32ttl.available() > 1) {
// read the String message
ResponseContainer rc = e32ttl.receiveMessage();
// Is something goes wrong print error
if (rc.status.code != 1) {
rc.status.getResponseDescription();
} else {
String message = rc.data;
Serial.println(message);
}
}

}

void setConfiguration() {
// After set configuration comment set M0 and M1 to low
// and reboot if you directly set HIGH M0 and M1 to program
ResponseStructContainer c;
c = e32ttl.getConfiguration();
Configuration configuration = (Configuration)c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);

// 00 FF (BROADCASTING ADDRESS AS A TRANSMITTER, MONITOR ADDRESS AS RECEIVER)FOR ADDRESS HIGH AND LOW
configuration.ADDL = 0x00;
configuration.ADDH = 0xFF;
// FOR 923 MHZ 862+61 (3D in hexadecimals)
configuration.CHAN = 0x3D;
// DEFAULT SETTINGS
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.transmissionPower = POWER_10;
//FEC MODE OFF
configuration.OPTION.fec = FEC_0_OFF;

//TRANSPARENT TRANSMISSION
configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
printParameters(configuration);

ResponseStructContainer cMi;
cMi = e32ttl.getModuleInformation();
// It's important get information pointer before all other operation
ModuleInformation mi = *(ModuleInformation *)cMi.data;
Serial.println(cMi.status.getResponseDescription());
Serial.println(cMi.status.code);
printModuleInformation(mi);

cMi.close();
c.close();
// ---------------------------
}

void printParameters(struct Configuration configuration) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD : "));
Serial.print(configuration.HEAD, BIN);
Serial.print(" ");
Serial.print(configuration.HEAD, DEC);
Serial.print(" ");
Serial.println(configuration.HEAD, HEX);
Serial.println(F(" "));
Serial.print(F("AddH : "));
Serial.println(configuration.ADDH, BIN);
Serial.print(F("AddL : "));
Serial.println(configuration.ADDL, BIN);
Serial.print(F("Chan : "));
Serial.print(configuration.CHAN, DEC);
Serial.print(" -> ");
Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit : "));
Serial.print(configuration.SPED.uartParity, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDatte : "));
Serial.print(configuration.SPED.uartBaudRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTBaudRate());
Serial.print(F("SpeedAirDataRate : "));
Serial.print(configuration.SPED.airDataRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getAirDataRate());
Serial.print(F("OptionTrans : "));
Serial.print(configuration.OPTION.fixedTransmission, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getFixedTransmissionDescription());
Serial.print(F("OptionPullup : "));
Serial.print(configuration.OPTION.ioDriveMode, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getIODroveModeDescription());
Serial.print(F("OptionWakeup : "));
Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
Serial.print(F("OptionFEC : "));
Serial.print(configuration.OPTION.fec, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getFECDescription());
Serial.print(F("OptionPower : "));
Serial.print(configuration.OPTION.transmissionPower, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getTransmissionPowerDescription());
Serial.println("----------------------------------------");
}
void printModuleInformation(struct ModuleInformation moduleInformation) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD BIN: "));
Serial.print(moduleInformation.HEAD, BIN);
Serial.print(" ");
Serial.print(moduleInformation.HEAD, DEC);
Serial.print(" ");
Serial.println(moduleInformation.HEAD, HEX);
Serial.print(F("Freq.: "));
Serial.println(moduleInformation.frequency, HEX);
Serial.print(F("Version : "));
Serial.println(moduleInformation.version, HEX);
Serial.print(F("Features : "));
Serial.println(moduleInformation.features, HEX);
Serial.println("----------------------------------------");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant