USB cdc_acm questions

Hello 

I have some questions about USB CDC ACM support under Zephyr

I need the shell on one CDC ACM device and to print print large chunks of data  to the console ( > 1024 bytes ) to another one

I am using cdc_acm_composite sample found in zephyr/samples

Questions

1, I was able to set up the shell to use the first cdc_acm device - that works fine. However the RTT log messages are also printed to the shell console -how do I get rid of them?

Obviously I need logging - but I just don't need to see the log messages in the shell, only in the RTT viewer. 
Here is my proj.conf file

CONFIG_LOG=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_ASYNC_API=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM Composite sample"
CONFIG_USB_DEVICE_VID=0XABCD
CONFIG_USB_DEVICE_PID=0x0002
CONFIG_USB_COMPOSITE_DEVICE=y
CONFIG_SERIAL=y
# Redirect console to CDC
CONFIG_USB_SELF_POWERED=n
CONFIG_USB_WORKQUEUE=y
CONFIG_USB_WORKQUEUE_STACK_SIZE=1024
CONFIG_USB_WORKQUEUE_PRIORITY=-1
CONFIG_USB_CDC_ACM=y
CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024
CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=1024
CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51
#Shell through COM port
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_SHELL_BACKENDS=y
What do I need to do to disable printing log messages to the cdc_acm device but still have them printed in the RTT log?
2. My main problem is with the second cdc_acm device where I need to print large chunks of data from my application
-If I use uart_poll_out - the newline characters are ignored in the console and everything appears on one line - tried CR, LF, CRLF
-If I use uart_fifo_fill -the new text is printed on the new line but not at the beginning of it - a number empty spaces printed before it
Also, the comment in the uart_fifo_fill declaration states
"This function is expected to be called from UART interrupt handler (ISR), if uart_irq_tx_ready() returns true.
 Result of calling this function not from an ISR is undefined (hardware-dependent)"
 Is it OK to call uart_fifo_fill from the application context on nRF52840?
If not - what's the right solution here?
Thank you
 
Parents Reply
  • That did not help. I still see RTT log messages in the shell  console

    Could you please provide answers to the other questions - about using uart_fifo_fill() and each new line printed at an offset like so


    text 
          text

               text

    Update

    Did more testing

    Apparently "\n" character at the end of the string causes the above behavior

    "\r" character causes the current line to be overwritten so only the last line is printed. The cursor stays in the leftmost position

    "\r\n" prints the lines correctly. 

    I'm on Windows using putty

    Thank you

Children
Related