Site icon Renzo Mischianti

Error in setting configuration parameters in E22-900T30S

Hello, I'm unable use the library which I downloaded from the repository here. I'm using Arduino Mega 2560 with LoRa E22-900T30S and i followed the guidelines given in this link and developed the circuit according to the first Arduino circuit mentioned. I tried using pins 4 and 5 of arduino mega 2560 initially but i got an error message saying "No response from device! (Check wiring)" even though my circuit was exact same as that of the one present in the link i mentioned above. Then I changed to Software serial and made connections accordingly invoking my uart 1 by Serial2 in arduino code but still got the same message saying "No response from device! (Check wiring)". Then finally I chose to try in Hardware serial setup and used same Uart, following lines is how my serial monitor is printing messages now
"Old parameters
Wrong UART configuration! (BPS must be 9600 for configuration)
13
----------------------------------------
HEAD : 0 0 0

AddH : 1
AddL : 54
NetID : A1

Chan : 84 -> 494MHz

SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 0 -> 1200bps
SpeedAirDataRate : 111 -> 62.5kbps

OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 1 -> 17dBm
OptionRSSIAmbientNo: 0 -> Disabled (default)

TransModeWORPeriod : 1 -> 1000ms
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 1 -> Enabled
TransModeEnabRepeat: 1 -> Enabled
TransModeFixedTrans: 0 -> Transparent transmission (default)
----------------------------------------
Wrong UART configuration! (BPS must be 9600 for configuration)
13
New parameters
Wrong UART configuration! (BPS must be 9600 for configuration)
13
----------------------------------------
HEAD : 0 0 0

AddH : 1
AddL : 54
NetID : A1

Chan : 84 -> 494MHz

SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 0 -> 1200bps
SpeedAirDataRate : 111 -> 62.5kbps

OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 1 -> 17dBm
OptionRSSIAmbientNo: 0 -> Disabled (default)

TransModeWORPeriod : 1 -> 1000ms
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 1 -> Enabled
TransModeEnabRepeat: 1 -> Enabled
TransModeFixedTrans: 0 -> Transparent transmission (default)
----------------------------------------
"
Following is the modified code I used to get the above messages

#include "Arduino.h"
#include "LoRa_E22.h"

#define ACTIVATE_SOFTWARE_SERIAL
#define HARDWARE_SERIAL_SELECTABLE_PIN
LoRa_E22 e22ttl(19, 18, Serial1, 3, 7, 6);

void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);

void setup() {
	Serial.begin(9600);
	while(!Serial){};
	delay(500);

	Serial.println();

	// Startup all pins and UART
	e22ttl.begin();

	ResponseStructContainer c;
	c = e22ttl.getConfiguration();
	// It's important get configuration pointer before all other operation
	Configuration configuration = *(Configuration*) c.data;
        Serial.println("Old parameters");
	Serial.println(c.status.getResponseDescription());
	Serial.println(c.status.code);

	printParameters(configuration);

	configuration.ADDL = 0x03;
	configuration.ADDH = 0x00;
	configuration.NETID = 0x00;

	configuration.CHAN = 23;
  //	----------------------- FIXED SENDER RSSI -----------------------
	configuration.ADDL = 0x02;
	configuration.ADDH = 0x00;
	configuration.NETID = 0x00;

	configuration.CHAN = 23;

	configuration.SPED.uartBaudRate = UART_BPS_9600;
	configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
	configuration.SPED.uartParity = MODE_00_8N1;

	configuration.OPTION.subPacketSetting = SPS_240_00;
	configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
	configuration.OPTION.transmissionPower = POWER_22;

	configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
	configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
	configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
	configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
	configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_TRANSMITTER;
	configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
        
        	// Set configuration changed and set to not hold the configuration
	ResponseStatus rs = e22ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);
	Serial.println(rs.getResponseDescription());
	Serial.println(rs.code);

	c = e22ttl.getConfiguration();
	// It's important get configuration pointer before all other operation
	configuration = *(Configuration*) c.data;
  Serial.println("New parameters");
	Serial.println(c.status.getResponseDescription());
	Serial.println(c.status.code);

	printParameters(configuration);
}

void loop() {

}
void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.COMMAND, HEX);Serial.print(" ");Serial.print(configuration.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(configuration.LENGHT, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, HEX);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, HEX);
	Serial.print(F("NetID : "));  Serial.println(configuration.NETID, HEX);
	Serial.println(F(" "));
	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.getUARTBaudRateDescription());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRateDescription());
	Serial.println(F(" "));
	Serial.print(F("OptionSubPacketSett: "));  Serial.print(configuration.OPTION.subPacketSetting, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getSubPacketSetting());
	Serial.print(F("OptionTranPower    : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());
	Serial.print(F("OptionRSSIAmbientNo: "));  Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());
	Serial.println(F(" "));
	Serial.print(F("TransModeWORPeriod : "));  Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
	Serial.print(F("TransModeTransContr: "));  Serial.print(configuration.TRANSMISSION_MODE.WORTransceiverControl, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORTransceiverControlDescription());
	Serial.print(F("TransModeEnableLBT : "));  Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
	Serial.print(F("TransModeEnableRSSI: "));  Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
	Serial.print(F("TransModeEnabRepeat: "));  Serial.print(configuration.TRANSMISSION_MODE.enableRepeater, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRepeaterModeEnableByteDescription());
	Serial.print(F("TransModeFixedTrans: "));  Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());

	Serial.println("----------------------------------------");
}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD: "));  Serial.print(moduleInformation.COMMAND, HEX);Serial.print(" ");Serial.print(moduleInformation.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(moduleInformation.LENGHT, DEC);

	Serial.print(F("Model no.: "));  Serial.println(moduleInformation.model, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

Thanks in advance
Exit mobile version