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

la915 #42

Open
tcpipchip opened this issue Jul 7, 2024 · 8 comments
Open

la915 #42

tcpipchip opened this issue Jul 7, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@tcpipchip
Copy link
Contributor

tcpipchip commented Jul 7, 2024

got some progress to port to LA915. I rebuilt the AU915 files.
Start
Setting TX Config: modem=MODEM_LORA, power=30, fdev=0, bandwidth=0, datarate=10, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
TX on freq 916400000 Hz at DR 2
TX: 00 41 1c fc 7f 67 e9 4a 53 25 cc 1f 05 15 e1 80 00 d0 aa 44 08 15 83
MAC txDone
RX_1 on freq 926900000 Hz at DR 10
MAC rxDone
RX: 204b5717c2185f9767d9e924db27d5d687
MlmeConfirm: req=MLME_JOIN, status=LORAMAC_EVENT_INFO_STATUS_OK, airtime=371, margin=0, gateways=0
Joined
Setting TX Config: modem=MODEM_LORA, power=30, fdev=0, bandwidth=0, datarate=10, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
TX on freq 916000000 Hz at DR 2
TX: 80 66 3a 34 16 80 01 00 01 7b 1e e3 9c 97 55 af 3b 5d 14 39 9e da ee 09 8f 01 9f 44 14 8e 62 c2 15 73
MAC txDone
RX_1 on freq 925700000 Hz at DR 10
MAC rxDone
RX: 60663a3416b0000000a3d35d8dcfb5246ecd829b7d7ce842fe9f26116b880ca1b2ceb76ba2
McpsConfirm: req=MCPS_CONFIRMED, status=LORAMAC_EVENT_INFO_STATUS_OK, datarate=2, power=0, ack=1, retries=1, airtime=453, upcnt=1, channel=4
McpsIndication: ind=MCPS_UNCONFIRMED, status=LORAMAC_EVENT_INFO_STATUS_OK, multicast=0, port=0, datarate=10, pending=1, size=0, rxdata=0, ack=1, dncnt=0, devaddr=16343a66, rssi=-101, snr=-3, slot=0
Sent packet
Setting TX Config: modem=MODEM_LORA, power=10, fdev=0, bandwidth=0, datarate=12, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
TX on freq 916600000 Hz at DR 0
TX: 80 66 3a 34 16 8a 02 00 09 03 07 03 07 03 07 04 05 07 01 7a 7d 25 de 9f ed 32 d7 50 97 5d 0e e2 65 de 0c 5c 3f 2d da 17 3a 5c 1d 6e
MAC txDone
RX_1 on freq 927500000 Hz at DR 8
MAC rxDone
RX: a0663a3416a0010001c46c6ee956088be8d2c1
McpsConfirm: req=MCPS_CONFIRMED, status=LORAMAC_EVENT_INFO_STATUS_OK, datarate=0, power=10, ack=1, retries=1, airtime=2139, upcnt=2, channel=7
McpsIndication: ind=MCPS_CONFIRMED, status=LORAMAC_EVENT_INFO_STATUS_OK, multicast=0, port=1, datarate=8, pending=1, size=6, rxdata=1, ack=1, dncnt=1, devaddr=16343a66, rssi=-101, snr=-2, slot=0
Sent packet
Received packet on port 1: 6D 69 67 75 65 6C

@tcpipchip tcpipchip added the enhancement New feature or request label Jul 7, 2024
@tcpipchip
Copy link
Contributor Author

tcpipchip commented Jul 15, 2024

Still running well on LA915 (LATIN AMERICA)
sir, how can i access the LOG info
core_debug(
"McpsIndication: ind=%s, status=%s, multicast=%u, port=%u, datarate=%u, pending=%u, size=%u, rxdata=%u, ack=%u, dncnt=%u, devaddr=%08x, rssi=%d, snr=%d, slot=%u\r\n",
toString(i->McpsIndication), ### toString(i->Status), i->Multicast, i->Port,
i->RxDatarate, i->IsUplinkTxPending, i->BufferSize, i->RxData,
i->AckReceived, i->DownLinkCounter, i->DevAddress,
status->Rssi, status->Snr, status->RxSlot);

--> toString(i->Status) <---
Inside the Arduino code ?

@fpistm
Copy link
Member

fpistm commented Jul 15, 2024

Enable the debug.

@tcpipchip
Copy link
Contributor Author

tcpipchip commented Jul 15, 2024

Yes, but i want to get access to that Status from my main source code.
For example, i want to compare if toString(i->Status) = LORAMAC_EVENT_INFO_STATUS_OK, for example...

@fpistm
Copy link
Member

fpistm commented Jul 15, 2024

Could you point exactly where it is?

@tcpipchip
Copy link
Contributor Author

tcpipchip commented Jul 15, 2024

yes, of course

void STM32LoRaWAN::MacMcpsConfirm(McpsConfirm_t* c) {
  // Called after an Mcps request (data TX) when the stack becomes idle again (so after RX windows)
  strcpy(STAT, toString(c->Status));
  core_debug(
    "McpsConfirm: req=%s, status=%s, datarate=%u, power=%d, ack=%u, %s=%u, airtime=%u, upcnt=%u, channel=%u\r\n",
     toString(c->McpsRequest), toString(c->Status), c->Datarate, c->TxPower,
     c->AckReceived,
    #if (defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000300 ))
      "retries", c->NbRetries,
    #elif (defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000400 ))
      "trans", c->NbTrans,
    #endif /* LORAMAC_VERSION */
    (unsigned)c->TxTimeOnAir, (unsigned)c->UpLinkCounter, (unsigned)c->Channel);
  instance->last_tx_acked = c->AckReceived;
  instance->fcnt_up = c->UpLinkCounter;
}

On stm32lorawan.cpp

I want to compare if the toString(c->Status) has some value on Arduino code.

@tcpipchip
Copy link
Contributor Author

tcpipchip commented Jul 15, 2024

hi @fpistm
my workaround is create a extern variable...but i dont like this :)

char STAT[128];

void STM32LoRaWAN::MacMcpsConfirm(McpsConfirm_t* c) {
  // Called after an Mcps request (data TX) when the stack becomes idle again (so after RX windows)
  strcpy(STAT, toString(c->Status));

and in the C Arduino

extern char STAT[128]; to have access to that variable with Status of LoRaWAN mac

@tcpipchip
Copy link
Contributor Author

tcpipchip commented Jul 15, 2024

work around

void lora_done()
{
  // If, after calling maintain() the library is no longer
  // busy, then the asynchronous operation has completed,
  // so check its results.
  String STAT_R = String(STAT);
  if (lora_state == TRANSMITTING) {
    if (STAT_R == "LORAMAC_EVENT_INFO_STATUS_OK")
       Serial.println("Sent packet");
    else
       Serial.println("Fail sent packet");    

@fpistm
Copy link
Member

fpistm commented Jul 16, 2024

Hi @tcpipchip
Please try to format the code else it is really hard to read.

It is fine if you achieve to get the value you want.

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

No branches or pull requests

2 participants