This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

customised spi interface to an OLED display

Hello all,

I wanted to start a mini project which uses the TM4C launchpad and an OLED as a simple display device. The OLED is a 128x64 display which is hardwired for 4-wire SPI and uses an SD1306 controller. Although I'm not brand new to microcontrollers, I am definitely still a beginner who requires some guidance. I would like to set up the appropriate serial interface so I may display characters on the OLED (then later graphics) using my own code as opposed to using the driver library. I know this is ambitious for someone at my level but I'm really keen for a deep understanding of how to control the microcontroller and it's peripherals. I have started reading about the SSI interface in the datasheet and am still feeling like I am missing something. Any suggestions how to approach this problem and any resources are appreciated.

  • Hi,

    Several good resources:

    a) Jonathan Valvano site: http://users.ece.utexas.edu/~valvano/

    b) Josep Yiu book about Cortex-M3-M4 on Amazon

    c)  If you feel something is missing about SSI, just ask here specific to get responses.

    Petrei

  • Thank you Petrei, I have got Valvano's books and Joseph Yiu's book. I was wondering about a few aspects of initialising the SSI interface.

    The GPIO port that is configured for SSI must have the digital function enabled with the GPIODEN register. The databook then goes onto say that the pull-ups/pull-downs, drivestrength and drain select must be configured. I have looked at a few example pieces of code from Valvanos book which interface to an ADC. He follows for the most part the initialisation routine outlined in the databook, but he doesn't turn on any pull-ups, specify drive strength or drain select. Has he made a mistake or can I get away with leaving those settings untouched?

    Which frame format is most suitable for a 4-wire SPI interface? The OLED controller accepts data in on the rising transition of the clock and has a minimum cycle time of 100ns. I'm assuming this means a max SPI clock frequency of 10MHz.

    I think the only pins I need is the transmission line, Sclk and a  GPIO that can be used as a control line to the OLED controller. This control line is sampled on the last bit of the frame and determines whether the frame is interpreted as a command or data. For implementation, can I leave out the Fss pin altogether? something tells me it has some sort of significance.

    Lastly, How is a transmisiion initialised? Do you just place the data inside the Tx FIFO buffer and the transmission is automatically initialised or is there more to it.  

    Thank you for all the suggestions and help

     

  • Hi,

    Usually, with GPIO configuration, you do not need to do much - just configuring as "standard" will enable the right things. Only when needed, you may specify PU/PD.

    As for ADC, this is special - no need to link with anything else, since this may disturb/modify your circuit -remember it should be a "true voltmeter" with high impedance (well, really is not so "high") so Valvano is right. Please note also the hardware circuitry - you have special pins AVDD, AGND and reference to isolate as much possible the analog circuits from the noisy digital ones.

    For SSI - it is simple - to start sending something, just load the SSI data register and the sending process is started automatically and ended also automatically if no other word in sending FIFO and a small amount of time has elapsed.

    The FSSI pin can be used as automatically managed by SSI module or manually if you configure it as standard GPIO.

    The frame type is usually Freescale (many devices uses that) but each manufacturer try to avoid names from other brand(s) so they explain in terms of rising/falling edges of data and clock so you must identify which one specified by manufacturer matches one of the four configurations of Freescale (usually either 0 or 3, but this is not the rule, only checking the data sheet will be the best approach).

    Petrei

  • Thank you Petrei. That is extremely helpful. I'm going to experiment a little bit and see if I can get an interface cranking.

  • May I add a note of caution as regards use of a graphic OLED as, "simple display device?"   (heart-beat rises, flop-sweat reappears - each/every time, "simple, easy, quick" is voiced by boss/client/mother-in-law...)

    That OLED surely has an internal or requires an external voltage "boost" to properly illuminate/display.  Usually - but not always - you must provide an additional logic signal to enable/disable the (likely) OLED charge-pump (voltage boost) or similar.  Be especially cautious "not" to miswire/connect and thus route this higher voltage back to your MCU nor any other IC/circuitry - not expecting (nor welcoming) such elevated voltage.  (we've seen this @ clients - more than once)

    In addition - depending upon OLED control IC - you may have to perform some OLED initialization "prior" to enabling the OLED's voltage boost.  (violating this caution may damage your OLED {screen should be ,"row-scanning" nicely prior to (relative) HV introduction})

    That resolution OLED may well employ color or multi-level pixel gray-scale - adding complexity.  Long in the display biz - may we suggest that you "start" w/single color (or single gray level) until your basic display code is somewhat proven.  As always "KISS" proves spectacular as time/effort "saver" (and OLED saver!)

    And lastly - that "simple" display suffers, "image burn-in!"  You'll "simply" have to detect and then prevent any screen image from persisting too long!  Simple indeed...

  • Haha, yes. It would appear that the OLED is not as simple as one would think. However, I have tried very hard to search for a good tutorial on how to correctly use it with no such luck. I always get a highly technical document that goes mostly over my head. On the other hand, the company from which I bought the device( embedded adventures) has hard wired the board giving it a single vcc and gnd pin and specified the correct voltage. Although this device still eludes me, I'm hoping to learn more about it by trying to get it to work. If you know of any good resources that maCOBE of any help it would be much appreciated.

  • Hello Richard,

    Except for the controller part number, is there a specification of the OLED Display?

    Regards

    Amit

  • http://www.embeddedadventures.com/datasheets/OLED-12864_family_doc_v1.pdf.

    Hey Amit, this link provides the data sheet giving small bits of info on the specific device. I found it a little bit short to be honest. 

  • Richard Morawski said:
    He follows for the most part the initialisation routine outlined in the databook, but he doesn't turn on any pull-ups, specify drive strength or drain select. Has he made a mistake or can I get away with leaving those settings untouched?

    Just on this point.  Most microcontrollers do not give you control over pullup, drive strength etc.. except on possibly a few pins.  The author was simply following the most common usage.

    Robert

  • Hello Richard

    I think the OLED datasheet is a condensed specification, but this is the actual device to look out for

    http://www.adafruit.com/datasheets/SSD1306.pdf

    Regards

    Amit

  • Thank you all for your help