I have run up the CLI example to test as we will require some command line interaction and why reinvent the wheel?
I run up the example with USB enabled and UART disabled, I've changed the board type to include our I/O initialsation, otherwise the example is unmodified. This works as expected.
I modifed the counter output as we want to periodically report some values during production testing.
#define VERSION 101
volatile bool b1 = 0;
volatile bool b2 = 0;
volatile bool b3 = 1;
volatile uint16_t strain = 10;
static void timer_handle(void * p_context)
{
UNUSED_PARAMETER(p_context);
if (m_counter_active)
{
strain += 10;
NRF_LOG_RAW_INFO("S,%d,%d,%d,%d,%d,\r\n", VERSION,b1,b2,b3,strain);
}
}
This is the output
usb_cli:~$ counter start S,101,0,0,1,20, S,101,0,0,1,30, S,101,0,0,1,40, S,101,0,0,1,50, S,101,0,0,1,60, S,101,0,0,1,70, S,101,0,0,1,80, S,101,0,0,1,90, [00:00:38.000,061] <warning> app: Backends flushed [00:00:38.000,732] <warning> app: Backends flushed S,101,0,0,1,100, S,101,0,0,1,110, S,101,0,0,1,120, S,101,0,0,1,130, S,101,0,0,1,140, S,101,0,0,1,150, S,101,0,0,1,160, S,101,0,0,1,170, [00:00:46.000,061] <warning> app: Backends flushed [00:00:46.000,793] <warning> app: Backends flushed S,101,0,0,1,180, S,101,0,0,1,190, S,101,0,0,1,200, S,101,0,0,1,210, S,101,0,0,1,220, S,101,0,0,1,230, S,101,0,0,1,240, S,101,0,0,1,250, [00:00:54.000,061] <warning> app: Backends flushed [00:00:54.000,732] <warning> app: Backends flushed S,101,0,0,1,260, usb_cli:~$ counter stop
Digging around in the forum there are mentions of increasing NRF_LOG_BUFSIZE. This is set to 1024 in the example, the output is less than 150 bytes between warnings so I'm not sure why the warning is being generated.
Main loop is unchanged:
while (true)
{
UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
#if CLI_OVER_USB_CDC_ACM && APP_USBD_CONFIG_EVENT_QUEUE_ENABLE
while (app_usbd_event_queue_process())
{
/* Nothing to do */
}
#endif
cli_process();
}
Board is using the MDBT50Q-1MV2 module (nRF52840), connected via USB. Running SES 4.52c and SDK 17.0.0.