This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840 802.15.4 start command

Hi,

I'm trying to use the command "mlme_start_req" to setup the device as a pan coordinator to send beacons to the others devices in the network, but after submit the command the callback is not called. For instance, if I don't set a short address before the start the callback is called with the error code 153 (should be the 236, based on the struct mac_status_t), this means that the callback is working but only when something is wrong.

This is the start request:

    static void a_start(void * p_data)
        {
        	mlme_start_req_t startReq =
        	{
        			.pan_id  = 0x1234,
        			.logical_channel = 17,
        			.start_time = 0x000000,
        			.beacon_order = 0,
        			.superframe_order = 0,
        			.pan_coordinator = true,
        			.battery_life_extension = false,
        			.coord_realignment = false,
        	};
        	mlme_start_req( &startReq, mlme_start_conf);
}

This is the call back:

static void mlme_start_conf(mlme_start_conf_t * conf)
{
    fsm_event_data_t data =
    {
        .m_start_conf = conf,
    };
    fsm_event_post(E_START_DONE, &data);
}

Anyone have idea of what is happening?

fsm.c fsm.h main.c

Regards, Jose

  • I added your code tho the 802.15.4 example in SDK 13, and I get a callback and status = 236. What else are you doing in your application?

  • When I've got the error 153, I wasn't doing anything before calling the "mlme_start_req". I'm using the same example and I've just changed the state machine to just call this action. But if before I call the "start" action I call the action to define the short address as specified in IEEE Std 802.15.4-2006, section 7.1.14.1.2, the start request never return again. The callback is never called again and the device doesn't to anything after that point.

    Perhaps if send you the files will be easier for you, how can I send you the files?

    Thank you

  • Ok, yes I think that will be easier. You can edit your initial post and upload the files as an attachment.

  • Hi Jose,

    I'm sorry for the long delayed response to this issue. We now have a debug setup available, which should reduce debug time on similar cases in the future.

    The reason for this issue is that the parameter startReq in function a_start() is not declared static. The pointer to this structure is stored in library’s global data and used for calling the confirmation callback. When the parameter is not declared static, the variable will be out of scope when exiting a_start(), leading to a Hardfault when library trying to access callback address.

    Changing your code to this should solve the problem:

    static void a_start(void * p_data)
    {
    	static mlme_start_req_t startReq =
    	{
    		.pan_id  = 0x1234,
    		.logical_channel = 17,
    		.start_time = 0x000000,
    		.beacon_order = 0,
    		.superframe_order = 0,
    		.pan_coordinator = true,
    		.battery_life_extension = false,
    		.coord_realignment = false,
    	};
    	mlme_start_req( &startReq, mlme_start_conf);
    }
    

    Unfortunately it is not documented in the API reference that the MAC parameters need to be declared static.

    Best regards,

    Jørgen

Related