Go Down

Topic: How to disable the Bridge on Yun Rev2 (Read 912 times) previous topic - next topic


In the previous Yun version one could disable the bridge by the following changes in /etc/rc.local and in /etc/inittab:

in inittab this line: #ttyATH0::askfirst:/bin/ash --login  (quote it in order to disable the Bridge)

in rc.local:  echo 0 > /proc/sys/kernel/printk  (un-quote that line) in order to prevent unexpected messages

The inittab and rc.local files on the Rev2 look a bit different.

Does someone know how to change those files or maybe other files in order to disable the Bridge and to prevent unwanted messages


I'd also like to disable the Bridge and other messages.

Where you able to find out the answer to this?


Nobody answered.
I did not do a lot of tests yet, but as far as I can see now is that it is sufficient to leave out the following line in /etc/inittab:

#::askconsole:/usr/libexec/login.sh    (prepend with # in order to disable)


May 15, 2019, 10:30 pm Last Edit: May 18, 2019, 09:18 pm by JustVince
Same problems,

For me it does not work.
As the bridge is very slow, I tried to bypass the bridge by a program written in C rather than a program in Python (interpreted or even compiled).

But it seems that these commands are not enough on OpenWrt / LEDE 17.11 provided on my yun rev2.

/ Etc / inittab
Code: [Select]

# ttyATH0 :: askfirst: / bin / ash --login (quote it in order to disable the Bridge)

Code: [Select]

echo 0> / proc / sys / kernel / printk (add that line) in order to prevent unexpected messages

The only solution that I found was to change to an old OpenWrt / Linino 3.3.8 (2015) distribution available here:


For some reasons I do not understand my program works with older versions of Linino but not with the new LEDE distribution available on Yun rev2 !

I found that linux side, the line must be configured to 230 400 bps to actually turn at 250 000 bps (confirmed on the oscilloscope).
What the YunSerialTerminal.ino code confirms:

Code: [Select]

long linuxBaud = 250000;
SERIAL_PORT_HARDWARE.begin (linuxBaud); // open serial connection to Linux

However, I see an important jitter at this frequency in the direction Linux to Arduino.
At a lower frequency of 115 200 bps (113400 bps measured at the scope) the Arduino seems more robust and responds to a stable frequency.
But randomly, the communication fails because the linux side does not see the answer sent by the arduino or that its input queue saturates?!
And the program freezes on the reading instruction after 64 bytes read (count = 0x40) (see attachments)

Principle of the test program (of course this is not the purpose of the project)
The linux requests as quickly as possible the value of a counter that the arduino sends back to him before incrementing it.

Linux C program
Code: [Select]

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <string.h>
#include<stdlib.h> //exit(0);
#include <limits.h>
#include <time.h>

//*** DEBUG ***
#define DEBUG
//#define LININO
#define LEDE

char String[64];
int n =0;
int Loop = 0;

int Value_uC_int;

int init_keyboard (int fd);
int backup_keyboard (int fd);

void die(char*s)

void SetSpeed(struct termios *config, speed_t vitesse)
 cfsetispeed (config, vitesse);
 cfsetospeed (config, vitesse);

struct termios SavConfig_Keyboard;

int main( int argc, char *argv[])
 int fd;
 char c;
 int data;
 struct termios Termios_Struct;
#ifdef DEBUG
 printf("uC_uP_Com : Starting...\n\r");
#endif //DEBUG
 //if(init_keyboard(STDIN_FILENO) != 0) return -1;
// fd = open("/dev/ttyATH0", O_RDWR | O_NONBLOCK );
 fd = open("/dev/ttyATH0", O_RDWR );

 tcgetattr(fd, &Termios_Struct);

 //tcgetattr(fd, &Termios_Struct);
 //printf("%ld\n", (unsigned long) cfgetospeed(&Termios_Struct));

#ifdef LININO
 //ok on Linino
 printf("uC_uP_Com : Linino\n\r");
// SetSpeed(&Termios_Struct, B115200);
 SetSpeed(&Termios_Struct, B230400); // Scope measures 250 000 bps
#endif //LININO

 //Not recognized at the compilation step (on both Linino / LEDE) bus probably not standard config.
 //However the scope measures a close flow of 250 000 bps when 230 400 is configured!?
// SetSpeed(&Termios_Struct, B250000);

#ifdef LEDE
 // Try on LEDE
 printf("uC_uP_Com : LEDE\n\r");
 //SetSpeed(&Termios_Struct, B115200); Measured 113 400 bps
 SetSpeed(&Termios_Struct, B230400);
#endif //LEDE

 Termios_Struct.c_cflag |= CS8;
 Termios_Struct.c_cflag &= ~CSTOPB;
 Termios_Struct.c_cflag &= ~PARENB;
 Termios_Struct.c_cc[VMIN] = 4;

// Termios_Struct.c_lflag &= ~ECHO;
 tcsetattr(fd, TCSANOW, &Termios_Struct);

 tcflush(fd, TCIOFLUSH);
#ifdef DEBUG
 printf("uC_uP_Com : Reseting uC\n\r");
#endif //DEBUG

 //resetting counter on the Arduino Side
 write(fd, "RST\n", 4);
#ifdef DEBUG
 printf("uC_uP_Com : Looping\n\r");
#endif //DEBUG
 while( Loop < 10000 )
 tcflush(fd, TCIFLUSH);
 //Asking for Arduino Side new counter
 write(fd, "RD\n", 3);

 // Reading answer from Arduino
 // ******* Fails by chance on LEDE !!!                    ***********
 // ******* Seems the input queue is full et never flushed ***********
 n += read(fd, (char*)&Value_uC_int, 4);

 // Switching from big<>little endian
 Value_uC_int = htole32(Value_uC_int);

#ifdef DEBUG
 printf("%d : %d\n\r", Loop, Value_uC_int);
#endif //DEBUG
 //Testing value, Loop == Count
 if (Value_uC_int != Loop)
 printf("Error %d ## %d\n\r", Loop, Value_uC_int);


 tcflush(fd, TCIOFLUSH);
// usleep(10);


 printf("Number of loops reached : %d\n\r", Loop);

 printf("Back clavier\n\r");
 if( close(fd)<0 )
 printf("Exit fails!!!\n\r");
 printf("Exit succeeded\n\r");

int init_keyboard (int fd)
 struct termios Config_Keyboard;
 if( tcgetattr(fd, &Config_Keyboard) != 0 )
 return -1;

 memcpy( &SavConfig_Keyboard, &Config_Keyboard, sizeof(struct termios));

 if( tcsetattr(fd, TCSANOW, &Config_Keyboard) != 0)
 return -1;
 return 0;

int backup_keyboard (int fd)

 tcsetattr(fd, TCSANOW, &SavConfig_Keyboard);
 return 0;

Arduino side program
Code: [Select]

long int Value_uC = 1;
String Cmd;

//#define DEBUG

/* SETUP                                                           */
void setup()
  // put your setup code here, to run once:

  /* µC <=> Monitor serial communication.                          */
#ifdef DEBUG
  Serial.begin( 115200 ); // Serial speed 9600 bauds
  Serial.print("Let's go");
#endif //DEBUG
  /* µC <=> µP communication.                                      */
  // Open uC <-> uP communication
  // Configuration :
  // default config 8N1
  // data     : 8 bit
  // parity   : None
  // Stop bit : 1

  // Ok
  // Serial1.begin(115200, SERIAL_8N1);
  // Non Standard #230400
  // Serial1.begin(230400, SERIAL_8N1);
  Serial1.begin(250000, SERIAL_8N1);

  Value_uC = 1;

/* Int32 => Serial 1 (µP).                                         */
void Serial_1_Send_Int32(volatile long int *Val)
    Serial1.write(  *    (((char *)Val)+0)     );
    Serial1.write(  *    (((char *)Val)+1)     );
    Serial1.write(  *    (((char *)Val)+2)     );
    Serial1.write(  *    (((char *)Val)+3)     );

/* LOOP                                                            */
void loop() {

  /* µC <=> µP Communication.                                      */

  // Read from Serial port 1 (µP)
  if( Serial1.available() )
    Cmd = Serial1.readStringUntil('\n');
//    Cmd = Serial1.read();
//    Cmd += '\0';

     if (Cmd == "RST")
        #ifdef DEBUG
        #endif //DEBUG

     if (Cmd == "RD")
        #ifdef DEBUG
        Serial.print("RD: ");
        #endif //DEBUG
        Serial_1_Send_Int32( (long int*) &Value_uC);



Go Up