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

Visual Studio Serial Monitor issues with Nordic NCS examples

Hello,

I am using NCS v1.3.0 examples and also my custom made C++ code with Visual Studio Code V1.48.2 (Since the latest version of VS Code V1.5 is having official issues to open serial port).

I have the following questions:

1) Is there a way to run serial monitor other than using arduino serial monitor in vs code ? Right now if I am opening a serial monitor but there are 3 issues

   a) I cannot open more than 1 serial terminal monitor in VS Code

   b) I am getting garbage values also when I try to run the code in serial terminal. I am setting the baud rate as 115200. As you can see in the picture, before "uart" there is some garbage.

   c) I cannot write directly onto the serial terminal since it is a read only one. So I have to use this option , Arduino: Send text to serial port and send my command to serial port.

   d) If you are able to run the serial port terminal in higher versions than V1.48.2 then also let me know

2) Let's consider this case. I am inside the project directory and try to build that project with SES and as a result build_nrf52840dk_nrf52840 directory is created (since I am using nrf52840). Once the build is done through SES, I go into VS Code and try to flash my code using "west flash" by going inside the build_nrf52840dk_nrf52840 directory. But when I use west flash inside this directory. it again starts to build the project even if it is already build by SES. Does "west" command not use the same build files to flash into the board which are inside the same folder created by SES?

Parents
  • Hi,

     

    1) Is there a way to run serial monitor other than using arduino serial monitor in vs code ?

     I don't know. We have no official support for VS Code, so I have not tried. Is there a reason you can not use a stand-alone serial terminal such as Termite, Realterm or Putty?

     

       b) I am getting garbage values also when I try to run the code in serial terminal. I am setting the baud rate as 115200. As you can see in the picture, before "uart" there is some garbage.

     Those values are not garbage, but escape codes to set the color of the text in the terminal. However, if the terminal you use does not support that feature, the escape codes will be printed as "normal" text, looking like garbage. In log messages, you can disable colors by setting CONFIG_LOG_BACKEND_SHOW_COLOR=n in your prj.conf. But in your case, I believe you have to use CONFIG_SHELL_VT100_COLORS=n instead.

     

       c) I cannot write directly onto the serial terminal since it is a read only one. So I have to use this option , Arduino: Send text to serial port and send my command to serial port.

       d) If you are able to run the serial port terminal in higher versions than V1.48.2 then also let me know

     I have not used any serial port terminals in VS Code, so I can not help you here, sorry.

     

    2) Let's consider this case. I am inside the project directory and try to build that project with SES and as a result build_nrf52840dk_nrf52840 directory is created (since I am using nrf52840). Once the build is done through SES, I go into VS Code and try to flash my code using "west flash" by going inside the build_nrf52840dk_nrf52840 directory. But when I use west flash inside this directory. it again starts to build the project even if it is already build by SES. Does "west" command not use the same build files to flash into the board which are inside the same folder created by SES?

     Is there a reason you are not flashing from SES? Or building from the command line?

    You can flash your device from SES by using 'Target -> Download zephyr/zephyr.elf' (for single-image applications) or 'Target -> Download zephyr/merged.hex' (for multi-image applications):

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/gs_programming.html#building-with-ses

    If you still want to use west to flash, you can also build you project with 'west build -b <your board>' from your project folder (not the build folder). West will then create/use 'build' as build folder, but you can override that with '-d <your build folder>'. Similarly, 'west flash' will use 'build' as build folder unless another one is specified with the '-d' flag. Note that you can also use Ninja directly from the build folder with 'ninja flash'.

    Best regards,

    Didrik

Reply
  • Hi,

     

    1) Is there a way to run serial monitor other than using arduino serial monitor in vs code ?

     I don't know. We have no official support for VS Code, so I have not tried. Is there a reason you can not use a stand-alone serial terminal such as Termite, Realterm or Putty?

     

       b) I am getting garbage values also when I try to run the code in serial terminal. I am setting the baud rate as 115200. As you can see in the picture, before "uart" there is some garbage.

     Those values are not garbage, but escape codes to set the color of the text in the terminal. However, if the terminal you use does not support that feature, the escape codes will be printed as "normal" text, looking like garbage. In log messages, you can disable colors by setting CONFIG_LOG_BACKEND_SHOW_COLOR=n in your prj.conf. But in your case, I believe you have to use CONFIG_SHELL_VT100_COLORS=n instead.

     

       c) I cannot write directly onto the serial terminal since it is a read only one. So I have to use this option , Arduino: Send text to serial port and send my command to serial port.

       d) If you are able to run the serial port terminal in higher versions than V1.48.2 then also let me know

     I have not used any serial port terminals in VS Code, so I can not help you here, sorry.

     

    2) Let's consider this case. I am inside the project directory and try to build that project with SES and as a result build_nrf52840dk_nrf52840 directory is created (since I am using nrf52840). Once the build is done through SES, I go into VS Code and try to flash my code using "west flash" by going inside the build_nrf52840dk_nrf52840 directory. But when I use west flash inside this directory. it again starts to build the project even if it is already build by SES. Does "west" command not use the same build files to flash into the board which are inside the same folder created by SES?

     Is there a reason you are not flashing from SES? Or building from the command line?

    You can flash your device from SES by using 'Target -> Download zephyr/zephyr.elf' (for single-image applications) or 'Target -> Download zephyr/merged.hex' (for multi-image applications):

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/gs_programming.html#building-with-ses

    If you still want to use west to flash, you can also build you project with 'west build -b <your board>' from your project folder (not the build folder). West will then create/use 'build' as build folder, but you can override that with '-d <your build folder>'. Similarly, 'west flash' will use 'build' as build folder unless another one is specified with the '-d' flag. Note that you can also use Ninja directly from the build folder with 'ninja flash'.

    Best regards,

    Didrik

Children
No Data
Related