Load 0x4010f000, len 3424, room 16

I already changed from UNO to WeMos D1
Yet after compiling the following code, i keep getting this error:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00044580
~ld

What is wrong with my code?

#include <ESP8266WiFi.h>
#include "HX711.h"

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = D4;
const int LOADCELL_SCK_PIN = D5;

HX711 scale;

void setup() {
  Serial.begin(115200);
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  lcd.begin();
  lcd.backlight();
  lcd.clear();
  

  lcd.setCursor(0, 0);
  lcd.print("Initializing");
  lcd.setCursor(0, 1);
  lcd.print("SBSS");
  delay(1000);
  
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("WiFi starting");
  lcd.setCursor(0, 1);
  lcd.print("Connecting...");
  delay(1000);

  Serial.println("WiFi starting");
  WiFi.begin("47B 2.4Ghz","blt4397fuad");
  Serial.print("Connecting...");
  while(WiFi.status()!=WL_CONNECTED){ //Loop which makes a point every 500ms until the connection process has finished
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("WiFi Connected!");
  Serial.println(WiFi.localIP());
  Serial.println(WiFi.SSID()); //Displaying the IP Address

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("WiFi Name");
  lcd.setCursor(0, 1);
  //lcd.print(WiFi.localIP());
  lcd.print(WiFi.SSID());
  
  delay(1000);
  
  Serial.println("Initializing the scale");

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());      // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));   // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight (not set yet)

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);  // print the average of 5 readings from the ADC minus tare weight (not set) divided
            // by the SCALE parameter (not set yet)
            
  scale.set_scale(895.640);
  //scale.set_scale(-471.497);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();               // reset the scale to 0

  Serial.println("After setting up the scale:");

  Serial.print("read: \t\t");
  Serial.println(scale.read());                 // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight, set with tare()

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided
            // by the SCALE parameter set with set_scale

  Serial.println("Readings:");
  Serial.println(scale.get_units(5), 1);  


  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Suu Balm");
  lcd.setCursor(0, 1);
  lcd.print("Smart Sensor");
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Ready: Please");
  lcd.setCursor(0, 1);
  lcd.print("remove bottle");
  delay(1000);

}

void loop() {
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  float i = scale.get_units();
  if (i < 1)
  {
    i = 0.00;
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("SB Smart Sensor");
  lcd.setCursor(0, 1);
  lcd.print("Vol = ");
  lcd.print(i,1);
  lcd.print(" g");

  delay(1000);

}

That incredibly strange message just means the program has crashed.

Did it produce any serial output from the serial prints in your code?

This is the serial output received:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00044580
~ld

all of it?

this is it in serial

that points to the place in the program where it failed. understand?

The redundant scale.begin in loop may be causing problems.

or does this related with yield();
in my while loop for checking wifi connection caused by ESP8266?

I removed 2 scale.begin already from the code, yet it throwing the same serial error

You have a delay() within the while loop, the delay function calls yield() otherwise it would be unusable on the ESP8266.

There should only be a single scale.begin() in setup.

1 Like

Owh David, by commenting delay(500) in my while loop.
there's no error anymore! How wonderful!

ok since this has been sorted, now my LCD is not showing anything relevant within the void loop()
image as attached (can see meaningless chars shown):


n

There WILL be... First time WiFi does not connect very quickly, you will get a watchdog error, and the program will halt.

What troubleshooting have you done?

the first bug fixed by removing delay in my while loop, turned out the delay line will cause error.
for the LCD, im trying to remove / uninstall the library and install a fresh new library and reconnect it.

it wasn't that it show all aliens kind of characters,
but when the lcd clear code fires, then there's where the weird characters appear on screen
im suspecting that there's a spike of current? but will be concluded after 2-3 library change

will keep you updated

If no library changes fix the problem, post a wiring diagram and clear, close up photos of your hardware.

Sure will do, thanks! :smiling_face_with_three_hearts:

Which boards package are you using for the WeMos D1? I was under the impression that the ESP8266 variant of delay() called yield() and would not cause a watchdog timer reset.

I am still of the opinion that calling scale.begin() multiple times is going to cause you problems.

the board appeared on my IDE was: LOLIN(WeMOS) D1 R1

where should the scale.begin placed? only in setup function or loop?

this code now works perfectly:

#include <ESP8266WiFi.h>
#include "HX711.h"
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
const int LOADCELL_DOUT_PIN = D4;
const int LOADCELL_SCK_PIN = D5;
HX711 scale;
LiquidCrystal_I2C lcd(0x27, 18, 2);<------ culprit 1
void setup() 
{
  lcd.begin();
  lcd.backlight();
  Serial.begin(115200);
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  Serial.println(scale.get_units(5), 1); 

  Serial.println("WiFi starting");
  WiFi.begin("Suu Balm","fastitchrelief99");
  //WiFi.begin("47B 2.4Ghz","blt4397fuad");
  Serial.print("Connecting...");
  while(WiFi.status()!=WL_CONNECTED)
  {
   Serial.print(".");
  }
  Serial.println();
  Serial.print("WiFi Connected!");
  Serial.println(WiFi.localIP());
  Serial.println(WiFi.SSID());
  delay(3000);
  scale.set_scale(895.640);
  scale.tare(); 
  Serial.print("read: \t\t");
  Serial.println(scale.read());  
  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));   // print the average of 5 readings from the ADC minus the tare weight, set with tare()
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("SB Smart Sensor");
}

void loop() 
{
 float i = scale.get_units(5); // <------ culprit 2
  if (i < 1)
  {
    i = 0.00;
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("SB Smart Sensor");
  lcd.setCursor(0, 1);
  lcd.print("Vol = ");
  lcd.print(i,1);
  lcd.print(" g");
  delay(500);
}

Im suspecting the LCD library works with 18 chars as previous code was initated with 16
and the average value taking from scale.get_units(5), it turned out the whole script will turn haywire if bigger average is set (Eg: 5 to 20)

Hi aarg,

The serial thrown the same error again when scale code should run.
I tried installing Exception decoder in my mac by creating tools folder and extracting the downloded jar file.

but when i closed IDE, compiled and ran the code: the Exception decoder not even showing in Tools menu on top of IDE

can help me on this?

I don't know. I never use tools like the exception decoder. When I get something like that, I start examining the code, starting with the last change I made to it before it started happening.