The problem encountered when adding UART

Hello Nordic engineer,

I used SDK17.1.0 and examples \ ble_central_and_peripheral \ experimental \ ble_app_multirole_lesc

Chip is nRF52811

I have completed the addition of Nus and successfully ported the S132 (nRF52832) example to nRF52811 by modifying the chip, ROM, RAM, and define settings.

Now I want to add Uart, but I encounter the following problem

The breakpoint on the left side of the image is at line 1057, while the breakpoint on the right side is at line 1063. Should we check the R0 register? If so, it shows 0x09. Do we need to refer to the diagram below?

So the error is 'NRF_ERROR_INVALID_LENGTH'? If so, how should the issue be resolved?

The following are the ROM and RAM settings I configured, hoping they are helpful for identifying the issue.

Thanks

edit new information

#define UART_TX_BUF_SIZE                20                                         /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE                20                                         /**< UART RX buffer size. */

  • Hi tony55723,

    You can refer to the documentation for this error.  APP_UART_FIFO_INIT documentations shows that it actually calls app_uart_init(); and app_uart_init() documentation shows that it returns NRF_ERROR_INVALID_LENGTH when the buffer size is not a power of two. So that would be your problem.

    I have completed the addition of Nus and successfully ported the S132 (nRF52832) example to nRF52811 by modifying the chip, ROM, RAM, and define settings.

    S132 is not compatible with the nRF52811. You will want to use S140 or a smaller SoftDevice. The simplest way is to base off of the S140/PCA10056 example instead. However, you can also change the SoftDevice on your existing project.

    Refer to the nRF52811 compatibility matrix: https://infocenter.nordicsemi.com/topic/comp_matrix_nrf52811/COMP/nrf52811/nrf52811_ic_rev_sdk_sd_comp_matrix.html?cp=5_4_3_2.

    Finally, as you seem to be starting a new project, please note that the nRF5 SDK is in maintenance mode and we recommend the nRF Connect SDK instead.

    Hieu


    Please be informed that our team is currently having reduced availability due to the Easter holiday. There will be some delays in our response during this time, but we will respond to you at the earliest opportunity. Our apologies for the inconvenience.

  • Hello Hieu,

    Thank you for your reply.

    I tried adjusting both UART_TX_BUF_SIZE and UART_RX_BUF_SIZE to 32. This time the error occurred at APP_UART_FIFO_INIT(), with R0 displaying 0x08, corresponding to the image NRF_ERROR_INVALID_STATE.

    S132 is not compatible with the nRF52811

    Would avoiding the features exclusive to the 52811 and not present in the 52832 be sufficient to disregard compatibility issues? maybe Long Range?

  • Hi tony55723,

    tony55723 said:
    I tried adjusting both UART_TX_BUF_SIZE and UART_RX_BUF_SIZE to 32. This time the error occurred at APP_UART_FIFO_INIT(), with R0 displaying 0x08, corresponding to the image NRF_ERROR_INVALID_STATE.

    Could you please check if it is the same scenario mentioned here: https://devzone.nordicsemi.com/f/nordic-q-a/37735/app_uart_fifo_init-returns-nrf_error_invalid_state-error-0x00000008?

    I also recommend searching up the macro and error on the internet. The nRF5 SDK has been around for quite many years now, and the same question might have been asked in the past, so you would find it faster than waiting for support.

    tony55723 said:
    Would avoiding the features exclusive to the 52811 and not present in the 52832 be sufficient to disregard compatibility issues? maybe Long Range?

    No, it is not sufficient to disregard compatibility issues. Even if you somehow get it working right now, we cannot guarantee it will continue to work.

    Update: Another issue to note is that we do not do Bluetooth Qualification for the nRF52811 with SoftDevice S132, so you will not have a Bluetooth Qualification reference.  

  • Hello Hieu,

    Finally, when I disabled log_init, everything worked fine. I'd like to ask another question.

    In the scan_init function, you can use nrf_ble_scan_filter_set to filter out devices that you don't want to connect to. However, I'm wondering if it's also possible to "manually" filter within the scan_evt_handler callback. Both devices have the same name (HRS), but I only want to connect to one of them. Can I manually filter out the other device's address within the scan_evt_handler callback?

    Thnak you

  • Hi tony55723,

    Disabling log_init is an approach, as it's likely that log_init() also initialized the app_uart module. However, please be sure if that's what you want. You probably want logging, in which case, it's better to comment out your initialization of the app_uart module instead.

    We prefer you to open a new thread for questions of new topics. I can answer you quickly that it's possible to filter manually. Please go over the Scanning Module documentation to see if there is a filter better suited your need, or instructions on how to receive the scan report and do manual filtering. I must request that further question on a different topic be made on a new DevZone case though.

Related