Libuarte ppi linker errors

My app is similar to BLE UART example. I have some UART errors when data is ent too fast so I'm trying to move to LIBUARTE as described in this ticket but I'm getting linker errors as below.

    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `nrfx_ppi_channel_include_in_group':
    undefined reference to `nrfx_ppi_channels_include_in_group'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_channel_configure':
    undefined reference to `nrfx_ppi_channel_alloc'
    undefined reference to `nrfx_ppi_channel_assign'
    undefined reference to `nrfx_ppi_channel_fork_assign'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_group_configure':
    undefined reference to `nrfx_ppi_group_alloc'
    undefined reference to `nrfx_ppi_group_enable'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_ch_free':
    undefined reference to `nrfx_ppi_channel_disable'
    undefined reference to `nrfx_ppi_channel_free'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_group_free':
    undefined reference to `nrfx_ppi_group_free'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_ch_enable':
    undefined reference to `nrfx_ppi_channel_enable'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `ppi_ch_disable':
    undefined reference to `nrfx_ppi_channel_disable'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `nrf_libuarte_drv_init':
    undefined reference to `nrfx_timer_init'
    Output/MYPROJ Debug/Obj/nrf_libuarte_drv.o: In function `nrf_libuarte_drv_rx_start':
    undefined reference to `nrfx_timer_enable'
    undefined reference to `nrfx_timer_clear'
    Output/MYPROJ Debug/Obj/nrf_libuarte_async.o: In function `nrf_libuarte_async_init':
    undefined reference to `nrfx_ppi_channel_alloc'
    undefined reference to `nrfx_ppi_channel_assign'
    undefined reference to `nrfx_ppi_channel_fork_assign'
    undefined reference to `nrfx_ppi_channel_assign'
    undefined reference to `nrfx_ppi_channel_fork_assign'
    Output/MYPROJ Debug/Obj/nrf_libuarte_async.o: In function `nrf_libuarte_async_enable':
    undefined reference to `nrfx_ppi_channel_enable'
    undefined reference to `nrfx_ppi_channel_enable'
Build failed

I'm sure this is simple but I'm hitting a wall... can you put me out of my misery?

Thanks

Parents
  • Hi,

    Have you set NRFX_PPI_ENABLED and PPI_ENABLED to 1 in your sdk_config.h? (If you don't have the legacy configs in the file you don't need the latter, but if you do just set both)

  • Thanks, it was PPI_ENABLED I'd missed.

    I can build now but nrf_libuarte_async_init is now failing with error 0x07. The docs only say possible error codes are NRF_SUCCESS or NRF_ERROR_INTERNAL which doesn't really help. any ideas?

    static void uart_init(void)
    {
        uint32_t                     err_code;
    
        nrf_libuarte_async_config_t nrf_libuarte_async_config = {
                .tx_pin     = UART_TX,
                .rx_pin     = UART_RX,
                .baudrate   = NRF_UARTE_BAUDRATE_115200,
                .parity     = NRF_UARTE_PARITY_EXCLUDED,
                .hwfc       = NRF_UARTE_HWFC_DISABLED,
                .timeout_us = 100,
                .int_prio   = APP_IRQ_PRIORITY_LOW
        };
    
        err_code = nrf_libuarte_async_init(&libuarte, &nrf_libuarte_async_config, uart_event_handle, (void *)&libuarte);
        //ERROR 0x07 HERE

  • OK I found out why that was failing. I needed to increase the IRQ level when initialising nrf_libuarte_async_config for whatever reason.

    Now I can build OK. However when I run, only the 1st 16 bytes of the text string is transmitted during the uart_int routine. (error code is 0).

        static uint8_t text[] = "ble_app_libUARTE example started.\r\n";
        static uint8_t text_size = sizeof(text);
    
        err_code = nrf_libuarte_async_tx(&libuarte, text, text_size);
        APP_ERROR_CHECK(err_code);

    Also printf doesn't work anymore. I have retarget enabled and it was working fine before I changed over to this new uart method. I notice printf isn't used in the modified example I mentioned in my OP, should it work with this library?

Reply
  • OK I found out why that was failing. I needed to increase the IRQ level when initialising nrf_libuarte_async_config for whatever reason.

    Now I can build OK. However when I run, only the 1st 16 bytes of the text string is transmitted during the uart_int routine. (error code is 0).

        static uint8_t text[] = "ble_app_libUARTE example started.\r\n";
        static uint8_t text_size = sizeof(text);
    
        err_code = nrf_libuarte_async_tx(&libuarte, text, text_size);
        APP_ERROR_CHECK(err_code);

    Also printf doesn't work anymore. I have retarget enabled and it was working fine before I changed over to this new uart method. I notice printf isn't used in the modified example I mentioned in my OP, should it work with this library?

Children
  • Hi,

    Nick_RA said:
    OK I found out why that was failing. I needed to increase the IRQ level when initialising nrf_libuarte_async_config for whatever reason.

    Which priority are you using now? It would be interesting to know which other interrupts and priorities you have in the system and if you were able to figure out why you needed to increase the priority.

    Nick_RA said:
    Now I can build OK. However when I run, only the 1st 16 bytes of the text string is transmitted during the uart_int routine. (error code is 0).

    Is it always 16 bytes? And does that depend on other parts of your application (what if you comment out/remove most other parts if that is possible, for a test). I ask because it is difficult to see where that limitation comes from (the nRF52840 has a 8 bit DMA length field, so the maximum size that can be sent in one go i 255 bytes. Can you define DEBUG_NRF and test again, as that will enable the asserts?

    Nick_RA said:
    Also printf doesn't work anymore. I have retarget enabled and it was working fine before I changed over to this new uart method. I notice printf isn't used in the modified example I mentioned in my OP, should it work with this library?

    Retarget does not work with libuarte out of the box. You will need to modify the retarget implementation, as described in this post.

  • I was using APP_IRQ_PRIORITY_LOWEST for the uart, which was the setting originally in the ble_app_uart example. I had to change it because nrf_libuarte_async_init specifically checks it and returns an invalid parameter error.

    Anyway you may as well close this ticket as I need retarget and it is starting to look lile a rabbit hole. I have managed to tighten my UART event handler enough and tweak code to mitigate against buffer overruns (for context, uart is only used for a CLI here. Errors happened when the CLI commands come from a host running a script. This is maintenance of an exisiting project so I want to minimise the work I need to do on it).

    I would like to know how one can recover from a buffer overrun, but I'll raise a seperate ticket for that if I can't find an answer.

    Regards,

Related