Site icon Renzo Mischianti

Configuration for transparent transmission

Hello there (I'm new on the forum), I'm having a bad time with the Lora Module right there... I desperately tries to configure them but nothing works. Here is the configuration code :


/*
 * LoRa E32-TTL-100
 * Set configuration.
 * http://mischianti.org/lora-e32-device-for-arduino-esp32-or-esp8266-configuration-part-3/
 *
 * E32-TTL-100----- Arduino UNO
 * M0 ----- 3.3v
 * M1 ----- 3.3v
 * TX ----- PIN 2 (PullUP)
 * RX ----- PIN 3 (PullUP & Voltage divider)
 * AUX ----- Not connected
 * VCC ----- 3.3v/5v
 * GND ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

LoRa_E32 e32ttl100(2, 3); // e32 TX e32 RX
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);

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

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

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

	printParameters(configuration);
	configuration.ADDL = 0x0;
	configuration.ADDH = 0x0;
	configuration.CHAN = 0x17;

	configuration.OPTION.fec = FEC_0_OFF;
	configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
	configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
	configuration.OPTION.transmissionPower = POWER_17;
	configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;

	configuration.SPED.airDataRate = AIR_DATA_RATE_011_48;
	configuration.SPED.uartBaudRate = UART_BPS_115200;
	configuration.SPED.uartParity = MODE_00_8N1;

// Set configuration changed and set to not hold the configuration
	ResponseStatus rs = e32ttl100.setConfiguration(configuration,
			WRITE_CFG_PWR_DWN_LOSE);
	Serial.println(rs.getResponseDescription());
	Serial.println(rs.code);
	printParameters(configuration);
	c.close();
}

void loop() {

}
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("----------------------------------------");
}

Here is the sender code :

#include "Arduino.h"
#include "LoRa_E32.h"

#define LoRa_E32_DEBUG

LoRa_E32 e32ttl(2, 3);

void setup() {
// put your setup code here, to run once:
	Serial.begin(19200);
	e32ttl.begin();
}

void loop() {
// put your main code here, to run repeatedly:
	char frame[59] = "test\n";
	ResponseStatus rs = e32ttl.sendMessage(frame);
	Serial.println(frame);
	Serial.println(rs.getResponseDescription());

}

Here is the receiver code:

#include "Arduino.h"
#include "LoRa_E32.h"

#define LoRa_E32_DEBUG

LoRa_E32 e32ttl(2, 3);

void setup() {
// put your setup code here, to run once:
	e32ttl.begin();
	Serial.begin(19200);
}

void loop() {
// put your main code here, to run repeatedly:
	Serial.println(millis());
	ResponseContainer rs = e32ttl.receiveMessageUntil('\n');
	Serial.println(rs.data);
	Serial.println(rs.status.getResponseDescription());
}

If the sender is active the receiver stop without displaying the message:< If the sender is inactive it continues without stopping: I don't understand...
Exit mobile version