Updating from DeviceOS 1.5.0-rc.1 & rc.2 - AdaFruit SSD1306 lib causes freeze

This ticket is related to Updating from DeviceOS 1.4.4 to 1.5.0-rc.1 -> SOS Panic 1

Using an OLED display with SPI interface and AdaFruit SSD1306 library, the the device freezes once display.begin() is called:

  • indicator hard white
  • no debug output
  • cannot program OTA without entering safe mode

when running DeviceOS 1.5.0-rc.1 on a p1 and compiling for target 1.5.0-rc.1 (noting that there is no issue when targetting DeviceOS 1.4.4 on a device loaded with 1.5.0-rc.1).

This ticket is just for reference - will test against DeviceOS 1.5.0-rc.2 once it is released and report back.

Repeated the experiment:

  • compilation under DeviceOS 1.4.4 - (device loaded with DeviceOS 1.5.0-rc.1) - worked fine
  • compilation under DeviceOS 1.5.0-rc.1 - (device loaded with DeviceOS 1.5.0-rc.1) - display issue as documented in this ticket - breathing white
    FYI compiled to text size 107,836 bytes
  • compilation under DeviceOS 1.5.0-rc.2 - (assumed device auto updated to DeviceOS 1.5.0-rc.2) - display issue as documented in this ticket - breathing white
    FYI compiled to text size 108,044 bytes

Given the woes above, also manually updated Device OS using particle flash --usb and then (attempted) updated the bootloader using particle flash --serial (noting that it immediately went into SOS panic #1) after this.

Here is serial inspect output (performed from Safe Mode) for the record:

Platform: 8 - P1
Modules
  Bootloader module #0 - version 501, main location, 16384 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
  System module #1 - version 1501, main location, 262144 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #2 - version 207
  System module #2 - version 1501, main location, 262144 bytes max size
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #1 - version 1501
      Bootloader module #0 - version 400
  User module #1 - version 6, main location, 131072 bytes max size
    UUID: D3FECAC99EA6FEDCD0408A26E376A946AA9D5C102B75087F5A0B306A4D62B566
    Integrity: PASS
    Address Range: PASS
    Platform: PASS
    Dependencies: PASS
      System module #2 - version 1501

Conclusion

@avtolstoy, it seems that there is still an issue with rc.2 in my use case.

Let me know what you would like me to do.

@avtolstoy, have some good feedback for you now after adding debug to the AdaFruit SSD1306 lib.

The freeze is happening straight after the first call to SPI.transfer().

Here is the call tree:

display.begin() 
>> set up pins 
>> set up SPI eg SPI.setBitOrder(MSBFIRST);
>> SPI.begin(SPI_MODE_MASTER, cs);
>> reset the display controller IC
>> SPI.beginTransaction(__SPISettings(...));
>> ssd1306_command(SSD1306_DISPLAYOFF);
>>>> set pins for chip sel and command
>>>> SPI.transfer(data);    <=========== FREEZES HERE

>> ssd1306_command() .... lots more commands
>> SPI.endTransaction()

Can you suggest a code fix for this issue or is it only fixable at the DeviceOS level?

@TrikkStar, this may give you assistance in with your similar problem Updating from DeviceOS 1.4.4 to 1.5.0-rc.2 -> Broken SPI Functionality

Just a note - posting to the forum is not considered a “ticket”. You need to mail support@particle.io to create a ticket in the system.
You can also head to https://support.particle.io/ to file a ticket.

1 Like

@no1089, thanks, got it, is a “post”.

Problem remains nevertheless…

Got it, just setting expectations :slight_smile:
I have this listed and will check from my side tomorrow. I’ll run it through the debugger and :bug: engineering about it.

@no1089 have you had any luck in tracking down this issue? Should I raise a formal ticket for this?

Sorry about the delay - it slipped past me last week.


:point_up: This should be the fix, but an engineer is looking into the issue.

1 Like

@no1089 excellent! I will test as soon as the updated DeviceOS is released and report back.

@TrikkStar hopefully good news for you too.

1 Like

I have a possibly related issue with getting Adafruit_HX8357 to build with 1.5.0-rc.2 using the workbench. The details are on this topic thread. TFT Display with Custom Fonts
Thanks

@armor, re TFT Display with Custom Fonts, you said that you are having problems building. This will not be related to this post which is about an SPI issue with
DeviceOS 1.5.0-rc.1 and rc.2.

My guess is that if you do get it to successfully compile under DeviceOS 1.5.0-rc.1 and rc.2, you will then get SPI runtime issues noted in this and other posts.

The SPI deadlock that occurs with 1.5.0-rc.2 has been reproduced and will be fixed before the final 1.5.0 release.

2 Likes

Rick, accepting the runtime issue with SPI and 1.5.0-rc.1 and 2, why am I seeing issues with building an application that builds and works OK with 1.4.4 but does not build with 1.5.0-rc.2? The build issues appear to be SPI related?

I can’t tell why you are having the build issue in the other post.

There is the known problem below, which used to compile but now causes an error. I believe this will be fixed as well. (It can be fixed with a cast, in the interim. This is I2C not SPI, but several libraries like the SSD1306 libraries support both.)

../wiring/inc/spark_wiring_i2c.h:108:10: note: candidate: size_t TwoWire::requestFrom(uint8_t, size_t)
   size_t requestFrom(uint8_t, size_t);
          ^
../wiring/inc/spark_wiring_i2c.h:110:10: note: candidate: size_t TwoWire::requestFrom(int, int)
   size_t requestFrom(int, int);
          ^
2 Likes

Really happy to report that we have case closed on this issue after the update to DeviceOS 1.5.0 due to the great work of @avtolstoy.