Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Setting up a custom board for debugging (Robotis CM9) (Read 2156 times)
chiMT
Junior Member
**
Offline



Posts: 14
Setting up a custom board for debugging (Robotis CM9)
Oct 6th, 2018 at 4:44am
 
Hello,

We are developing firmware on a custom Arduino board. It is the CM9 from Robotis. Their documentation on their board can be found here:
http://emanual.robotis.com/docs/en/parts/controller/opencm904/

We are able to load their board through the Visual Micro extension in Visual studio and upload our firmware to the board successfully.

The next step is to try to use the Visual Micro debugger. When we try to run the debugger we get the expected error of the following:

---------------------------------------

Compiling debug version of 'InterbotixFW_0.1' for 'OpenCM9.04 Board'

InterbotixFW_0.1.ino: In function void setup()

InterbotixFW_0.1.ino:79: In file included from
   void begin(UARTClass *theSerial, unsigned long baud)
Error compiling project sources
   Debug Build Error: This hardware might not support the default Visual Micro Debugger.
     If this project is using OTA/WiFi upload then please use the vMicro>Debugger menu to set the Serial COM and Remote port for the debugger.
     Otherwise switch the toolbar from 'Debug' to 'Release' and build again.
           or switch off Automatic Debugging
           or configure the SoftwareSerial debugger option.
Debug build failed for project 'InterbotixFW_0.1'

-------------------------------------------

I believe that this is pointing us to the below tutorial, which is instructing us to configure the correct settings for pins to use the board. But this is where we are asking for help because this is a new area and we are not sure of the correct settings.

https://www.visualmicro.com/post/2012/05/06/Configure-debug-for-other-types-of-s...

This is our question: Are we able to set the proper pin and other settings in order to get the Visual Micro debugger to work with the custom board?

If yes, then can anyone help us with the correct settings from the documentation to make the debugger work with the custom board?

Thank you for any help!
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #1 - Oct 6th, 2018 at 1:38pm
 
Hi

What is the class name of Serial? If you press F12 on Serial what is it defined as?
Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #2 - Oct 7th, 2018 at 4:42am
 
I'm sorry, I'm not following what you mean by press F12 on serial? Can you explain what you mean by on serial?

Thank you.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #3 - Oct 7th, 2018 at 12:00pm
 
Type Serial into setup() or loop() then right click "Go To>Definition (F12)"
Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #4 - Oct 7th, 2018 at 10:39pm
 
Thanks for the explanation. Here are screenshots of the result. (The reply form has no feature to attach an image to my reply?)

https://imgur.com/a/6FEcivB

Back to top
 
 
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #5 - Oct 8th, 2018 at 8:44pm
 
We have tried the following settings and it still is giving the standard error.

Can we be advised what to try next? I posted the Serial answer in my last post.

Back to top
 
 
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #6 - Oct 10th, 2018 at 6:49am
 
bump. We are still very interested in help figuring this out. Cheers.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #7 - Oct 10th, 2018 at 2:02pm
 
It will be looked at over the next few days
Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #8 - Oct 11th, 2018 at 4:13am
 
Thank you for the response.

We have also posted our question at the Robotis github and they gave a response. They are saying that the OpenCM9.04 doesn't support the same debugging that VM uses. I wanted to post their response for your team to see. They might have helped provide the answer that your research would also provide. It seems that there are two different types of debugging environments.

https://github.com/ROBOTIS-GIT/OpenCM9.04/issues/44

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #9 - Oct 20th, 2018 at 5:08pm
 
Sorry for the delay. You can ignore the response in the OpenCM9 forum they will be thinking gdb or hardware debug.

If you add a board.txt to your project and add the following lines then click "save", things should work in debug mode.

Code (C++):
vm.debug.class_type=VM_DEBUGGER_TYPE_USARTSERIAL 



Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #10 - Oct 21st, 2018 at 1:23am
 
Hello,

Thank you for the reply. That is encouraging to hear that we can use VM with the board.

I did as advised and made the board.txt file with that line of code. When I tried to run in debug it failed again. Here is a link to the full build output:
https://drive.google.com/file/d/1KkFNB0cP3dpxYcDqYQXNSivBh_mBhdA4/view?usp=shari...


I also wanted to ask on a side note. After we successfully get the board working in debug mode. Will it be possible to debug while also sending packets to the same serial port from another program? Or use two different ports? (The Op0enCM9.04 has multiple serial ports) I've seen some of the VM documentation about this being possible from these two guides:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Sharing-Ports.htm...
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-With-Different-Po...

The end goal is to be able to debug in real time while the board is attached to our front end sending serial packets back and forth. That would be a dream dev setup.

If that is not possible, the next best thing is to run in debug mode and have some way of sending serial packets to the board through the debugger. So that we can fire functions and test etc.


Regards,

Matt
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #11 - Oct 21st, 2018 at 1:15pm
 
It builds okay for me in a simple project.

Please try a simple project without libs to start with and make sure the vMicro>Debugger menu is clear of entries.

These are better options for your board.txt. You can remove the previous settings:-

Code (C++):
vm.debug.class_type.Serial=VM_DEBUGGER_TYPE_USBSERIAL
vm.debug.class_type.Serial1=VM_DEBUGGER_TYPE_USARTSERIAL
vm.debug.class_type.Serial2=VM_DEBUGGER_TYPE_USARTSERIAL
vm.debug.class_type.Serial3=VM_DEBUGGER_TYPE_USARTSERIAL
 



The above settings enable Serial, Serial1, Serial2, Serial3 which can be selected from the vMicro>Debugger menu


tips:

The debugger can handle/ignore serial that is being outputted on the same port but only one windows device can use it at a time. You are better using an alternative port for debug or the softwareSerial option which requires 1 pin for trace and 1 pin for "break/pause/variable update". If you hav an

Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #12 - Oct 22nd, 2018 at 6:27am
 
Hello,

I did as advised. I changed the board.txt file with the new code. I took out the two library references and deleted all code that used those libraries. So it was just junk code left in there. I still got the error. I then deleted everything so there was just an empty setup and loop. Same error.

I then made new project through the VM menu, added the board.txt file with the new settings and it compiled and ran Smiley

I then added in the library references and all the code and it compiled and ran in debug mode. It is working Smiley I can set break points and read variables.

There must have been something in the original project that was causing a problem even with the correct board.txt file and settings. A fresh project fixed the issue. I don't recall, but I may have not created that project through the VM new arduino project menu.

As a note to anyone else finding this thread who is using the OpenCM9.04. You cannot just write the include file line for the DynamixelSDK library. You have to add it by using the "add library" in the VM toolbar and select it from the drop down. When you do it this way visual studio finds the library and the red underlines will go away.

Thank you for the help getting VM debugging working.

The next step will be figuring out how to properly set up the configuration so that I can run the debugger on a secondary serial port while allowing our front end to use the SerialUSB port to send data packets back and forth. I will try to get that working this week, but there is a good chance I'll need some assistance. Would you prefer that I post questions about that in this same thread to keep all information about using VM with the OpenCM9.04 board in one place or start a new topic?

Best Regards,

Matt
Back to top
 
 
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #13 - Oct 22nd, 2018 at 6:38am
 
Per your tip about using two serial ports for debugging, you wrote this line, but it appears cut off:

>>>You are better using an alternative port for debug or the softwareSerial option which requires 1 pin for trace and 1 pin for "break/pause/variable update". If you hav an

Would we need to be using a device like an external serial USB adapter as advised in this tutorial:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-With-Different-Po...

The part that we are trying to understand is using this method versus using the software serial where we set the TX/RX pins. If the board is connected through only the main SerialUSB it would seem that we cannot just tell VM different pins to use in software? Would that not need a hardware adapter?

We do use Serial.read() in our sketch which VM tutorials mention will conflict with the debugging.

The documentation on the OpenCM9.04 and it's serial pins is here:
http://emanual.robotis.com/docs/en/parts/controller/opencm904/#io-header

Some clarification to setting up the dual serial ports will help us set everything up in the proper way.

Thank You!

Matt
Back to top
« Last Edit: Oct 22nd, 2018 at 7:24am by chiMT »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #14 - Oct 22nd, 2018 at 11:17am
 
Yes a usb converter for the rx/tx of a real hardware serial port will be better. than software serial but the connection is usually the same. It depends on the board, some boards have a proper usb connector for toehr serial ports, some just rx,tx pins. Software serial is okay usually at speed = to or below 56k and takes more cpu power.

The cut off line simply says a hardware serial is best.

In the next release the debug properties for serial,serial1,serial2 etc have been set for the CM9 but your settings will still work.
Back to top
 
WWW  
IP Logged
 
chiMT
Junior Member
**
Offline



Posts: 14
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #15 - Oct 22nd, 2018 at 10:33pm
 
I wanted to post that we were successful in getting it working today with two ports. We used the recommended Arduino USB 2 Serial micro board and made a custom cable to connect to the TX/RX for Serial2 on the OpenCM9.04.

Here is what we did for anyone else finding this thread who is trying to use VM and the OpenCM9.04

Here is a photo of the set up:
https://imgur.com/a/ERyEfgk

This tutorial explains the setup:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-With-Different-Po...


In properties the remote port is "Serial2"
The Local port is what COM port the "USB 2 Serial micro board" shows up as in Windows.

Here is the TX/RX info for the OpenCM9.04:
http://emanual.robotis.com/docs/en/parts/controller/opencm904/#communication-por...

To make the cable we used the Robotis LN-101 cable. We cut off an end and soldered jumper wires to it.
(NOTE: you have to cross the RX/TX cables. RX on the "USB 2 Serial micro board" goes to TX on the OpenCM9.04 and visa versa)

Also of note to newbies: In the VM menu for what port to use for uploading this STAYS on the COM port for the regular SerialUSB. You upload on that port and when it is done the debugger runs on serial2. Then you can start your second program which communicated over SerialUSB.

Hopefully this helps anyone else finding this thread working on the same thing.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10526
United Kingdom
Re: Setting up a custom board for debugging (Robotis CM9)
Reply #16 - Oct 23rd, 2018 at 7:05pm
 
That's great thanks
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print