🤖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

    Scheduled Pinned Locked Moved M5Stack Fire
    1 Posts 1 Posters 5.1k Views 1 Watching
    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 Offline
      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

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post