Matlab R2015a error while communicating with Beaglebone

조회 수: 1 (최근 30일)
Ahmet Onur Giray
Ahmet Onur Giray 2016년 12월 1일
편집: emre yazici 2016년 12월 1일
Hello,
I am using Matlab R2015a with BeagleBone Black support package. I have a Beaglebone Black Rev C. I am using the following code to read data from its ADC pins. Pins are connected to a simple voltage divider circuit with a flex sensor. I am also using addpoints function to draw real time graph so that I can get the characteristic of the flex sensor for my project. I am using the following code for such purpose. (Note that mouse cursor control functions are irrelevant since they are for the project.)
import java.awt.Robot;
mouse = Robot;
screenSize = get(0, 'screensize');
h=animatedline;
t=1:3000;
hold on;
voltage=zeros(1,3001);
for j=1:3000
voltage(j)=double(readVoltage(bbb,'P9_39'));
addpoints(h,t(j),voltage(j))
drawnow
if voltage<=0.89
mouse.mouseMove(0, 0);
for i = 1: screenSize(4)
k=i*1.78;
mouse.mouseMove(k, i);
pause(0.00001)
end
break
end
end
When I run the code I can get some samples until some point. Sometimes after 500 and sometimes after 1000 samples I get the following error;
Error using beaglebone/recvResponse (line 1315)
An error has occurred while communicating with the server running on BeagleBone hardware.
Error in beaglebone/readVoltage (line 635)
result = typecast(uint8(obj.recvResponse()), 'Single');
Error in Untitled (line 9)
voltage(j)=double(readVoltage(bbb,'P9_39'));
Then I loose connection to the Beaglebone Black hardware, this code and the other working codes with Beaglebone stop working. I cannot re-connect by using bbb=beaglebone until I reboot my hardware. I hope someone has an answer for me.
Thanks in advance.
  댓글 수: 1
emre yazici
emre yazici 2016년 12월 1일
편집: emre yazici 2016년 12월 1일
You can try the code by using first in first out principle, because in my opinion the error is caused by exceeding buffer avaliablity.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by