error solution when interfacing beaglebone black with matlab2014b
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have one error when executing the simulink model which shown in the image and the error is given below:
C:/MATLAB/SUPPOR~1/R2014b/LINARO~1.8/bin/arm-linux-gnueabihf-gcc -c -O0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot="C:\MATLAB\SupportPackages\R2014b\libc" -DMODEL=pwmgeneration -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DARM_PROJECT -DRT -DSTACK_SIZE=64 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DARM_PROJECT -DRT -DSTACK_SIZE=64 -DMODEL=pwmgeneration -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/MATLAB/SupportPackages/R2014b/armcortexa/toolbox/target/supportpackages/arm_cortex_a/blocks/sfcn/include -IE:/Dissertation/matlab program/pwmgeneration_ert_rtw -IE:/Dissertation/matlab program -IC:/PROGRA~1/MATLAB/R2014b/extern/include -IC:/PROGRA~1/MATLAB/R2014b/simulink/include -IC:/PROGRA~1/MATLAB/R2014b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2014b/rtw/c/ert -IC:/MATLAB/SupportPackages/R2014b/armcortexa/toolbox/target/supportpackages/arm_cortex_a/blocks/sfcn/src -IC:/MATLAB/SupportPackages/R2014b/beaglebone/toolbox/target/supportpackages/beaglebone/@slCustomizer/../include -IC:/MATLAB/SupportPackages/R2014b/armcortexa/toolbox/target/supportpackages/arm_cortex_a/include -IC:/PROGRA~1/MATLAB/R2014b/toolbox/target/codertarget/rtos/inc -o "linuxinitialize.c.o" "C:/PROGRA~1/MATLAB/R2014b/toolbox/target/codertarget/rtos/src/linuxinitialize.c" arm-linux-gnueabihf-gcc: error: program/pwmgeneration_ert_rtw: No such file or directory arm-linux-gnueabihf-gcc: error: program: No such file or directory gmake: * [linuxinitialize.c.o] Error 1
please help me to remove this error
0 comentarios
Respuestas (1)
Jorge
el 3 de Jun. de 2015
Here are the steps for controlling the BeagleBone Black card from Matlab using a very simple program.
Hardware/Software used:
Windows Platforms: XP and 7 Hardware: BeagleBone Black BBB Operating System: Debian GNU/Linux 7 BeagleBone image: BeagleBone Debian Image 2014-04-23 Matlab version: R2009b g++ compliler. The Linux distributions come with a built-in c-compiler (gcc) and c++ compiler (g++). Example program: myprog from http://inspire.logicsupply.com/2014/07/beaglebone-c-programming-example.html Instructions
First, let’s create a file 'myprog.cpp' in BBB’s root directory using the nano editor (or vim, or emacs - if you prefer) Then, we will connect to the BeagleBone from Matlab and log in as 'root'.
STEP 1- Source Code Example program from elinux.org:
#include <iostream>
#include <stdio.h>
#include <unistd.h>
using namespace std;
int main(){
cout << "LED Flash Start" << endl;
FILE *LEDHandle = NULL;
const char *LEDBrightness="/sys/class/leds/beaglebone:green:usr0/brightness";
for(int i=0; i<3; i++){
if((LEDHandle = fopen(LEDBrightness, "r+")) != NULL){
fwrite("1", sizeof(char), 1, LEDHandle);
fclose(LEDHandle);
}
usleep(1000000);
if((LEDHandle = fopen(LEDBrightness, "r+")) != NULL){ fwrite("0", sizeof(char), 1, LEDHandle); fclose(LEDHandle); } usleep(1000000); } cout << "LED Flash End" << endl; }
Program Overview
In this simple example program, we flash the built-in LED USR0 three times. We start out by sending a message to 'cout' (console output) to let us know that the program has started. Finally, a simple message is sent to indicate that we are done is sent to the console.
Step 2 - Compiling: g++ myprog.cpp -o myprog
This command calls the C++ compiler with the source file myprog.cpp and outputs (-o) the file myprog.
STEP 3- Running the Program within the BeagleBone: ./myprog
The program will flash the built-in USR0 LED three times, and display a message at the start and the end:
root@beaglebone:~# ./myprog LED Flash Start LED Flash End
STEP 4- Running the Program Manually from Matlab
Running the program manually in Matlab using basic serial port commands. Create a serial port object for serial port COM5 (check Windows Device Manager to find out the serial port used by the BeagleBone): s=serial('COM5');
Configure the Baudrate to 115,200: set(s,'BaudRate',115200);
Connect the serial port object to the BeagleBone:
fopen(s);
Write data to the BeagleBone. Here we log in as root: fprintf(s,'root')
Write data to the BeagleBone. This time execute the program myprog: fprintf(s,'./myprog')
Disconnect and clean up — When you no longer need the serial port object, disconnect it from the device using the fclose function: fclose(s)
Remove the serial port object from memory using the delete function: delete(s)
Remove the serial port object from the MATLAB workspace using the clear command: clear s;
If you encounter any of the messages listed below in Matlab just simply run the following command: delete(instrfind({'Port'},{'COM5'}))
then disconnect the USB cable from the BeagleBone momentarily and then connect it again before continuing.
??? Error using ==> serial.fopen at 72 Port: COM5 is not available. No ports are available. Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Error in ==> LED_tester>LED_tester_OpeningFcn at 77 fopen(s);
Error in ==> gui_mainfcn at 221 feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in ==> LED_tester at 42 gui_mainfcn(gui_State, varargin{:});
This simple example program should help you get started with Matlab controlling the BeagleBone Black where you can go from here.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!