Atmel 2560 SPI interface with OLED display Failure

This is a really weird situation.
The design is an Arduino Mega 2560 Pro-mini board that, amongst other SPI peripherals, drives .96" OLEDs. To reduce current draw on the original OLED's, I decided to use the Data(MOSI) & Clock on the 3.3V side of a BSS138 type level shifter.
The level was required to connect a Flash Chip (25Q128). The 5V side is connected to a microchip SRAM (1Mbit) which requires that voltage.

I have reproduced this circuit (on PC Cart PCBs) a couple of dozen times with no problems at all.
I then had to order more OLED's to make more units and once those arrived started having problems. More than once I had to re-route the Data & Clock direct to the 5V SPI side to make it work.

Shortly after this I ran out of 2560 Pro-mini boards so ordered more of those. Now the combination of new 2560 boards and new OLED's doesn't work at all! The OLED is wired to the 3.3V side as was always.
The odd thing is, if I use an old 2560 board with a new OLED or a new 2560 board with an old OLED, they both work!! Old & old also work, just new & new won't work properly or sometimes at all.

Connected to the 5 Volt SPI direct, the OLED will start up but only once the pro-mini board or BSS-138 level shifter circuit is warmed up for a while. If cold (room temperature) then appears to start as speckles on the screen but seems to cause errors on the SPI as the Flash chip won't load properly.
Then, as it warms up, the Flash starts to load properly but there are glitches in the display as it is updated. Once all toasty (from the reg heating up) everything works, but only with the 5 Volt Data & clock modification.

The OLED parts are identical AFAIK but from different sources ( and time + 1year ) in China. I have some more on order so hopefully this solves the problem or I am going to have to brick the whole 3 year project :frowning:

--As a side note, when the clock & data are on the 3.3 volt side I can pull up (1K to 5V) the clock and the OLED will work for a short while, but then the flash memory on the SPI bus starts to error which causes erroneous behavior of the whole system.

--Another note, I have tried 3 2560 boards and 6 or 7 OLED's from that batch, same result. Totally baffled!

If anyone has any suggestions, thoughts, or ideas I would greatly appreciate it.

use a eInk-Display instead. Much lower current

Too many variables, too many things to test.
It will be extremely difficult and time consuming to help you debug your problems via these forum posts.

How do you have the BSS138 connected? It's a N-channel FET. If you are using only one, it may be inverting the SPI bus.

Thanks for replying, it's one of these Aliexpress 128x64 https://www.aliexpress.com/item/1005003822805278.html?spm=a2g0o.order_list.order_list_main.21.41a31802pVdbvn

The chip (epoxy drop) is SSD 1306 which is in fact a 3.3V chip. Everyone (including myself) uses these with 5 volts as the supply, and for the I/O. In hind sight, I think that some might be internally modified under the epoxy with some level shift or perhaps the ground side is offset to true ground, I don't know. They just worked no problem until now.

Today I received some new Mega2560 Pro-mini boards that seem better quality and using a 1 K pullup on the clock certainly allows the display to work properly, so far it's ok, but the poor flash is taking the hit on clock highs. It does act differently now, I will have to test more.
When it was connected direct to the SPI 5V side it would glitch the display (errors) but only when the USB wasn't plugged in (running off of the 2560 boards regulator) go figure.

That would be nice but I have manufactured 50 of these lol. E-ink is too slow as well unfortunately. I will be using color LCDs in future designs. I'm tired of screen savers etc with OLED burn-in

Check this out BSS138 MOSFET Datasheet : Working and Its Applications
done it for years, but maybe this has passed it's limit :expressionless:

Hi Jim, thanks for chiming in. You are right. I was just hoping there was someone out there experiencing a similar problem lately.
As this circuit, which is quite complex overall, has worked 100% flawlessly for 2 years and dozens of finished units that are still working, it's very unusual that suddenly with those 2 new parts it's not. It's one or the other, or both as I'm beginning to suspect. Can't wait for the new OLEDs to arrive!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.