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

ble_app_blinky + usb cli + 2x uart

I'm working on a prototype currently using the nRF52840 dongle. I've used the ble_app_blinky as a basic, and added some custom code to it. The goal is to use BLE in the end, but I've edited main to not do any ble at this stage. I've added support for both uarts and integrated in some of the cli demo using the usb port. So far, everything is working. Since this is based on the ble_app_blinky, the app uses s140 softdevice.

However, I've modified the behavior of the timer_handle() function.

static void timer_handle(void * p_context)

{
    UNUSED_PARAMETER(p_context);

    if (m_counter_active)
    {
        char line[80];
        sprintf(line"~~ counter = %d\r\n"m_counter);
        nrf_libuarte_async_tx(&uart0, linestrlen(line));

        // nrf_cli_print(p_cli, "counter = %d\n", m_counter);
        NRF_LOG_RAW_INFO("~~ counter = %d\n"m_counter);

        m_counter++;
    }
}
When I use the cli to "counter start", I see the counter being updated via the uart interface, but unlike the non-softdevice cli program, I don't see the counter update in the cli display anymore. I've looked through the sdk_config.h, and things mostly match. There are very few small differences.
I've also added a number of my own commands to a cli_cmds.c file. I can enter a command and see data this way, but how do I get external code like the timer_handle() to get data to show on the usb cli?
Parents
  • On the code above, if I uncomment the nrf_cli_print() and comment out the other one, I do see data printing on the cli, but the output is not as nice as the original. As I type further commands, this adds to what's being output. The NRF_LOG_RAW_INFO() in the non s140 cli program just displays the output on it's own line, keeping the user prompt at the bottom.

Reply
  • On the code above, if I uncomment the nrf_cli_print() and comment out the other one, I do see data printing on the cli, but the output is not as nice as the original. As I type further commands, this adds to what's being output. The NRF_LOG_RAW_INFO() in the non s140 cli program just displays the output on it's own line, keeping the user prompt at the bottom.

Children
No Data
Related