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