Hi Renzo,
I'm using encryption, but maybe I'm doing something wrong.
I have to send commands from the gateway to the nodes in broadcast, and on 16 nodes only node 1 receives them.
To transmit:
rsTX = e220ttlTX->sendBroadcastFixedMessage(CHANNEL, message);
printLocalTime();
log_i("Invio: %s, %s", message.c_str(), rsTX.getResponseDescription());
To receive on nodes:
String input = "";
if (e220ttl->available() > 1)
{
Serial.println("Ho ricevuto un messaggio:");
// read the String message
ResponseContainer rc = e220ttl->receiveMessageRSSI();
// Is something goes wrong print error
if (rc.status.code != 1)
{
Serial.println(rc.status.getResponseDescription());
}
else
{
// Print the data received
Serial.println(rc.status.getResponseDescription());
input = rc.data;
Serial.print("RSSI: ");
Serial.println(rc.rssi, DEC);
RSSI = rc.rssi, DEC;
}
Serial.print("Stampo il messaggio che ho ricevuto: ");
Serial.println(input);
return input;
}
return input;
I built a Gateway with two modems, one for Transmitting and one for Receiving and I configure them like this:
initModemTX();
ResponseStructContainer c = e220ttlTX->getConfiguration();
Configuration configuration = *(Configuration *)c.data;
configuration.ADDL = ADDLTX;
configuration.ADDH = 0x00; // MAX 0xFF=255
configuration.CHAN = CHANNEL; // 0x19;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.airDataRate = AIR_DATA_RATE_011_48;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.subPacketSetting = SPS_200_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.enableLBT = LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
configuration.CRYPT.CRYPT_H = CRYPH;
configuration.CRYPT.CRYPT_L = CRYPL;
ResponseStatus rs = e220ttlTX->setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
c.close();
delay(100);
e220ttlTX->setMode(MODE_1_WOR_TRANSMITTER);
// e220ttlTX->setMode(MODE_0_NORMAL);
initModemRX();
delay(200);
ResponseStructContainer c2 = e220ttlRX->getConfiguration();
Configuration configuration2 = *(Configuration *)c2.data;
configuration2.ADDL = ADDLRX;
configuration2.ADDH = 0x00; // MAX 0xFF=255
configuration2.CHAN = CHANNEL; // 0x19;
configuration2.SPED.uartBaudRate = UART_BPS_9600;
configuration2.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration2.SPED.uartBaudRate = UART_BPS_9600;
configuration2.SPED.uartParity = MODE_00_8N1;
configuration2.OPTION.subPacketSetting = SPS_200_00;
configuration2.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
configuration2.OPTION.transmissionPower = POWER_22;
configuration2.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
configuration2.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration2.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
configuration2.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
configuration2.CRYPT.CRYPT_H = CRYPH;
configuration2.CRYPT.CRYPT_L = CRYPL;
ResponseStatus rs2 = e220ttlRX->setConfiguration(configuration2, WRITE_CFG_PWR_DWN_SAVE);
c2.close();
and the node configuration when I Receive:
ResponseStructContainer c = e220ttl->getConfiguration();
Configuration configuration = *(Configuration *)c.data;
configuration.ADDL = ID_NODE;
configuration.ADDH = 0x0; // MAX 0xFF=255
configuration.CHAN = CHANNEL;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.airDataRate = AIR_DATA_RATE_011_48;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.subPacketSetting = SPS_200_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.enableLBT = LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
configuration.CRYPT.CRYPT_H = CRYPH;
configuration.CRYPT.CRYPT_L = CRYPL;
ResponseStatus rs = e220ttl->setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
c.close();
e220ttl->setMode(MODE_2_WOR_RECEIVER);
delay(100);
and when transmit to the gateway:
e220ttl->setMode(MODE_0_NORMAL);
delay(100);
ResponseStructContainer c = e220ttl->getConfiguration();
Configuration configuration = *(Configuration *)c.data;
configuration.ADDL = ID_NODE;
configuration.ADDH = 0x0; // MAX 0xFF=255
configuration.CHAN = CHANNEL; // 0x19;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.subPacketSetting = SPS_200_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.enableLBT = LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
configuration.CRYPT.CRYPT_H = CRYPH;
configuration.CRYPT.CRYPT_L = CRYPL;
ResponseStatus rs = e220ttl->setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
c.close();
delay(100);