Watchdog Timeout on SPIFFS.begin or SPIFFS.format - esp8266

I'm using an ESP-12E NodeMCU board from amazon with the Arduino IDE. It's been working without any problems but now I'm trying to use SPIFFS to store data and I'm getting a Watchdog Timeout after 8 seconds when I call either SPIFFS.begin or SPIFFS.format.
ets Jan 8 2013,rst cause:4, boot mode:(1,7)
wdt reset
I've run the example CheckFlashConfig sketch and it reports a size mismatch. IDE size of 4M and real size of 1M. I'm using the Adruino IDE board definition for NodeMCU 1.0 (ESP-12E Module) with a flash setting of 4M (3M SPIFFS).
Flash real id: 001440C8
Flash real size: 1048576
Flash ide size: 4194304
Flash ide speed: 40000000
Flash ide mode: DIO
Flash Chip configuration wrong!
Here's the full code of the CheckFlashConfig sketch:
/*
ESP8266 CheckFlashConfig by Markus Sattler
This sketch tests if the EEPROM settings of the IDE match to the Hardware
*/
void setup(void) {
Serial.begin(115200);
}
void loop() {
uint32_t realSize = ESP.getFlashChipRealSize();
uint32_t ideSize = ESP.getFlashChipSize();
FlashMode_t ideMode = ESP.getFlashChipMode();
Serial.printf("Flash real id: %08X\n", ESP.getFlashChipId());
Serial.printf("Flash real size: %u\n\n", realSize);
Serial.printf("Flash ide size: %u\n", ideSize);
Serial.printf("Flash ide speed: %u\n", ESP.getFlashChipSpeed());
Serial.printf("Flash ide mode: %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));
if(ideSize != realSize) {
Serial.println("Flash Chip configuration wrong!\n");
} else {
Serial.println("Flash Chip configuration ok.\n");
}
delay(500000);
}

I bought a 2nd Amica NodeMCU unit from another vendor and had no problems. I'm chalking this up to bad hardware.

This problem can also be caused by inappropriate power supply. I know from my own experience that the Arduino Uno and most USB-TTL converters cannot safely deliver enough current to the ESPs. If you're not already, consider using a dedicated power supply circuit that are connected to a USB power source.

Related

How to connect a thermal printer to an ESP32?

I want to attach my GOOJPRT Thermal Printer (I believe model QR701, communication RS232) to my ESP32 but I cannot seem to get them working.
I tried all the Adafruit Thermal Printer library examples but get the same error each and every time:
"Error compiling for board ESP32 Dev Module."
I guess the libraries are not meant for the ESP32.
I also tried the "Thermal Printer Library" by Larry Bank (which should be compatible with the ESP32 according to its github docs) but there I cannot figure out how to connect the wires of thermal printer to the ESP32 correctly.
Of course, I do not ask for a specific solution, I am just looking for someone to point me in the right direction!
This is an image of the exact thermal printer I have
Full error message from Adafruit Thermal Printer examples:
C:\Users\Thomas\Documents\Arduino\libraries\SoftwareSerial-master\SoftwareSerial.cpp:41:27: fatal error: avr/interrupt.h: No such file or directory
compilation terminated.
Multiple libraries were found for "Adafruit_Thermal.h"
Used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library
Not used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit-Thermal-Printer-Library-master
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\Thomas\Documents\Arduino\libraries\SoftwareSerial-master
Not used: C:\Users\Thomas\Documents\Arduino\libraries\EspSoftwareSerial
exit status 1
Error compiling for board ESP32 Dev Module
You need to use the <HardwareSerial.h> library. SoftwareSerial is for Arduino boards.
"Thermal Printer Library" by Larry Bank is for GOOJPRT PT-210 and use Bluetooth. Won't work for qr-701.
Instead of using Adafruit Library, you can try with this:
ThermalPrinter
Quick start:
Import libraries:
#include "TPrinter.h"
#include <HardwareSerial.h>
Set baudrate and pins.
const int printerBaudrate = 9600; // or 19200 usually
const byte rxPin = 16; // check datasheet of your board
const byte txPin = 17; // check datasheet of your board
const byte dtrPin = 27; // optional
const byte rsePin = 4; // direction of transmission, max3485
You need to use boad with max3485(for 3V3 logic lvl) or similar, if you have printer with rs232.
Necessary in my case. I use board UART - RS485 3,3V - ARK/RJ11 - Waveshare 4777
Init
HardwareSerial mySerial(1);
Tprinter myPrinter(&mySerial, printerBaudrate);
void setup() {
micros();
mySerial.begin(printerBaudrate, SERIAL_8N1, rxPin, txPin); // must be 8N1 mode
pinMode(rsePin, OUTPUT); // optional
digitalWrite(rsePin, HIGH); // optional
// myPrinter.enableDtr(dtrPin, LOW); // optional
myPrinter.begin();
}

read and write on serial port with a lua script on raspberry

i'm currently working on a project aiming at controlling a RS232 device by a Raspberry pi4. I'm forced by other softwares to use a lua script and i never coded in lua, even if i have already made the code in Python... I've searched on google far and wide for an answer but have not found anything helping me.
I want my raspberry to open the COM port, and then read and send messages through that port.
I've tried the lua user wiki and This post on stackoverflow (read and write on windows) but both can't be applied to raspberry.
If anyone could help that'd be awesome !
here's my code in python if that can help you.
import serial
def convertisseur(chemin):
Tableau = []
f = open(chemin)
for row in f:
Tableau.append(row)
f.close
return (Tableau)
def statut(ser):
ser.write(bytearray([0X53,0X07,0X01,0X01,0X41,0X60,0X00,0X73,0X45]));
lecture=ser.readline()
print(lecture);
return()
def main():
ser = serial.Serial('COM3', 115200, timeout=1)
ser.close()
ser.open()
Code=convertisseur('C:/Users/Ello/Desktop/CodePosition.txt')
statut(ser)
ser.write(bytearray([0X53,0X09,0X01,0X02,0X40,0X60,0X00,0X06,0X00,0X2C,0X45]));
ser.readline()
ser.write(bytearray([0X53,0X09,0X01,0X02,0X40,0X60,0X00,0X0F,0X00,0X25,0X45,0X53,0X08,0X01,0X02,0X60,0X60,0X00,0X01,0XF5,0X45]));
ser.readline()
statut(ser)
print('Engine move in cm ? - for trigo, STOP to stop')
Speed = input()
while Speed != "STOP":
speed = int(Speed)
if speed > 38:
speed = 38
if speed < -37:
speed = -37
speed = round(abs((speed-38)))
ser.write(bytearray(int(i, 16) for i in Code[speed-1].split(",")))
ser.write(bytearray([0X53,0X09,0X01,0X02,0X40,0X60,0X00,0X0F,0X00,0X25,0X45,0X53,0X09,0X01,0X02,0X40,0X60,0X00,0X7F,0X00,0X55,0X45]));
ser.readline()
statut(ser)
Speed = input()
print("Fin du programme, fermeture du port, passage du moteur sur OFF")
ser.write(bytearray(int(i, 16) for i in Code[60].split(",")))
statut(ser)
ser.close()
return 0
I want my raspberry to open the COM port, and then read and send messages through that port.
Hi, try vsergeev/lua-periphery: A Lua library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux
, especially Serial section.
Not sure the dev path for you.
In my case the periphery COM device connect to TTL-USB converter, then USB of Pi, so path is '/dev/ttyUSBx'.
As I know, GPIO has UART serial support too.

Enabling bus mastering/BMDMA in gem5 FS mode

I am building a custom full system configuration (largely influenced by ARM in configs/FSConfig.py) and am running into an issue where the kernel hangs on boot, being unable to access the disk image to mount the root filesystem. Looking at the kernel boot logs and gem5 call trace, I strongly suspect the culprit has to do with this:
[ 0.000005] ata_piix 0000:00:01.0: BMDMA: BAR4 is zero, falling back to PIO
In other words, while a standard ARM FS mode simulation will enable bus mastering on the simulated gem5 (PIIX) IDE controller and use DMA to access the disk, my simulation reverts to PIO instead. The PCI node of my device tree is the one from ARM’s vexpress (aarch64) dtb. My PCI host/IDE controller setup is also similar to ARM’s setup:
self.cf0 = CowIdeDisk(driveID='master')
self.cf0.childImage(mdesc.disk())
self.pci_host = GenericPciHost(conf_base=0x30000000, conf_size=’256MB’, confi_device_bits=12, pci_pio_base=0x2f000000)
self.pci_ide = IdeController(disks=[self.cf0], pci_dev=1, pci_bus=0)
pci_devices.append(self.pci_ide)
…
self.pci_host.pio = self.iobus.master
for dev_id, dev in enumerate(pci_devices):
dev.host = self.pci_host
dev.pio = self.iobus.master
dev.dma = self.iobus.slave
The gem5 call trace includes the following (no methods from CowDiskImage are called):
IdeController::Channel::accessCommand: offset = 6, size = 1, read = 0
IdeDisk::updateState: action = 4.
IdeDisk::writeCommand: Write to disk at offset: 0x6 data 0xa0
IdeController::dispatchAccess: Write from offset: 0x2f000016 size: 0x1 data: 0xa0
IdeDisk::readControl: Read to disk at offset: 0x2 data 0x40
IdeController::dispatchAccess: Read from offset: 0x2f000022 size: 0x1 data: 0x40
IdeDisk::writeControl: Write to disk at offset: 0x2 data 0xa
IdeController::dispatchAccess: Write from offset: 0x2f000022 size: 0x1 data: 0xa
I have already verified that my kernel includes drivers for the PIIX, legacy ATA controllers, and BMDMA. I have also attempted to change the BAR4 value of the IDE controller directly in the system configuration file and update the device tree with a dma-ranges field for the PCI node. None of these solutions worked.
TL;DR: How do I ensure that my full system configuration supports and enables bus mastering for the IDE controller? Is there anything special I need to add to the device tree binary?

ESP8266 Fatal exception (0) using NodeMCU

When i boot ESP8266 i'm getting on my arduino MEGA serial monitor.
Fatal exception (0): e2= 0d00l(xp00v0xao1,00e0c pe80c00d0x:2= 0d00l(xp00v0xao1,00e0c pe80c00d0x:2= 0d00l(xp00v0xao1,00e0c e 0xp0= 0e)02,0d00a 0e00c00Fic00= 0p0e 0xp0= 0e)02
If i do a hard reset than it prints
Jan 8 2013,rst cause:4, boot mode:(3,6) wdt reset load 0x40100000, len 28740, room 16 tail 4 chksum 0xcd load 0x3ffe8000, len 2888, room 4 tail 4 0xeotail 0 chks
I used NodeMcu flasher nodemcu_integer_0.9.5_20150318.bin and NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4. I'm using arduino UART (serial monitor) to talk to ESP8266. BAUD RATE : 115200 FLASH SIZE : 4MB FLASH SPEED : 40MHz SPI : DIO Module is powered with apt power (separate power supply)
Here's my connections:
//////////////////////////////////////////////////////////////////////////////
/////// CONNECTIONS ////////
/////////////////////////////////////////////////////////////////////////////
/*
ESP8266 VCC -> BeagleBone 3.3
ESP8266 GND -> Common GND (Arduino & BeagleBone)
ESP8266 CH_PD -> 3K resistor -> VCC
ESP8266 RST -> VCC or pin 13(arduino)
GPIO CAB BE LEFT OPEN OR TIED HIGH
ESP8266 Tx -> pin2 (Arduino software serial Rx)
ESP8266 Rx <- Voltage Divider <- pin3 (Arduino software serial Tx)
*/
Here's my code
#define esp8266 Serial2
#define CH_PD Vcc // but needs a narrow low pulse
#define speed8266 9600 // This is the speed that worked with my ESP8266
void setup()
{
esp8266.begin (speed8266);
Serial.begin(9600);
reset8266(); // Pin CH_PD need a reset before start communication
}
void loop()
{
while(esp8266.available())
{ Serial.write(esp8266.read()); }
while(Serial.available())
{ esp8266.write(Serial.read()); }
}
/*************************************************/
// Reset funtion to accept communication
void reset8266 ()
{
pinMode(CH_PD, OUTPUT);
digitalWrite(CH_PD, LOW);
delay(300);
digitalWrite(CH_PD, HIGH);
}
Here are some snaps of the configuration i did in NodeMCU ( i had already tried with different baud rates)
Advanced Configuration
Configuration
If you are getting fatal error exception like this:
Exception (3):
epc1=0x401003e9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4000cbd9 depc=0x00000000
In infinite loop in your serial monitor of arduino IDE .
then goto this link download the software and follow the procedure and erase the flash memory to solve the error.
This does not solve fatal error that occurs due to your program but in case your device goes in such condition that it can’t be able to access program memory then it will work and try atleast one time to solve the problem.
This is the procedure to hard reset the nodemcu
( https://www.youtube.com/watch?v=MHrm7axsImI&t=146s )
Step :
Install latest python version in you pc.(https://www.python.org/downloads )
Open cmd prompt as administrator .
Go to c/program files or program files (x86)->python (your version)->Script. For this type (cd c/program files (x86)/python(your version)/Script) then press enter .
Now type (pip install esptool).
Now download ESPlorer ( https://esp8266.ru/esplorer/ ) version(Download ESPlorer.zip (v 0.2.0-rc6)) and extract the file and open executable jar file .
Now goto nodemcu firmware site (https://github.com/nodemcu/nodemcu-firmware/releases ) and from download file (nodemcu_float_0.9.6-dev_20150704.bin ) and copy this file into the c/program files (x86)/python(your version)/Script folder .
Now in cmd prompt just type.
esptool.py --port COM(your port no.) --baud 115200 erase_flash
And press enter.
Note : you can see your port no. into the device manager .
For NODEMCU users who face this issue
This needs to be done only once (first time you connect nodemcu to PC)
Download and run the 32 or 64 bit flasher*:
32 bit: https://github.com/nodemcu/nodemcu-flasher/blob/master/Win32/Release/ESP8266Flasher.exe
64 bit: https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe
Select the download button on github and open file once downloaded.
Select the chip port from the previous step (Com 6 for me), and then select flash (this should only have to be done once) close flash program once completed. Process is completed when you get the green checkmark in the bottom left hand corner.
PS: make sure you disconnect and re-connect the nodemcu once done
REFERENCE: https://www.instructables.com/NodeMcu-ESP8266-First-Time-Setup-With-Arduino-IDE/

PROCCESING-Pixel operations are not supported on this device

Any code I write that requires save(), saveFrame() or functions like loadpixels() I can't use, what's stopping me from saving edited pitcures.
Error it says its: Pixel operations are not supported on this device.
About my computer:
Windows7 ultimate Service pack 1, 64-bit
AMD A10-5800K APU with Radeon(tm) HD Graphics 3.80 GHZ
UPDATE
It works on any other computer just not mine, even some basic codes like this one for example
size(640,480);
background(255);
fill(44);
beginShape();
vertex(50,20);
vertex(600,160);
vertex(190,400);
endShape(CLOSE);
saveFrame("izlaz1.jpg");
I suppose that your Windows' color depth setting is set too low.
Processing assumes that system exposes color depth as 32-bit (RGB + alpha = 4*8bit).
This is fragment from PGraphicsJava2D class:
protected WritableRaster getRaster() {
...
if (raster.getTransferType() != DataBuffer.TYPE_INT) {
System.err.println("See https://github.com/processing/processing/issues/2010");
throw new RuntimeException("Pixel operations are not supported on this device.");
}
return raster;
}
So "Pixel operations are not supported" exception is raised when your system exposes to low color depth.
Try to change your Windows' setting.
Some helper links below:
https://github.com/processing/processing/issues/2010
http://helpx.adobe.com/x-productkb/global/change-color-depth-resolution-windows.html

Resources