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

Use libuarte together with SoftDevice

Hello, guys.

We want to use libuarte - advanced UARTE driver in our current application developed for nRF52840 with SDK 17.0.2.

We can successfully run libuarte example located under \examples\peripheral\libuarte. However, the trouble comes when we want to merge this example in an environment that uses SoftDevice and app_timer modules.

I noticed that other people faced similar issues as well (thread). 

What would be the best way to merge libuarte into environment that uses SoftDevice and app_timer?

I noticed that libuarte example uses the following drivers:

      <file file_name="../../../../../../components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c" />
      <file file_name="../../../../../../components/drivers_nrf/nrf_soc_nosd/nrf_soc.c" />

Those drivers are for the case when SoftDevice is not present. In the presence of SoftDevice, what should we use?

I used 

<file file_name="../../../../../../components/softdevice/common/nrf_sdh_soc.c" />
 as a replacement for nrf_soc.c but I am not sure what should I put for the nrf_nvic.c replacement. Can you help me with this?

When I merge libuarte example into my environment that contains SoftDevice and app_timer modules, and use Timer 2 and RTC 2 for NRF_LIBUARTE_ASYNC_DEFINE:

NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);

nrf_libuarte_async_init() function returns error code 7 which should be NRF_ERROR_INVALID_PARAM according to nrf_error.h file.

Do you have any idea what I am doing wrong?

In this thread, there is a mention that NRFX_PRS_BOX_4 should be set to disabled. Does that impliy the following content into sdk_config.h file:

#ifndef NRFX_PRS_BOX_4_ENABLED
#define NRFX_PRS_BOX_4_ENABLED 0
#endif

Thanks in advance for your time and efforts.

Cheers,

Bojan.

Parents
  • Hey, guys!

    Just wanted to share with you that I was finally able to merge libuarte example into the application that contains SoftDevice and app_timer.

    Given that fact that SoftDevice requires RTC0 and Timer0 and app_timer library consumes RTC1, I used RTC2 and Timer2 for libuarte implementation:

    NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 2, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);

    The numbers 2, 2 in the above line of code mean RTC2 and Timer2 are taken for libuarte. At the same time, you should have enabled those ressources (RTC2, Timer2) through the sdk_config.h file.

    Also, I removed everything related to UART from sdk_config.h file and included drivers from libuarte example:

    Finally,

          <file file_name="../../../../../../components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c" />
          <file file_name="../../../../../../components/drivers_nrf/nrf_soc_nosd/nrf_soc.c" />
    lines should be replaced with:

          <file file_name="../../../../../../components/softdevice/common/nrf_sdh.c" />
          <file file_name="../../../../../../components/softdevice/common/nrf_sdh_soc.c" />

    I did not touch NRFX_PRS_BOX_4 from sdk_config.h file even if it was suggested in this thread.

    Cheers!

    Bojan.

  • can we use NRF_LOG_INFO( ) with this configuration above ? thanks

  • I got :

    <error> hardfault: HARD FAULT at 0x00017FB8

    <error> hardfault:   R0:  0x20001064  R1:  0x39000000  R2:  0x00000010  R3:  0x0000000F

    <error> hardfault:   R12: 0x20000E08  LR:  0x0001E39F  PSR: 0x21000029

    <error> hardfault: Cause: Data bus error (PC value stacked for the exception return points to the instruction that caused the fault).

    <error> hardfault: Bus Fault Address: 0x39000000

Reply
  • I got :

    <error> hardfault: HARD FAULT at 0x00017FB8

    <error> hardfault:   R0:  0x20001064  R1:  0x39000000  R2:  0x00000010  R3:  0x0000000F

    <error> hardfault:   R12: 0x20000E08  LR:  0x0001E39F  PSR: 0x21000029

    <error> hardfault: Cause: Data bus error (PC value stacked for the exception return points to the instruction that caused the fault).

    <error> hardfault: Bus Fault Address: 0x39000000

Children
No Data
Related