M5Stack Core+Base WIFI issue
-
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 0x80unsigned 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:
Bitrate is small if I connect to base:
Can anyone help me for this issue? How to solve UDP packet lost when using bases? Thanks a lot!
BRs,
-Engin