uartzephyr-rtos

In zephyr-rtos, how to run the `echo_bot` example?


In zephyr-rtos, how to run the echo_bot example?

I'am new to both embedded/rtos dev and zephyr, and, not so used to electronics topics (UART). Following the official zephyr doc, I managed to install zephyr/west and build/flash/run the blinky example that works from-debian-on-the-board.

Now, I would like to run the echo_bot example that illustrates UART communication. I managed to build/flash the example on my board... But impossible to run it?!.. How to run it?

The board is connected to my PC using a USB adapter, so that, using setserial seems to tell me that the board is associated to /dev/ttyACM0.

My rough understanding (looking at the code) is that after flashing, the flashed-on-board code should wait for messages coming from PC using UART and send it back to the sender (on PC) using UART.

So, after flashing, in one terminal dedicated to receive messages from the board, I run and get:

>> cu -l /dev/ttyACM0 -s 9600
Connected.
O�oc���

And in another terminal dedicated to send messages to the board, I run:

>> echo "what's up doc?" > /dev/ttyACM0

My understanding is that in the cu terminal I should see what's up doc? which is not the case?!.... There, I get jammed symbols. How to run the example? The zephyr doc is not detailed about this step as it likely speak to embedded programmers: as I am new to all this, I'am not sure how I am supposed to run this example.

Can somebody explain how to run the example?... And maybe point me out better tools (than cu?) to use. Did I misunderstood the example?

Any help/clue is appreciated.


Solution

  • I would recommend starting with the hello_world sample instead just to make sure the serial connection between your board and PC works fine before the echo example (which should work fine after).

    One thing to be aware of with serial communication is the baudrate, which in your command above, have set to 9600 (-s for cu); most Zephyr boards typically use a baudrate of 115200. You will need to check the devicetree for your board to know what the setting is.

    There are a number different commands for serial communication; for Linux, a basic one is screen which can be run like so for your setup (probably) screen /dev/ttyACM0 115200 where the last number is the baudrate; this will provide you an interactive terminal for reading and writing to the port. I'm not familiar enough with cu to know if it would work.