Nordic52840 UARTE1 无法使用

In SDK17.1.0, there is an example called libuarte. Here the example uses UARTE0 to send and receive serial port data, and he is defined as follows.

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

Compile and burn this project with no problem。

But if I change the index of UARTE to 1, his definition is as follows.

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

When compiling, the compiler reports an error with the following error message.

..\..\..\main.c(82): error: #94: the size of an array must be greater than zero
NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 1, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);
..\..\..\main.c: 0 warnings, 1 error

Checked the code and still don't know why the compiler reported this error?

  • Hi there,

    Is the example unmodified? I was able to build with NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 1, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3) without any errors. Did you also remember to enable the instance in the sdk_config.h file?:

    // <q> NRF_LIBUARTE_DRV_UARTE1  - UARTE1 instance
     
    
    #ifndef NRF_LIBUARTE_DRV_UARTE1
    #define NRF_LIBUARTE_DRV_UARTE1 1
    #endif
    
    Also, which toolchain are you using? 
    regards
    Jared
Related