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

lora sometime stuck after dio1 is triggered, but getPacketLength is 0 #1324

Open
trustmiao opened this issue Nov 18, 2024 · 5 comments
Open
Labels
template info missing Author of this issue ignored the issue template.

Comments

@trustmiao
Copy link

trustmiao commented Nov 18, 2024

in case of receiving(no transmitting job), when dio1 interrupt triggered, there are chances getPacketLength() return 0. everytime this happened the lora will stop working, no more interrupt will be triggered unless it will be reset.

Debug mode output

there are no dbg info showed up while it happend. though other info such as found chip is displayed. therefore I write some log.

most of time, it will receive perfectly, after the dio1 interrupt is triggered

I (335159) LORA_DEVICE: operation 1 Done transmitflag0!
I (335161) LORA_DEVICE: lora 1 received message len 13 msg:0xaf 0xff 0x01 0x00 0x90 0x00 0xaf 0xfe 0x0a 0x28 0x02 0x20 0x00 

but once a few hour after one interrupt hit, getPacketLength() will return 0. and it will stuck. since then no more interrupt will be trigged.

I (83884971) LORA_DEVICE: operation 1 Done transmitflag0!
W (83884971) LORA_DEVICE: lora 1 interrupt but no message

Sketch that is causing the module fail
if (operationDone[id])
{
    ESP_LOGI(LORA_TAG, "operation %d Done transmitflag%d!", id, (int)transmitFlag[id]);
    // reset flag
    operationDone[id] = false;
    if (transmitFlag[id])
    {
        ...
    }
    else
    {
        int len = radio[id]->getPacketLength();
        if (len == 0)
        {
            ESP_LOGW(LORA_TAG, "lora %d interrupt but no message", id);            
            bWaitingForReset = true;
            loraError[id] = true;
            return false;
        }
        int state = radio[id]->readData(receivebuffer[id], len);
        std::stringstream sentStr;
        for (size_t i = 0; i < len; i++)
        {
            sentStr << "0x" << std::setfill('0') << std::setw(sizeof(uint8_t) * 2) << std::hex << (int)receivebuffer[id][i] << " ";
        }
        ESP_LOGI(LORA_TAG, "lora %d received message len %d msg:%s", id, len, sentStr.str().c_str());
    }
}

Expected behavior
it should has none 0 packetlength , and keep receiving afterwards.

Additional info (please complete):
MCU: esp32 idf
Wireless module type: SX1262
Version: "7.1.0.0"
Platform: "Generic"

@StevenCellist
Copy link
Collaborator

Hi @trustmiao, there is a reason that there is a template when you file an issue. That reason is that we can't help you unless you fill out the whole template. So please do that first (and always)!

@StevenCellist StevenCellist added the template info missing Author of this issue ignored the issue template. label Nov 18, 2024
@trustmiao
Copy link
Author

I will try to upload the debug info. will RADIOLIB_DEBUG_BASIC level be enough?

@StevenCellist
Copy link
Collaborator

Basic is good, and please also supply all other information requested by the template - not just the debug info.

@trustmiao
Copy link
Author

I edited original post, wish this will explain what happened. however, there are not much debug info when issue happens.

@jgromes
Copy link
Owner

jgromes commented Nov 25, 2024

@trustmiao could you try to replicate this using a minimum sketch? From the snippet you have posted, I'm guessing there's a lot more behind the scenes that we don't see. Assuming the description is accurate, you should be able to trigger this using just the default interrupt receive example.

Also, since there's no debug information for the basic level, could you also include the SPI debug in the time when that issue happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template info missing Author of this issue ignored the issue template.
Projects
None yet
Development

No branches or pull requests

3 participants