This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with porting nxp uart driver for nrf52840-dk

Hi i am involved in sdk5 based uart porting project

i can run example project and receive/send data to/from nrf52840-dk .

the problem is when i dig deep into the project i found more than one implementations of uart driver

nrfx_uart, nrf_drv_uart, and nrf_uart.

my task is to write an abstraction layer code and i am not sure which driver to use as base.

overall goal is to write init deint and write functions.

an easy example is appreciated

Parents Reply Children
  • I have some luck with your answer

    i am able to write init and deinit functions but i could not work on second instant or uart now

    i am using following to create instant 0 of nrf52840-dk

    #define APP_UART_DRIVER_INSTANCE 0

    static nrf_drv_uart_t uart_instent = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);

    however when i try creating second instant 

    #define APP_UART_SECOND_DRIVER_INSTANCE 1

    static nrf_drv_uart_t uart_instent2 = NRF_DRV_UART_INSTANCE(APP_UART_SECOND_DRIVER_INSTANCE);

    i get following error.

    'NRFX_UARTE1_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_UARTE0_INST_IDX'?

    Any idea how to perform it?

  • Please make sure UART1_ENABLED and or NRFX_UARTE1_ENABLED is set to '1' in your project.

  • Vidar Berg UART1_ENABLED 1 solved my problem now i can not see compile error

    how much instances i can create in nfr528540?

    is it correct way to create second instance

    #define APP_UART_SECOND_DRIVER_INSTANCE 1

    static nrf_drv_uart_t uart_instent2 = NRF_DRV_UART_INSTANCE(APP_UART_SECOND_DRIVER_INSTANCE);

  • Excellent! The 52840 has 2 UARTE instances in HW (Registers). So you can't set up more than 2. 

    #define APP_UART_SECOND_DRIVER_INSTANCE 1

    This symbol is used for the app uart library (not used in my example), so it won't have any effect unless you reference it in your code like you did.

Related