VS Code Download errors

Every once in awhile the when try to download to the robot I get an error message:
Download Failed: (3221225477) Unknown Error Code | vexcom.exe --name "TestCode" --slot 4 --write "c:\User\USER\FILELOCATION\build\TestCode.bin" --progress --json --chan 1 --progress --description VGMzdGluZw== COM5

It seems to fix if VS code is closed but it only works sometimes. Refreshing the terminal and window doesn’t help either. Unplugging the robot doesn’t work. Changing the USB port doesn’t work. Restarting the robot doesn’t help either.

Thank you for helping

@hphillips thoughts ?

1 Like

Hey @2131H_Prog ,

  • Does your error only occur when you try to download through a V5 Controller?
  • Does the download error occur when your computer is connected directly to the V5 Brain?
  • Do you have multiple instances of vscode opened?

The error code you got isn’t typical of vexcom so the process is probably crashing on launch for some reason. My best guess right now is that user port instance of vexcom isn’t terminating graceful before the extension attempts the user program download for some reason. I’ll do some testing and get back to you.

If you have not done so already, can you duplicate the issue on your computer, and then submit an issue through VEX Feedback. This will give me some additional information that I can use to troubleshoot your issue.

3 Likes
  1. Yes, I was downloading to a controller
  2. I do not have access to a brain today but I will try downloading to the brain tomorrow.
  3. I do not believe I have multiple Vscode windows open.
  4. If downloading to the brain doesn’t work I can send a diagnostic.

Thanks for your answer

I’ve had similar issues in the past uploading from vexcom. Typically after repeated uploads, the process will crash with either an Unknown Error Code or VEX Alive Error. Usually either restarting VSCode, or replugging the V5 controller will fix it.

I also don’t have any further details at the moment. Next time it happens i’ll grab a screenshot.

1 Like

Yeah these might all be symptoms of the same problem.
But yeah, if you can duplicate the issue, and then submit an issue using VEX Feedback, that will give me a better idea of what might be going.

1 Like

Had to leave the lab early today so I couldnt get time to try and duplicate the error. I’ll let you know when I can.

Well the error is gone on my computer. I can download through the brain and the Controller. I didn’t change anything although I restarted my computer.

It turns out after running some code and debuging that the robot will get the file but no code will run when the VScode program is installed. If I open the same code in V5pros (text) it’ll work as intended.

Do you want the program to run after you download it?
Can you manually start your program by clicking the play button?

There is a user setting you can enable that will allow your program to run after it has been download.
Screenshot 2023-08-29 203855

You can find this by:

  1. Clicking the gear in the bottom left hand corner of vscode:
    Screenshot 2023-08-29 204124
  2. Select “Settings” on the context menu that appears.
    Screenshot 2023-08-29 204243
  3. A settings page will appear. Search for “Run after download” and make sure this setting is enable.
3 Likes

No. It won’t run my main. It’ll download the file, like the name will change but nothing moves, no motors no console output, etc. Using v5 pros and downloading (I converted original projext to VScode so it still has a .V5code file) and it runs. It allows motors and devices to spin and console logging works. I think that it would mean the main isnt running or only the project settings is downloading etc.

How did you convert your project?

  • Did you use the import button in the VEX Extension?
  • Did you manually create the project files yourself?

If you create a new blank template V5 C++ project in vscode, does it download through the v5 controller and run correctly?

2 Likes

Maybe you should test printing out something to the brain screen in Main and see if that works, as Main should be running in Vexcode. It also could be an error in the code, as maybe in the main the code is not running anything.

I imported the project. As far as downloading it has no issues. It builds and downloads just fine. However, the file type is makefile (doesn’t seem right).

As far as making a new one I won’t be able to do any testing right now. Although I doubt thats the problem because it can download to the brain on both. It changes to the name of how its compiled. (If through Vs it uses project settings and if through V5 it does v5code file) both can be run however the Vscode project type is makefile and a I believe that the V5 one was a C++ project (not sure but I do remember seeing makefile and going that makes no sense)

I used

// ---- START VEXCODE CONFIGURED DEVICES ----
// ---- END VEXCODE CONFIGURED DEVICES ----

#include "vex.h"
#include "systems/drive.hpp"
#include "systems/intake.hpp"
#include "systems/cata.hpp"
#include <iostream>

vex::competition Competition;

void driverCallback() {

  drive::setExecState(drive::ExecStates::VOLTAGE);
  cata::setExecState(cata::ExecStates::VOLTAGE);

  while (true) 
  {
    drive::conDriver();
    drive::conTogInvert();

    intake::conDriver();
    cata::conDriver();

    vex::wait(10, vex::msec);
  }
}

int main() { 
  std::cout << "MAIN" << std::endl; // Nothing happened here
  Competition.drivercontrol(driverCallback); // Robot doesn't drive
  printf("HELLO"); // Didn't work here either 

  // All of these work when ran through Vex Code V5 pros

  while(1)
  { 
    vex::this_thread::sleep_for(20);
  }

}

After the line

vex::competition Competition;

You should add

vex::brain Brain;

Then instead of

printf("HELLO"); // Didn't work here either 

try

Brain.screen.clearScreen();
Brain.screen.print("test");

I don’t know if this will work, but you can use this to see if Main is running. If this doesn’t work, try creating a new competition template and copy all your code into there, it should work.

Are you referring to the output file in the build folder or fact that a makefile exist within the project workspace?

Both projects, VEX Extension and VEXcode Pro V5, use make to compile. The make files are not exposed in VEXcode Pro V5. Maybe there is an issue with how the make process environment is being setup in the extension but its tough to say without seeing the extension logs.

  • What OS are you running?

If you can submit an issue using the VEX Feedback panel, and reference this thread, then I can take a look at the extension logs.

Or maybe there is issue that’s occurring during the project import process, but again its tough to say without seeing the logs.

No worries and no rush. I wanted see if your issue is specific to your imported project or if its broader(all projects). By using the template project, I can determine if the extension can build, download, and print to console correctly using a simpler test case.

1 Like

I can’t do anything right now because I don’t have the brain but, I doubt that would be the issue as the

Didn’t run the driver callback function. (My robot works as the code says it should on V5 code so it can’t be a include error). I’m assuming the fact that it’s showing up as a makefile project probably means its not downloading a project but just one file (makefile), that can be executed but, doesn’t run any code although I don’t know what the problem is exactly and I wouldn’t know how to fix it seeing as I don’t know makefile.

Thanks for helping though

Just to clear up an confusion I’ll get pictures tomorrow. As far as errors I’m no longer getting any on the computer side. The download works and my code builds. A new (other than the original error code) issue has arrived where the computer or the brain may be downloading incorectly. Hopefully some pictures and screenshots can help.

On the Vex V5 brain when you download it will say project type: [Some project type here (generally C++)]. It is currently saying makefile. Now from my understanding make files can be run as they are used in the build process to give terminal outputs and help with compile path (Agian Idk make file). This would make sense that the brain doesn’t write a error like the memory permission error or not run at all because it can be executed. I can get pictures tomorrow morning when I go into our lab.

I am using windows 11 on a MSI laptop.

I’ll send my issue report tomorrow.

Thats a good idea and I can test that tomorrow as well.

Thanks our lab is only open as long as we have supervision. Also I may not get messages inside the school so trying to figure out what to do before is important.

Thanks,

2131H Programming Dept.

Here are the pictures.