Skip to content

MQTT Library #8529

@savagerex

Description

@savagerex

Board

ESP32-WROVER-E

Device Description

Sensor - iis3dwb
external flash

Hardware Configuration

NONE

Version

v2.0.9

IDE Name

Arduino

Operating System

Windows 11

Flash frequency

80M

PSRAM enabled

yes

Upload speed

921600

Description

I use Mqtt library.( https://github.com/256dpi/arduino-mqtt ).

but this libray have different result between ESP32 WROVER and ESP32 S3.

if i declare in ESP32 WROVER
as below.

WiFiClient net;
MQTTClient client(891100);

it use "PSRAM" about 891100.

ESP32 WROVER always reset.

if i reduce

WiFiClient net;
MQTTClient client(1000);

then ESP32 WROVER is work.


if i declare in ESP32 S3

WiFiClient net;
MQTTClient client(1782000);

it use "PSRAM" about 1782000.

it is work.

Sketch

#include <WiFi.h>
#include <MQTT.h>

const char* ssid = "ASUS-38";     //SW1-WIFI6   ASUS-38   vivo Y21     ASUS-38
const char* pass = "12345678";   //wireless    12345678   1234567890   12345678

const char* mqtt_server = "192.168.50.129";   //broker.emqx.io  192.168.50.128
const char *topic = "DataTopic";

//uint8_t DataBufRead[18500];
uint8_t* DataBufRead;

WiFiClient net;
MQTTClient client(891100);  //1782000   ,  891100


void connect() {
  Serial.print("checking wifi...");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(1000);
  }

  Serial.print("\nconnecting...");

  while (!client.connect("arduino", "public", "public")) {
    Serial.print(".");
    delay(1000);
  }

  Serial.println("\nconnected!");

  
}


void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  //DataBufRead = (uint8_t*)ps_calloc(891100, sizeof(uint8_t));  //600
  
  WiFi.begin(ssid, pass);

  //DataBufRead = (uint8_t*)ps_calloc(600, sizeof(uint8_t));  //1700500

  // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported
  // by Arduino. You need to set the IP address directly.
  client.begin("192.168.50.129", net);
  //client.onMessage(messageReceived);

  connect();

  client.loop();
  delay(10);  // <- fixes some issues with WiFi stability

  if (!client.connected()) {
    connect();
  }
  

  client.loop();

  if (!client.connected()) {
    connect();
  }

  
  while(1);

  for (uint32_t i = 0; i<890999; i++)       // 1699999
  //for (uint32_t i = 0; i<161999; i++)
  //for (uint32_t i = 0; i<19999; i++)
  {
    DataBufRead[i] = 'a';
  }

  Serial.println(DataBufRead[0]);

   char *DataBuf = (char*)DataBufRead;
   bool PubData = client.publish(topic, DataBuf, 891000, false, 0);  //18000 //6000
   Serial.println(PubData);


   
   Serial.println("Mqtt Finish");
}

void loop() {
  // put your main code here, to run repeatedly:

}

Debug Message

hecking wifi....
connecting...Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4014a25b  PS      : 0x00060130  A0      : 0x800d4c74  A1      : 0x3ffb2110  
A2      : 0xffffffff  A3      : 0x000d98dc  A4      : 0x00000010  A5      : 0x00000004  
A6      : 0x00000000  A7      : 0x00000fff  A8      : 0x3ffb2150  A9      : 0x00000000  
A10     : 0x000006ec  A11     : 0x00000000  A12     : 0x000006ec  A13     : 0x0000b2c0  
A14     : 0x00000008  A15     : 0x3ffc4550  SAR     : 0x0000001c  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000000  LBEG    : 0x4008a58c  LEND    : 0x4008a5a8  LCOUNT  : 0x00000000  


Backtrace: 0x4014a258:0x3ffb2110 0x400d4c71:0x3ffb2130 0x400d4a0a:0x3ffb2180 0x400d46ed:0x3ffb21d0 0x400d27b9:0x3ffb2240 0x400d282c:0x3ffb2260 0x400d5d9a:0x3ffb2290




ELF file SHA256: 7a8bd1733f79ec0a

Rebooting...

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions