Matlab R2015a error while communicating with Beaglebone

1 view (last 30 days)
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 Comment
emre yazici
emre yazici on 1 Dec 2016
Edited: emre yazici on 1 Dec 2016
You can try the code by using first in first out principle, because in my opinion the error is caused by exceeding buffer avaliablity.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!