OLED Display Application Example using LPC845 Breakout Board and SPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OLED Display Application Example using LPC845 Breakout Board and SPI

OLED Display Application Example using LPC845 Breakout Board and SPI

This is a quick introduction that shows how to interface the LPC845 Breakout Board with an OLED display based on the popular SSD1306 controller, using SDK drivers for SPI. With this application, you can print a text string or draw a bitmap image.

 

SPI Protocol

The Serial Peripheral Interface (SPI) protocol is asynchronous serial data standard, primarily used to allow a microprocessor to communicate with other microprocessors or ICs such as memories, liquid crystal diodes (LCD), analog-to-digital converter subsystems, etc.

 

The SPI is a very simple synchronous serial data, master/slave protocol based on four lines:

      • Clock line (SCLK)

      • Serial output (MOSI)

      • Serial input (MISO)

      • Slave select (SS)

 

Adafruit Monochrome OLED Graphical Display

This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is required. This reduces the power required to run the OLED and is why the display has such high contrast; we really like this miniature display for its crispness!

 

 

OLED Display Example

NXP provides an example package for the LPC845 Breakout that includes projects to use the principal's peripherals that the board include: ADC, I2C, PWM, USART, Captouch, and SPI

 

What we need:

 

Once downloaded, we import the library project into the workspace using the ''Import project(s) from file system... from the Quickstart panel in MCUXpresso IDE:

Import project.png

Figure 1. Import Projects.

 

Then browse the examples packages archive file:

Fig 2. Select package.png

Figure 2. Select Example Package.

 

Press next, and see that are a selection of projects to import, in this case, only keep select the LPC845_BoB_OLED how it looks in the picture below:Fig 3. Select OLED project.png

Figure 3. Select the OLED Project.

 

Press finish and the project example shows up in the workspace:
Fig 4. OLED project.png

Figure 4. OLED Project in workspace.

Create Bitmaps

Bitmap (BMP) is an image file format that can be used to create and store computer graphics. A bitmap file displays a small dots in a pattern that, when viewed from afar, creates an overall image. A bitmap image is a grid made of rows and columns where a specific cell is given a value that fills it in or leaves it blank, thus creating an image out of the data.


First, you have to create the image using any kind of graphics software such a paint, Photoshop, etc and save the picture as Monochrome Bitmap (bmp), make sure that the image size match whit the OLED size.  

 

 

Fig 7. Save picture as Bitmap in paint.png

Figure 5. Save picture as Bitmap.

 

Now inside the LCD software assistant, this program will help us to convert an image from Bitmap to data array, we have to load the image by click on file >> load image, and select the appropriate size.

 

Fig 8. LCD assistant.png

Figure 6. LCD Assistant 

 

To import the array go to file >> save the output, choose the place where are going to save. Then inside the example, go to fsl_Font5x7.h and paste the array.

 

Fig 9. Data array.PNG

Figure 7. Data Array.

 

   *Note: Inside the example, the array for the NXP logo is already there, if you want another image, delete this array and pas the new.

 

Connections

Now, with the project already in the workspace, it is time to set up the connection between the LPC845 Breakout board and the OLED Display. The table below shows which LPC845 Breakout pin are routed each line of the SPI interface and the pins for reset and Data/Command select.

 

Table 1. Connections.PNG

Table 1. Connections.

 

You can check the Datasheet of the board, of bases on the picture below to see where the pin are, note that GND and 3.3V also needed for the OLED display:

Fig 5. LPC845 to OLED connection.png

Figure 8. LPC845 Breakout to OLED Connection.

 

Debug.

Now, with the demo in the workspace and the connections done, connect a micro USB cable from connector CN2 to a host computer and debug the application.

 

SPI demo.jpg

Figure 9. Run example

Labels (1)
No ratings
Version history
Last update:
‎01-15-2019 10:15 AM
Updated by: