Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit adeebf1

Browse files
author
Daniel Campora
committed
esp32: Fixes in order to get the US915 certification passing.
1 parent 9df2333 commit adeebf1

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

esp32/mods/modlora.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ static void McpsConfirm (McpsConfirm_t *McpsConfirm) {
558558
}
559559

560560
static void McpsIndication (McpsIndication_t *mcpsIndication) {
561+
bool bDoEcho = true;
562+
561563
if (mcpsIndication->Status != LORAMAC_EVENT_INFO_STATUS_OK) {
562564
return;
563565
}
@@ -590,8 +592,22 @@ static void McpsIndication (McpsIndication_t *mcpsIndication) {
590592
lora_obj.snr = mcpsIndication->Snr;
591593
lora_obj.sfrx = mcpsIndication->RxDatarate;
592594

593-
if (lora_obj.ComplianceTest.Running == true) {
594-
lora_obj.ComplianceTest.DownLinkCounter++;
595+
if ((mcpsIndication->Port == 224) && (lora_obj.ComplianceTest.Enabled == true)
596+
&& (lora_obj.ComplianceTest.Running == true)) {
597+
MibRequestConfirm_t mibReq;
598+
mibReq.Type = MIB_CHANNELS_DATARATE;
599+
LoRaMacMibGetRequestConfirm( &mibReq );
600+
if (mcpsIndication->Buffer[0] == 4) { // echo service
601+
if (ValidatePayloadLength(mcpsIndication->BufferSize, mibReq.Param.ChannelsDatarate, 0)) {
602+
lora_obj.ComplianceTest.DownLinkCounter++;
603+
} else {
604+
// do not increment the downlink counter and don't send the echo either
605+
bDoEcho = false;
606+
}
607+
} else {
608+
// increament the downlink counter anyhow
609+
lora_obj.ComplianceTest.DownLinkCounter++;
610+
}
595611
}
596612

597613
// printf("MCPS indication!=%d :%d\n", mcpsIndication->BufferSize, mcpsIndication->Port);
@@ -674,10 +690,15 @@ static void McpsIndication (McpsIndication_t *mcpsIndication) {
674690
break;
675691
case 4: // (vii)
676692
// return the payload
677-
if (mcpsIndication->BufferSize <= LORA_PAYLOAD_SIZE_MAX) {
678-
memcpy((void *)rx_data_isr.data, mcpsIndication->Buffer, mcpsIndication->BufferSize);
679-
rx_data_isr.len = mcpsIndication->BufferSize;
680-
xQueueSend(xRxQueue, (void *)&rx_data_isr, 0);
693+
if (bDoEcho) {
694+
if (mcpsIndication->BufferSize <= LORA_PAYLOAD_SIZE_MAX) {
695+
memcpy((void *)rx_data_isr.data, mcpsIndication->Buffer, mcpsIndication->BufferSize);
696+
rx_data_isr.len = mcpsIndication->BufferSize;
697+
xQueueSend(xRxQueue, (void *)&rx_data_isr, 0);
698+
}
699+
} else {
700+
// set the state back to 1
701+
lora_obj.ComplianceTest.State = 1;
681702
}
682703
// printf("Crypto message received\n");
683704
break;

esp32/tools/lora/certification/certification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def run(self):
8989
self.s.send(self.tx_payload)
9090
except Exception:
9191
pass
92-
time.sleep(1)
92+
time.sleep(1.5)
9393

9494
if self.lora.compliance_test().link_check:
9595
self.tx_payload = bytes([5, self.lora.compliance_test().demod_margin,

0 commit comments

Comments
 (0)