ph1p / ikea-led-obegraensad

ESP32/Arduino hack for the ikea OBEGRÄNSAD led wall lamp
MIT License
578 stars 78 forks source link

Load or store to an unaligned address issue when running on Wemos D1 mini #86

Closed wallem89 closed 4 months ago

wallem89 commented 5 months ago

I am trying to run this software on a Wemos D1 mini with ESP8266. The same used in the x-clock software which is working with this IKEA LED panel.

I build the software in environment d1_mini_pro-OTA with platformIO on VS code. I first flashed the software on the ESP and checked this before opening the LED panel. I got an error but thought that makes sense because nothing it connected to the ESP. Then I opened the panel, soldered all wires as described in the README and tested.

Now I got the same error as before:

Exception (9):
epc1=0x4020fc56 epc2=0x00000000 epc3=0x00000000 excvaddr=0x3fff0869 depc=0x00000000

LoadStoreAlignmentCause: Load or store to an unaligned address
  epc1=0x4020fc56 in SPIClass::writeBytes_(unsigned char const*, unsigned char) at ??:?

After this the ESP resets and starts again connecting to WiFi (which is successful) and then crashed again with the same error.

First I was confused by the SPIClass part but I now understand that the LED panel works with shift registers. Each panel has 4 of then each controlling 16 LEDs, bringing the total up to 256 LEDs. I checked all my connections, no short circuits and good connection from LED panel to the ESP board. Tried another identical Wemos D1 mini with the same result.

Just to check the hardware I flashed X-Clock WEB FOR OBEGRÄNSAD (MINI PRO) V0.1.09 for here: https://o-clock.eu/ and that worked right away! More on this application can be found here (I also found it in another issue here): http://blog.digital-image.de/2023/05/31/x-clock/

But I don't want only a simple clock I want all functionality of this awesome repository! What can I do to diagnose my system further?

zuckschwerdt commented 4 months ago

See the lib note here https://github.com/esp8266/Arduino/blob/c96dc26792905dc43280587fcdf5ae5af024b286/libraries/SPI/SPI.cpp#L409-L415 and then the code here https://github.com/ph1p/ikea-led-obegraensad/blob/fecc02047f3add78d0894b896a46b4779722fdc0/src/screen.cpp#L160-L173 This might manifest a bug if a platform doesn't align random elements. Really bits needs to be a 32-bit type.

zuckschwerdt commented 4 months ago

If you are still interested try the patch from #105

wallem89 commented 4 months ago

If you are still interested try the patch from #105

Yes, I surely am! Thanks!

But with my new laptop I have some issues setting everything up again. Without your fix I can monitor it running but the screen stays off. No Exception is printed only some jiberish.

I will try to make this working first and then test and review your PR #105