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

LCTT test : Trigger Join Request problem #73

Open
YZATOUT opened this issue Jul 12, 2024 · 4 comments
Open

LCTT test : Trigger Join Request problem #73

YZATOUT opened this issue Jul 12, 2024 · 4 comments

Comments

@YZATOUT
Copy link

YZATOUT commented Jul 12, 2024

Hi,
I am using the LBM version 4.5.0 and I am testing the firmware using LCTT.

I obseved that loraMac freezes (no more packets are sent or a new Join is sent) when the tool asks the device to trigger a Join Request. However, all the other LCTT commands works fine.

When debugging I obseved that the "lorawan_join_internal_add_task( stack_id )" cannot be called as the modem task priority blocks the access in line below:

context->modem_task[JOIN_TASK + ( NUMBER_OF_TASKS * stack_id )].priority != TASK_FINISH

I added the line below to leave the network when the LORAWAN_CERTIFICATION_DUT_JOIN_REQ command is received and now it works fine (Join triggered successfully and there is no problem)

lorawan_api_join_status_clear( lorawan_certification_obj->stack_id );

Can you check please if the fix is OK

    case LORAWAN_CERTIFICATION_DUT_JOIN_REQ:
        if( rx_buffer_length == LORAWAN_CERTIFICATION_DUT_JOIN_REQ_SIZE )
        {
            // leave network
           lorawan_api_join_status_clear( lorawan_certification_obj->stack_id );
            lorawan_api_set_activation_mode( ACTIVATION_MODE_OTAA, lorawan_certification_obj->stack_id );
            ret = LORAWAN_CERTIFICATION_JOIN_REQ;
        }

Thank you.
Best regards.

@lbm-team
Copy link
Contributor

Hello, thank you for using LBM
Can you check if you didn't delete the line of code inadvertently ?

The lorawan_api_join_status_clear() is present in the master branch

Best Regards

@YZATOUT
Copy link
Author

YZATOUT commented Jul 12, 2024

Hi,
Thank you for you quick reply.
Sorry, I posted the wrong place.

The line added was :
smtc_modem_leave_network( lorawan_certification_obj[idx].stack_id );

in the section below:

case LORAWAN_CERTIFICATION_JOIN_REQ: {
        if( lorawan_api_isjoined( lorawan_certification_obj[idx].stack_id ) != JOINED )
        {
            // Leave the network before starting a rejoin.
            smtc_modem_leave_network( lorawan_certification_obj[idx].stack_id );
            lorawan_join_add_task( lorawan_certification_obj[idx].stack_id );
        }
        break;

Note, that I observed that this API: "smtc_modem_leave_network()" was added for "DM_REJOIN" but not in the section above. I do not know if it is forgotten.

case DM_REJOIN: {
        uint16_t dev_nonce       = ( cmd_input->buffer[1] << 8 ) | cmd_input->buffer[0];
        uint16_t lr1mac_devnonce = lorawan_api_devnonce_get( ctx->stack_id );
        if( lr1mac_devnonce != dev_nonce )
        {
            SMTC_MODEM_HAL_TRACE_WARNING( "DM invalid devnonce to rejoin\n" );
            uint8_t dm_fields_payload[1] = { DM_INFO_SESSION };
            cloud_dm_set_info_field( ctx->stack_id, dm_fields_payload, 1, DM_INFO_NOW );
            break;
        }
        // Leave network
        smtc_modem_leave_network( ctx->stack_id );
        // Add a new join task
        lorawan_join_add_task( ctx->stack_id );
        break;

Thank you.

@opeyrard
Copy link

Hi,
The smtc_modem_leave_network() command must not be used in certification to avoid killing the certification task.
Could you please test without this line added ?
Many thanks,
Best regards

@YZATOUT
Copy link
Author

YZATOUT commented Aug 19, 2024

Hi,
If I don't add the smtc_modem_leave_network(), the modem will never trigger a Join request.

After debugging, I observed the the lorawan_join_internal_add_task( stack_id ) cannot be called.
For unknown reason the task priority blocks the access in line below:

context->modem_task[JOIN_TASK + ( NUMBER_OF_TASKS * stack_id )].priority != TASK_FINISH

I did not find another workaround for this issue.

Did you test from your side the LORAWAN_CERTIFICATION_DUT_JOIN_REQ command with LCTT?

Thank you.
Best regards.

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

No branches or pull requests

3 participants