OLED + Goldilocks - help! (And line across screen)

An advanced Arduino-compatible board with ATmega1284P and ATmega32u2 MCUs for experienced users. More RAM than a Mega, but in a convenient Uno-style form factor. [Product page]
Post Reply
BlueFusion
Posts: 2
Joined: Sat Sep 28, 2013 4:11 pm

OLED + Goldilocks - help! (And line across screen)

Post by BlueFusion » Sat Sep 28, 2013 4:34 pm

Hiya,
Please go ahead and move this to the Goldilocks subforum if that would be better- but this issue seems to be related to the oled.

I've got my oled wired up via a protoshield, and it works fine - the drawing & text examples, and the sprite loaded into progmem all work great. However I just tried the demo_logo and i'm having issues.

I changed the chip-select to use the SD socket built into the Goldilocks, rather than the OLED. I tried the card info demo from the SD lib and the card reads fine, and enumerates the Label.bmp on the sd card, so the card side of things seems to be fine. However in demo_logo, I get "Label.bmp not found".
Doing some comparing with the cardinfo sketch, I added the line

Code: Select all

card.init(SPI_FULL_SPEED, pin_sd_cs);
right after oled.begin. Now, it works; upon booting it draws the bottom 8 or so pixels of the bmp, then paints the rest of the screen with grey lines, then paints a darker grey line right along the bottom.
https://dl.dropboxusercontent.com/u/57010/DSCF2873.jpg
Image
https://dl.dropboxusercontent.com/u/57010/DSCF2874.jpg
Image

Any suggestions?
To get this far I already tried formatting the sd card (no effect), SPI_HALF_SPEED instead of full (no effect), and re-initialising the oled after the card.init (which causes label.bmp not found again).
Thanks!

Edit:
I've also noticed thanks to somebody else with the FTOLED that the line across the screen about 3/4 of the way down is permanent, not part of the BMP issue... it appears when I paint a full white screen. Anybody else with this issue?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: OLED + Goldilocks - help! (And line across screen)

Post by angusgr » Sun Sep 29, 2013 11:33 pm

BlueFusion wrote:Any suggestions?
To get this far I already tried formatting the sd card (no effect), SPI_HALF_SPEED instead of full (no effect), and re-initialising the oled after the card.init (which causes label.bmp not found again).
Sorry to hear you're having problems with the SD card.

There are a few things that could be causing this, but it sounds like an SPI data corruption issue - the bus is solid enough to sometimes work, but sustained data transmission causes problems.

Do you get the same symptoms if you use the SD card socket on the OLED module itself?

Have you made any of the optional Goldilocks modifications to join the SPI buses between the 1284p and the 32u2 onboard?

Do you have a different MicroSD card handy that you can try?

Is your Goldilocks a standard one or "overclocked" 22MHz?

Finally, I've written a quick sketch to calculate the CRC32 and length of the Label.bmp file from the demo_logo example. It will run over and over so you can look for patterns in the output if you're getting occasional/consistent data corruption.

You can get the sketch from here.

The output should look something like this, with the second part repeated over and over, if the SD card works:

Code: Select all

Initialising SD card...
SD card initialised.
Opening file Label.bmp
Calculating CRC...
CRC32 is 0xAFEEA2CC
File length was 32906
Can you try this and note the output (and any variation)
  • On the setup you have now (SD card in Goldilocks, OLED mounted on protoshield.)
  • With the protoshield removed so it's just the Goldilocks, no OLED attached.
  • With the SD card mounted in the OLED module instead of the Goldilocks' SD card slot
(As you know you'll have to swap the PIN_SD_CS value in the sketch depending on the SD card connection.)

This should narrow it down to a Goldilocks issue or an OLED issue. Thanks for your patience with this.
BlueFusion wrote: I've also noticed thanks to somebody else with the FTOLED that the line across the screen about 3/4 of the way down is permanent, not part of the BMP issue... it appears when I paint a full white screen. Anybody else with this issue?
Yes, unfortunately this is an artifact of the way the display does its scan updates. It's only visible when you display a solid block of colour.

BlueFusion
Posts: 2
Joined: Sat Sep 28, 2013 4:11 pm

Re: OLED + Goldilocks - help! (And line across screen)

Post by BlueFusion » Mon Sep 30, 2013 8:28 am

angusgr wrote: Do you get the same symptoms if you use the SD card socket on the OLED module itself?
Have you made any of the optional Goldilocks modifications to join the SPI buses between the 1284p and the 32u2 onboard?
Do you have a different MicroSD card handy that you can try?
Is your Goldilocks a standard one or "overclocked" 22MHz?
In that order:
I'll try that now,
No,
Maybe, but I don't think so,
Standard.
angusgr wrote:
  • On the setup you have now (SD card in Goldilocks, OLED mounted on protoshield.)
  • With the protoshield removed so it's just the Goldilocks, no OLED attached.
  • With the SD card mounted in the OLED module instead of the Goldilocks' SD card slot
Result with existing setup and with protoshield removed are both the same after several minutes of iteration:

Code: Select all

Opening file Label.bmp
Calculating CRC...
CRC32 is 0xAFEEA2CC
File length was 32906
I didn't bother wiring up the sd socket on the oled to the protoshield, but I'll do that now and edit this post in a few minutes with the result.
angusgr wrote: Yes, unfortunately this is an artifact of the way the display does its scan updates. It's only visible when you display a solid block of colour.
That is unfortunate, thanks for the answer though.

Edit: fixed??
It works fine now (logo demo sketch) with the sd socket on the oled. I actually tried it with the sd in the goldilocks, without changing the chipselect pin assignment, and it also works...
(without the extra line of code I added)
I also forgot to change the pin assignment in your crc sketch to 14 for the Goldilocks, left it on 4 for the oled, and it still worked.
What's going on here? Is the goldilocks documentation wrong about the cs pin?
I've tried it several times, and it works reliably in either socket, with the cs pin set to 4 for the protoshield+oled.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: OLED + Goldilocks - help! (And line across screen)

Post by angusgr » Mon Sep 30, 2013 10:26 pm

BlueFusion wrote: Edit: fixed??
It works fine now (logo demo sketch) with the sd socket on the oled. I actually tried it with the sd in the goldilocks, without changing the chipselect pin assignment, and it also works...
(without the extra line of code I added)
I also forgot to change the pin assignment in your crc sketch to 14 for the Goldilocks, left it on 4 for the oled, and it still worked.
What's going on here? Is the goldilocks documentation wrong about the cs pin?
I've tried it several times, and it works reliably in either socket, with the cs pin set to 4 for the protoshield+oled.
Hi BlueFusion,

I just checked the Goldilocks schematic, and the CS line for the MicroSD is indeed pin 4. Sorry for the inconvenience, I'll get the Goldilocks User Manual updated ASAP.

If you're interested in the gory technical details: the voltage shifting (3.3V) resistors on the MicroSD CS (Chip Select aka Slave Select) line will keep it pulled down if it is unused. Pulled down is asserted, so effectively CS is always on if it's not set correctly. This means the MicroSD is always enabled on the SPI bus. This works fine until you add a second SPI device like the OLED, and then suddenly the MicroSD is receiving commands that are meant for the OLED too (because there's no CS line to disable it while talking to the OLED.)

Thanks for your patience working through the issues. As I said we'll have the docs updated ASAP, but you should hopefully find everything works fine if you keep the MicroSD CS line on pin 4 while using the OLED.

Please let us know how you get on.

Regards,


Angus

Post Reply