Namyts 1 Posted June 2, 2015 Share Posted June 2, 2015 Hi there, I'm trying to get Energia to run another program using command line. The idea is that it sends data based on readings the chip makes through microphones, and sends it to another program. (The other program is able to then analyse the data more easily) Ive written code in C which is able to run the other program from within Energia's project folder, but when I run exactly the same code by compiling and uploading to the chip (tiva c series tm4c1294), the code does absolutely nothing. ***********Main .INO*********** #include "EnergiaC.c" #include <stdio.h> #include <stdlib.h> #include <string.h> void setup() { Serial.begin(9600); } void loop() { run(); return; } ********ENERGIAC.c*********** #include <stdio.h> #include <stdlib.h> #include <string.h> int run() { char command[100]; strcpy(command, "cd..&CtoPython.exe triangulation main 5"); system(command); return 0; } When switching EnergiaC.c's run function to main and compiling with visual studio's compiler, this works perfectly, which means that the root of the problem probably lies with the location Energia puts its compiled code. Any ideas on where this is and how to navigate from it to the folder outside the project folder? Quote Link to post Share on other sites
enl 227 Posted June 2, 2015 Share Posted June 2, 2015 Well, since no one else bit yet,..... I think the root of the problem is conceptual. It works when run using vis studio because you are running it on the host. The host has a file system, Python interpreter, etc, and also has a full operating system with command shell needed for the system call. Once you upload to the tiva, there is not a full OS, filesystem, etc, no Python interpreter, and no command shell to handle the system call. If you are trying to shell on your host PC, then you need to have your code on the tiva communicate to the PC (via serial, USB, TCP/IP, wifi, other), which is another can of worms. One model for this is build a PC side application that listens to a serial port, and your tiva application sends data via the serial port to the PC. The PC application can then handle the data itself or repackage it for something else, maybe via a system call. Quote Link to post Share on other sites
Namyts 1 Posted June 3, 2015 Author Share Posted June 3, 2015 Thanks for responding, I spoke to a person in charge of my project and he confirmed everything that you just said. I understand now why what I wrote had no chance of working. Im now looking into one of those other cans (listening to the serial port and getting the chip to send data in). Hopefully after the data comes in, it can be redirected and analysed. Again, thanks for taking the time to respond. Quote Link to post Share on other sites
abecedarian 330 Posted June 5, 2015 Share Posted June 5, 2015 What might be possible is to create a custom USB device whose drivers connect to a service / daemon when the LaunchPad or other device is connected through the USB/OTG port. The service would then listen to the USB device, waiting for data. Think like how some phones have support software that starts when the phone is connected to the computer. Quote Link to post Share on other sites
Namyts 1 Posted June 5, 2015 Author Share Posted June 5, 2015 Hi abecegarian, thanks for the idea, but I've decided to go with using energia to tell the chip to output to the serial and then writing another program in processing to read that serial. Not being that experienced means that this is probably the best option for me. Thanks for taking the time to reply. abecedarian 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.