Error with peripheral_uart_coded.

Hi,

Referring to the case,

https://devzone.nordicsemi.com/f/nordic-q-a/72660/nrf-connect-sdk-v-1-5-0-how-where-to-change-phy-and-tx-power-for-long-range-application

I used the peripheral_uart_coded.rar code, but when tried to flash it on the nRF5340-DK board there is an error been prompted as     invalid use of undefined type 'struct bt_conn'.  what might be the issue.

I'm using SDK v1.8.0 and Visual studio code.

Regards

Karthik Kumar

Parents
  • Hi Karthik Kumar,

    The example code is made for v1.5.0 of nRF Connect for Desktop, so using it with v1.8.0 might cause errors and unexpected behavior.

    This issue is fixed by changing the auth_conn parameter in LOG_INF in function num_comp_reply() to (void *)auth_conn so that you have the following instead:

    static void num_comp_reply(bool accept)
    {
    	if (accept) {
    		bt_conn_auth_passkey_confirm(auth_conn);
    		LOG_INF("Numeric Match, conn %p", (void *)auth_conn);
    	} else {
    		bt_conn_auth_cancel(auth_conn);
    		LOG_INF("Numeric Reject, conn %p", (void *)auth_conn);
    	}
    
    	bt_conn_unref(auth_conn);
    	auth_conn = NULL;
    }

    You should also be aware that there were some changes to the Zephyr Workqueue API in nRF Connect SDK v1.6.0, and part of the API has become deprecated and replaced. You can read more about this in Zephyr Workqueue API Migration, but the relevant parts for your code are the functions k_delayed_work_init() and k_delayed_work_submit():

    Deprecated API Corresponding new API
    k_delayed_work_init() k_work_init_delayable()
    k_delayed_work_submit() k_work_schedule() or k_work_reschedule()

    As you can see, k_delayed_work_submit() has been split into two function that covers different usage scenarios, so you must make sure to use the correct one:

    Please see the release notes for other changes between specific nRF Connect SDK releases.

    Best regards,

    Marte

Reply
  • Hi Karthik Kumar,

    The example code is made for v1.5.0 of nRF Connect for Desktop, so using it with v1.8.0 might cause errors and unexpected behavior.

    This issue is fixed by changing the auth_conn parameter in LOG_INF in function num_comp_reply() to (void *)auth_conn so that you have the following instead:

    static void num_comp_reply(bool accept)
    {
    	if (accept) {
    		bt_conn_auth_passkey_confirm(auth_conn);
    		LOG_INF("Numeric Match, conn %p", (void *)auth_conn);
    	} else {
    		bt_conn_auth_cancel(auth_conn);
    		LOG_INF("Numeric Reject, conn %p", (void *)auth_conn);
    	}
    
    	bt_conn_unref(auth_conn);
    	auth_conn = NULL;
    }

    You should also be aware that there were some changes to the Zephyr Workqueue API in nRF Connect SDK v1.6.0, and part of the API has become deprecated and replaced. You can read more about this in Zephyr Workqueue API Migration, but the relevant parts for your code are the functions k_delayed_work_init() and k_delayed_work_submit():

    Deprecated API Corresponding new API
    k_delayed_work_init() k_work_init_delayable()
    k_delayed_work_submit() k_work_schedule() or k_work_reschedule()

    As you can see, k_delayed_work_submit() has been split into two function that covers different usage scenarios, so you must make sure to use the correct one:

    Please see the release notes for other changes between specific nRF Connect SDK releases.

    Best regards,

    Marte

Children
No Data
Related