Bridge Not Working on Linino One

1,914 views
Skip to first unread message

hagope

unread,
Aug 30, 2014, 12:03:50 PM8/30/14
to lin...@googlegroups.com
Hello! I am having problems getting the Linino One Bridge working, is anyone else facing this issue?

Mimmo

unread,
Aug 31, 2014, 5:59:19 PM8/31/14
to lin...@googlegroups.com
On 08/30/2014 06:03 PM, hagope wrote:
Hello! I am having problems getting the Linino One Bridge working, is anyone else facing this issue?
--
You received this message because you are subscribed to the Google Groups "Linino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linino+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi, which kind of issue do you have?
Which sketch are you using?

Thanks
regards
Mimmo

hagope

unread,
Aug 31, 2014, 9:19:11 PM8/31/14
to lin...@googlegroups.com
Seems as though 1.) bridge.py is not running or runs and gets killed and 2.) Bridge.begin() is not running correctly.

root@linino:~# uname -a
Linux linino 3.3.8 #1 Sat Aug 30 10:23:06 CEST 2014 mips GNU/Linux

root@linino:~# ps | grep bridge
 7176 root      1492 S    grep bridge

I've tried manually kicking of the bridge.py script with this Yun script:
/usr/bin/run-bridge

Once that is up and running. I loaded the following sketch onto the Linino One to test that Bridge is working correctly, however, the sketch doesn't seem to get past the "Bridge.begin()" 

#include "Bridge.h"
#define ledPin 13

void setup() {
 
// put your setup code here, to run once:
  pinMode
(ledPin, OUTPUT);
  digitalWrite
(ledPin,HIGH);
  delay
(1000);
  digitalWrite
(ledPin,LOW);
  delay
(1000);
 
Bridge.begin();
 
// LED never blinks a second time
  digitalWrite
(ledPin,HIGH);
  delay
(1000);
  digitalWrite
(ledPin,LOW);
}


void loop() {
 
// put your main code here, to run repeatedly:
 
Process p;
 
String command = "cat /root/led.txt";
 
String pString;
  p
.runShellCommand(command);
 
while (p.available()) pString = p.readString();
 
if(pString == "1") {
    digitalWrite
(ledPin,HIGH);
 
} else {
    digitalWrite
(ledPin,LOW);
 
}
  delay
(2000);
}

hagope

unread,
Sep 1, 2014, 11:42:50 AM9/1/14
to lin...@googlegroups.com
Here's the output of "uname -a" 
Linux linino 3.3.8 #1 Sat Aug 30 10:23:06 CEST 2014 mips GNU/Linux

And "ps | grep bridge"
2043 root      1492 S    grep bridge

I believe there are to issues going on here:
  1. bridge.py script is not starting or getting killed somewhere in the boot process
  2. After manually kicking off bridge.py Arduino's Bridge.begin() command gets stuck
I manually run the command /usr/bin/run-bridge to get Bridge.py started.

Here's a sketch I wrote to test that Bridge is working. However, I don't believe this executed beyond the Setup() or even beyond the Bridge.begin() line (never see the 2nd blink of LED on pin 13):

#include "Bridge.h"
#define ledPin 13

void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin,HIGH);
  delay(1000);
  digitalWrite(ledPin,LOW);
  delay(1000);
  Bridge.begin();
  // This never gets called
  digitalWrite(ledPin,HIGH);
  delay(1000);
  digitalWrite(ledPin,LOW);
  
}

void loop() {
  // put your main code here, to run repeatedly:
  Process p;
  String command = "cat /root/led.txt";
  String pString;
  p.runShellCommand(command);
  while (p.available()) pString = p.readString();
  if(pString == "1") {
    digitalWrite(ledPin,HIGH);
  } else {
    digitalWrite(ledPin,LOW);
  }
  delay(2000);
}

On Sunday, August 31, 2014 2:59:19 PM UTC-7, Mimmo wrote:

Mimmo

unread,
Sep 1, 2014, 5:44:06 PM9/1/14
to lin...@googlegroups.com
Hi,
bridge.py is started from the mcu when the Bridge.begin() command is executed.
If you look at the details of the library code you see that the mcu wait to don't receive any characters from the linux side and then execute the command run-bridge to have the python daemon on linux side.
On linino distribtion we have 2 packages installed as default that can cause some issue on the startup of the bridge, so please remove it with the commands:

opkg remove python-firmata
opkg remove pyserial

I also would suggest to upgrade your board with the latest version of linino (http://download.linino.org/linino_distro/master/latest/openwrt-ar71xx-generic-linino-yun-16M-squashfs-sysupgrade.bin), because we fixed an issue on uhttpd with alias address, that are also used by Bridge.

If after the reboot the bridge process is not present try to reset only the mcu with the reset button near the ethernet port. After few seconds you should see the bridge.py process on the linux side. If so, it means that you need probably to add some more delay before the invocation of Bridge.begin() or increase inside the library bridge.cpp the delay before running the command run-bridge, because when it was executed is running some other process like dhcp client to obtain ip address and te command to strat the bridge was not executed.

Hope I was clear, please let me know the reult of your tests.

thanks, regards
Mimmo

hagope

unread,
Sep 2, 2014, 1:34:34 AM9/2/14
to lin...@googlegroups.com
Thanks for that detailed response.

Unfortunately, I'm still not able to use Bridge, here's what I've tried:
  • removing python-firmata and pyserial
  • upgrading to the latest version of linino
  • doubling all the delays in Bridge.cpp source file
  • manually kicking off bridge.py and commenting out Bridge.begin()
I noticed that I am able to run "reset-mcu" from ssh and it works. However, I still cannot run linux commands from the sketch.

Mimmo

unread,
Sep 2, 2014, 5:56:15 PM9/2/14
to lin...@googlegroups.com
Hi,
I am using two yun with Arduino openwrt distribution and Linino on the other. I have seen also on Arduino distribution sometimes the bridge did not start properly.
Right now I have both the boards with the bridge running properly. I tried to reset the board and it started again.
I am trying to figure out what could be the trigger, but I really don't know exactly how the bridge works.
Just one though, are you using the yun connected to wifi, or ethernet during your test?

Mimmo

unread,
Sep 2, 2014, 6:23:18 PM9/2/14
to lin...@googlegroups.com
Just a question. Could you check the baudrate settings on the kernel?

root@linino:~# cat /proc/cmdline
 board=linino-one console=ttyATH0,115200 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd

if you have the console baudrate setting to 115200 you need to change in Bridge.h the default baudrate

class SerialBridgeClass : public BridgeClass {
  public:
    SerialBridgeClass(HardwareSerial &_serial)
      : BridgeClass(_serial), serial(_serial) {
      // Empty
    }

    void begin(unsigned long baudrate = 115200) {
      serial.begin(baudrate);
      BridgeClass::begin();
    }

This is because there are 2 different baudrate settings: 115200 and 250k but the default on Bridge library is 250k.

Of course the baudrate must be coherent.

hagope

unread,
Sep 2, 2014, 6:51:05 PM9/2/14
to lin...@googlegroups.com
Just to be clear, I was able to use Bridge with Arduino Yun and having difficulty with Linino One

Changing baudrate to 115200 fixed the issue on Linino One! Thank you!

I also ran cat /proc/cmdline on the Yun and found that baudrate was 250000

Chen Edward

unread,
May 30, 2015, 4:37:35 AM5/30/15
to lin...@googlegroups.com
Hi,

I updated Bridge.h as command (change baud rate to 115200) , it still cannot work.
In addition, I cannot find baud rate from "/proc/cmdline" 
Can you help?

===========================================
root@linino:~# cat /proc/cmdline

 console=spicons board=linino-one mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd rootfstype=squashfs,jffs2 noinitrd


hagope於 2014年8月31日星期日 UTC+8上午12時03分50秒寫道:

mimmo

unread,
May 31, 2015, 4:34:22 PM5/31/15
to lin...@googlegroups.com
Hi Chen,
which version of linino are you running?
Can you run cat /etc/linino_version or lininoio -v ?

Since console is set to spicons I think you are using lininoIO that is not compatible with Bridge.

Let me know.
m

Chen Edward

unread,
Jun 4, 2015, 6:00:27 AM6/4/15
to lin...@googlegroups.com
Thanks for your response, here is my Linino's version:

root@linino:~# cat /etc/linino_version
DISTRIB_ID="Linino"
DISTRIB_RELEASE="lininoIO"
DISTRIB_REVISION="7596b00"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
BUILD_DATE="2015-02-03"
root@linino:~#

Sincerely,
Edward Chen


mimmo於 2015年6月1日星期一 UTC+8上午4時34分22秒寫道:

Mimmo

unread,
Jun 4, 2015, 6:06:43 AM6/4/15
to lin...@googlegroups.com, edwar...@welldone-info.com.tw

Hi,
try to upgrade to the latest version of lininoIO using the command 

linup LATEST

after the uprgade you'll be able to connect through ssh and disable lininoio using the command

lininoio -f stop

After that you can load your sketch using Arduino IDE and having the Bridge working.

Regards,
mimmo

Chen Edward

unread,
Jun 4, 2015, 8:58:12 AM6/4/15
to lin...@googlegroups.com, edwar...@welldone-info.com.tw

Thank you, sir.

I upgraded latest version of lininoIO using "linup latest", and then run "lininoio -f stop"
It seems upgrade:
root@linino:~# cat /etc/linino_version
DISTRIB_ID="Linino"
DISTRIB_RELEASE="lininoIO"
DISTRIB_REVISION="28f934f"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
BUILD_DATE="2015-06-02"
root@linino:~#

However, the Bridge still can not work :(

Here is my test code, after upload completed, the console always show  "Starting Bridge..." instead of "Starting Bridge... done.".
========================================== 
#include <Bridge.h>

void setup() {
  delay(6000);
  Serial.begin(19200);
  while(!Serial) ;
  Serial.print("Starting Bridge...");
  Bridge.begin(); // init Bridge
  Serial.println("done."); // completed message
  ...
===========================================

Sincerely,
Edward Chen


Mimmo於 2015年6月4日星期四 UTC+8下午6時06分43秒寫道:

Andrea Cannistrà

unread,
Jun 4, 2015, 1:13:49 PM6/4/15
to lin...@googlegroups.com
Hi,

Can you post the output of the following commands please?

1) stty -F /dev/ttyATH0
2) fw_printenv

--
Andrea Cannistrà.
--
You received this message because you are subscribed to the Google Groups "Linino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linino+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




Questa e-mail è stata controllata per individuare virus con Avast antivirus.
www.avast.com


Chen Edward

unread,
Jun 5, 2015, 3:12:55 AM6/5/15
to lin...@googlegroups.com
Hi, 
Here is the message. So, should I change the baud rate to 230400 in Bridge.h ?
Thanks in advance.

root@linino:~# stty -F /dev/ttyATH0
speed 230400 baud; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-brkint ixoff -imaxbel
root@linino:~# fw_printenv
bootcmd=bootm 0x9fea0000
bootdelay=4
ethaddr=0xb4:0x21:0x8a:0x00:0x00:0x10
ethact=eth0
ipaddr=192.168.1.1
serverip=192.168.1.100
baudrate=250000
stdin=serial
stdout=serial
stderr=serial
bootargs=console=ttyATH0,250000 board=linino-one mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd
root@linino:~# 



andrea.cannistra於 2015年6月5日星期五 UTC+8上午1時13分49秒寫道:

Andrea Cannistrà

unread,
Jun 5, 2015, 5:21:58 AM6/5/15
to lin...@googlegroups.com
Hi,

can you post the output of this command please?

- cat /etc/inittab

is not necessary to change baudrate to 230400.

Chen Edward

unread,
Jun 5, 2015, 11:00:08 AM6/5/15
to lin...@googlegroups.com
Hi all, 

The baud rate definition in Bridge.h is 250000, and it worked (my Arduino IDE version upgraded to 1.6.4, it was 1.6.3 before ), thank you.

Sincerely,
Edward Chen

Chen Edward於 2015年6月5日星期五 UTC+8下午3時12分55秒寫道:

Chen Edward

unread,
Jun 5, 2015, 11:04:21 AM6/5/15
to lin...@googlegroups.com
Hi,

Here it is, could you explain it for me? thank you.
 
root@linino:~# cat /etc/inittab
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
ttyATH0::askfirst:/bin/ash --login
root@linino:~# 

Sincerely,
Edward Chen

andrea.cannistra於 2015年6月5日星期五 UTC+8下午5時21分58秒寫道:
Reply all
Reply to author
Forward
0 new messages