Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

uart function is not working in nfc example.

Hello, nordic.

I have added uart functionality to hrs example, to add OBB pairing to uart example.

I have replaced as hrs --> nus and have inserted uart_init(), uart_event_handler and so on.

When I add uart_init () to main.c, it says that there is no problem with the code, but the LED is switching so fast that it looks a little bit and the advertising does not start.

I use

- SDK v11

- nRF52832

These issues do not make progress.
Please help me.

Thanks.

(Can I attach additional project files? If you need me to help you, I will attach it.)

  • Hello,

    It seems like you are stuck in a reboot loop. Probably one of your function calls that are checked with APP_ERROR_CHECK(err_code) does not return NRF_SUCCESS.

     

    Can you try the following:

    -Go to project settings, and define "DEBUG" to your preprocessor defines.

    -Disable optimization in your project settings.

    -Set a breakpoint in app_error.c on line 54, and see if that breakpoint is reached, and what line number, file name and error_code the APP_ERROR_CHECK() that triggered is located.

     

    Best regards,

    Edvin

  • hi, Edvin.

    It has been resolved to some extent as you have said. There was a conflict with the UART function.

    So, after NFC tagging, ble advertising and uart function is running well.

    and I wondering that ble connected very well in nRF connect APP.

    But, it breaks as soon as it is connected in nRF UART or nRF ToolBox APP.

    Could you tell me reason?

  • I am not sure why that happens. Can you do the same check, and see if the error handler picks up any err_code != NRF_SUCCESS?

     

    BR,

    Edvin

  • I'm sorry, I made a mistake.

    After Inserting the uart program, When nfc is tagged, ble starts advertising.

    However, if I click the connection in nRF connect APP, it will be disconnected immediately.

    Why is it doing this?

  • You need to see why this happens. Have you checked the error handler, or the disconnect reason? If you enable logging it might give some hints on why it disconnects. You can also set a breakpoint on the disconnection event, and check what disconnect reason that is reported. 

    Depending on how you have set up your project, this may be a bit different for you, but in most of our examples in SDK 11, you will have the event BLE_GAP_EVT_DISCONNECTED inside on_ble_evt(...) in main.c.

    Inside this event, check the disconnect reason:

    case BLE_GAP_EVT_DISCONNECTED:
                m_conn_handle = BLE_CONN_HANDLE_INVALID;
                uint8_t reason = p_ble_evt->evt.gap_evt.params.disconnected.reason;
                break;

    Check this reason to see if that can give any hints on the disconnect. If this is never reached in your project, it is probably because of an err_code != NRF_SUCCESS passed into an APP_ERROR_CHECK(err_code) in your project, which should be detected in app_error.c

     

    Best regards,

    Edvin

Related