🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stack Core+Base WIFI issue

    M5Stack Fire
    1
    1
    4.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Engin
      last edited by

      Hi,

      I am trying to build an audio streaming project on M5Stack, it is a really good prototyping platform!
      Now I got a WIFI issue: UDP packets will become significantly lost if I connect with bases, but there is no problem if I just uses core.
      Here is my testing program (sending null RTP packets to my phone)

      ===
      #include "WiFi.h"
      #include "AsyncUDP.h"

      const char * ssid = "xxxxx";
      const char * password = "xxxxx";

      AsyncUDP udp;

      void setup()
      {
      Serial.begin(115200);
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, password);
      if (WiFi.waitForConnectResult() != WL_CONNECTED) {
      Serial.println("WiFi Failed");
      while(1) {
      delay(1000);
      }
      }

      }

      #define RTP_PAYLOAD_SIZE 160 //=8K/50

      /** RTP header constants */
      #define RTP_VERSION 0x80
      #define RTP_TIMESTAMP_INCREMENT 160 //=8K/50
      #define RTP_SSRC 0
      //#define RTP_PAYLOADTYPE 0 //=u-law
      #define RTP_PAYLOADTYPE 8 //=a-law
      #define RTP_MARKER_MASK 0x80

      unsigned rtp_seq = 0, rtp_timestamp = 0;

      void loop()
      {
      delay(10);
      AsyncUDPMessage rtp;
      rtp.write(RTP_VERSION);
      rtp.write(RTP_PAYLOADTYPE);
      rtp.write((rtp_seq>>8)&0xFF);
      rtp.write((rtp_seq)&0xFF);
      rtp.write((rtp_timestamp>>24)&0xFF);
      rtp.write((rtp_timestamp>>16)&0xFF);
      rtp.write((rtp_timestamp>>8)&0xFF);
      rtp.write((rtp_timestamp)&0xFF);
      rtp.write(0); //SSRC
      rtp.write(0); //SSRC
      rtp.write(0); //SSRC
      rtp.write(0); //SSRC
      for (int i = 0; i < RTP_PAYLOAD_SIZE; i++)
      rtp.write(0);
      udp.sendTo(rtp, IPAddress(192,168,0,222), 55555);
      //rtp_seq++;
      //rtp_timestamp += RTP_TIMESTAMP_INCREMENT;
      //udp.broadcastTo("Anyone here?", 1234);
      }

      RtpSpk app: https://play.google.com/store/apps/details?id=com.rtpspk

      Results:

      Bitrate is normal if I use core only:
      3_1560511587935_WIFI good.png 2_1560511587935_WIFI good.jpg

      Bitrate is small if I connect to base:
      1_1560511587935_WIFI bad.png 0_1560511587934_WIFI bad.jpg

      Can anyone help me for this issue? How to solve UDP packet lost when using bases? Thanks a lot!

      BRs,
      -Engin

      1 Reply Last reply Reply Quote 0
      • First post
        Last post