title: Unable to send and receive images between 2 Raspberry connected to Zigbee via UART
body: <p>I have 2 Raspberry Pi4 connected to Zigbee via UART, I wrote the program to receive and send between the two devices. My program can send and receive character data very accurately, but when I send data from a photo, the program never receives enough data. I tried a PC connected to Zigbee and sent pictures to Pi via RealTerm, on Pi I received photos. What is the problem here? Or does anyone have another way to send photos between 2 Raspberry connected to Zigbee via UART? Thanks very much.</p>
  <p><strong>Program send:</strong></p>
  <pre><code>#include &quot;ui_serial.h&quot;
  #include &lt;QDebug&gt;
  #include &lt;QBuffer&gt;
  #include &lt;QPixmap&gt;
  #include &lt;QFile&gt;
  
  
  serial::serial(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::serial)
  {
      ui-&gt;setupUi(this);
  
      serialPort = new QSerialPort(this);
      serialPort-&gt;setPortName(&quot;ttyAMA0&quot;);
      serialPort-&gt;setBaudRate(QSerialPort::Baud115200);
      serialPort-&gt;setDataBits(QSerialPort::Data8);
      serialPort-&gt;setStopBits(QSerialPort::OneStop);
      serialPort-&gt;setFlowControl(QSerialPort::NoFlowControl);
      serialPort-&gt;open(QIODevice::ReadWrite);
  
      if (serialPort-&gt;isOpen() == true){
          qDebug() &lt;&lt;&quot;Port Opened....&quot;;
          connect(serialPort, SIGNAL(readyRead()), this, SLOT(on_readdata()));
      }
  }
  void serial::on_pushButton_2_clicked()
  {
      QFile* imageFile = new QFile(&quot;/home/pi/Desktop/image.jpg&quot;);
          imageFile-&gt;open(QIODevice::ReadOnly);
          QByteArray ba = imageFile-&gt;readAll();
          imageFile-&gt;close();
          delete imageFile;
          if(serialPort-&gt;isOpen()==true){
              serialPort-&gt;write(ba);
              qDebug()&lt;&lt;ba.size()&lt;&lt;&quot;size_send:&quot;;
          }
  }
  </code></pre>
  <p><strong>Program read:</strong></p>
  <pre><code>#include &quot;ui_serial.h&quot;
  #include &lt;QDebug&gt;
  #include &lt;QBuffer&gt;
  #include &lt;QPixmap&gt;
  #include &lt;QFile&gt;
  #include &lt;QMessageBox&gt;
  
  serial::serial(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::serial)
  {
      ui-&gt;setupUi(this);
  
      serialPort = new QSerialPort(this);
      serialPort-&gt;setPortName(&quot;ttyAMA0&quot;);
      serialPort-&gt;setBaudRate(QSerialPort::Baud115200);
      serialPort-&gt;setDataBits(QSerialPort::Data8);
      serialPort-&gt;setStopBits(QSerialPort::OneStop);
      serialPort-&gt;setFlowControl(QSerialPort::NoFlowControl);
      serialPort-&gt;open(QIODevice::ReadWrite);
  
      if (serialPort-&gt;isOpen() == true){
          qDebug() &lt;&lt;&quot;Port Opened....&quot;;
          connect(serialPort, SIGNAL(readyRead()), this, SLOT(on_readdata()));
      }
  }
  
  void serial::on_readdata()
  {
      QByteArray ba;
      while (serialPort-&gt;waitForReadyRead(1000)){
          ba.append(serialPort-&gt;readAll());
      }
      qDebug()&lt;&lt;ba.size()&lt;&lt;&quot;sizeeeee:&quot;;
      QFile newDoc(&quot;/home/pi/Desktop/imagexx.jpg&quot;);
              if(newDoc.open(QIODevice::WriteOnly)){
                  newDoc.write(ba);
              }
              newDoc.close();
  }
  </code></pre>