maxbbraun / accent

Accent Smart Picture Frame
https://accent.ink
MIT License
200 stars 16 forks source link

Setting Up Client #16

Open energysteward opened 3 years ago

energysteward commented 3 years ago

I'm trying to follow these instructions from your ReadMe.

To push the client code to the board:

Add your server base URL to Client.ino. Use the board information in Client.ino to set up the environment. Verify and upload the sketch. Finally, follow the on-screen instructions to connect the client to a Wifi access point.

Honestly, I've never worked with Arduino devices. I followed the instructions but nothing is appearing on the e-ink screen.

I verified, compiled and uploaded the client.ino file with no errors, but nothing is occuring. The e-ink screen is blank white.

What am I missing?

maxbbraun commented 3 years ago

Could you paste the serial output from the client here?

NeilBetham commented 3 years ago

I seem to be running into a similar issue with a recent ESP32 e-Paper dev board from Waveshare. Oddly enough after flashing the board the first stage bootloader fires up but the main app fails almost immediately after that. Somewhat surprising there isn't a stack trace getting printed.

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
\xFFNo

Still trying to figure out the cause. I have a logic analyzer attached to the UART of the ESP32 and it looks like after printing the No text it's either resetting or something is getting corrupted which causes it to start dumping garbage to the UART. You can see that the baud rate changes significantly after the o is sent:

image

I'll update once I know some more about what's happening.

NeilBetham commented 3 years ago

Okay, update. It looks like there is an issue with the arduino-esp32 compatibility layer. After digging through the GX_EPD lib there is a second call to Serial.begin which is causing the issue. By setting the serial baud rate to 0 in the gx_epd->init call inside Display.h the issue is mitigated and I can now see the AccentSetup screen when the esp32 boots. Not optimal as you no longer get debug messages from the display library but will get the display lib up and running in the short term.

Edit: Seems others might be running into the issue as well: https://github.com/espressif/arduino-esp32/issues/5004

maxbbraun commented 3 years ago

Hm, I'm not able to reproduce the issue. For me, the second call to Serial.begin works and I get messages from both the Accent code and the GxEPD library. Is this a first run thing for you or does it still happen if you set the baud rate back to normal after the device is fully set up?

NeilBetham commented 3 years ago

So the first Serial.begin in Client.ino is fine; it's whenever someone calls it again that becomes the issue. For some reason it corrupts the serial interface. I can try removing that and then letting GxEPD do the init to see if that mitigates the issue or not. Out of curiosity, what core version are you running in the arduino IDE? The version I have installed is 1.0.6.

NeilBetham commented 3 years ago

So if I let GxEPD call Serial.begin I can also get the debug messages from there as well. Though I do miss the couple messages that get printed from Client.ino / Network before GxEPD init's the UART. Suffice it to say I don't think this is a bug in the Accent client just an issue in the underlying arduino-esp32 layer.

maxbbraun commented 3 years ago

Oh, I see. I'm using Arduino IDE 1.8.13 and esp32 version 1.0.2.

NeilBetham commented 3 years ago

Okay, confirmed the issue is in the arduino-esp32 cores somewhere after 1.0.2. I downgraded to the 1.0.2 rev and I don't experience the same hanging issue as with 1.0.6. Though calling Serial.begin again does appear to nuke the buffers as I miss out on most of the messages that happen between startup and GxEPD init.

maxbbraun commented 3 years ago

I was also able to reproduce with esp32>=1.0.5 while 1.0.4 still seems to work fine.