element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 4: Draw, Write and show Bitmaps
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 25 May 2018 6:58 PM Date Created
  • Views 1955 views
  • Likes 6 likes
  • Comments 7 comments
  • hercules_launchpad
  • lcd
  • boosterpack
  • hercules
  • safety
Related
Recommended

Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 4: Draw, Write and show Bitmaps

Jan Cumps
Jan Cumps
25 May 2018

This blog series explains how to use the Educational BoosterPack LCD with a Hercules LaunchPad.

The Educational BoosterPak MKII is a hot item. It has many sensors on board. and a joystick, a buzzer, a 3-colored LED, buttons and a microphone.
And also a very nice color LCD screen.

The blog series shows how to drive the BoosterPack's LCD from a Hercules microcontroller.
This post assumes you've done the preparation steps from the first 3 posts.

I've received both LaunchPad and BoosterPack from TI.
For the impatient: I've attached the CCS project to this blog.

image

Download the LCD library

The library is an as-close-as-possible port of the Energia library for this display.
I've published the source on github.

The simplest way to get at the code is to download my repository, and copy the HX8353E folder that can be found under hercules_libraries-master/lcd_hx8353e in the root of your project.
Take care that you add both HX8353E and HX8353E/bitmaputils to your includes in the project properties.

If you use the project that's available by clicking the doload button at the top of this blog, that's already done for you.

Configure the MIBSPI driver

Our display is connected to the pins of Hercules MIBSPI3. The display requires three additional pins to drive the backlight, a data/command selector and a reset line. These have been discussed and configured in blog 2 and 3.

image

That means that for SPI, we have to configure the clock, MOSI and CS (the display's chip select is connected to CS number2).
We don't need MISO, because the display never sends anything back to us.

First enable the MIBSPI3 driver. We use buffered SPI - we take advantage of that buffer mechanism when displaying bitmap images.

image

Then enable the Pin Multiplexing for the three SPI lines. This is additional to the PINMUX activities from post 2 and 3.

image

We're using 2 MIBSPI data formats. One to send 8-bit data. The other for 16-bit.

In the settings below, I've put the moderate line speed of 8000. I've had success with settings up to 30000.

image

Don't forget to set the clock polarity flag. That's the one that takes care that the data is set up as expected by the LCD (SPI Mode 0).

These two data formats are used in our transfer groups.The library uses three groups. One for 8-bit single shot, one for 16-bit single shot and the last one for a buffered stream of  64 16-bit values.
The two 16-bit groups use the same data format.

image

The last setting is to make our 3 SPI lines functional and make them outputs. As indicated before, we don't need MISO in our scenario.

image

Demo

The CCS demo project is available as a zip archive attached at the end of this blog.
The demo draws lines, circles, triangles, text and a bitmap.
Put the BoosterPack jumper J5 on pins 2 and 3. That is needed to drive the LCD backlight. If you see the red light very bright on the boosterpack, it means you have J5 wrong.

image

Here's a snippet of the demo's main file.

It does exact the same as what you see on tha animation above:

  • It clears the LCD to an orange background.
  • Then two diagonal blue lines.
  • A white circle and a blue filled rectangle and an unfilled one in the middle.
  • Clear the screen with black background.
  • Type text in white and yellow, using the smallest font.
  • Clear the screen again and draw a full screen bitmap.

Rinse and repeat.

 

/* USER CODE BEGIN (1) */
#include "HX8353E.h"
#include "bitmaputils.h"
/* USER CODE END */

 

void main(void)
{
/* USER CODE BEGIN (3) */
    // initialize LCD
    screenInit();
    screenBegin();

    while(1) {
        clear(orangeColour);
        line(0, screenSizeY()-1, screenSizeX()-1, 0, blueColour);
        line(0, 0, screenSizeX()-1, screenSizeY()-1, blueColour);
        delay(500);
        circle(screenSizeX()/2, screenSizeY()/2, 30, whiteColour);
        delay(500);

        setPenSolid(true);
        triangle(screenSizeX()/2-20, screenSizeY()/2 - 20, screenSizeX()/2 + 20, screenSizeY()/2 - 20, screenSizeX()/2, screenSizeY()/2 + 20, blueColour);
        delay(500);
        setPenSolid(false);
        triangle(screenSizeX()/2, screenSizeY()/2 - 20, screenSizeX()/2 - 20, screenSizeY()/2 + 20, screenSizeX()/2 + 20, screenSizeY()/2 + 20, blackColour);
        delay(500);

        clear(blackColour);
        setFontSize(1);
        uint8_t text1[] = {"Hercules"};
        uint8_t text2[] = {"LaunchPad"};
        uint8_t text3[] = {"Educational"};
        uint8_t text4[] = {"BoosterPackMKII"};
        gText(4, 4, text1, 8, whiteColour, blackColour, 1, 1);
        gText(4, 25, text2, 9, whiteColour, blackColour, 1, 1);
        gText(4, 72, text3, 11, yellowColour, blackColour, 1, 1);
        gText(4, 93, text4, 15, yellowColour, blackColour, 1, 1);

        delay(500);
        clear(blackColour);
        delay(500);
        drawHerculesMCUs();
        delay(1000);
    }
/* USER CODE END */
}

 

Bitmaps

I've prepared the bitmaps with LCD Image Converter. This utility creates C arrays from 24-bit bitmap files.

Make a 128*128 px image. Import it in de converter. Replicate these settings

image

The RM46 is a little-endian device.

image

Push preview, and copy the content of the popup window.

image

You can paste it over the HerculesMCUs[] array in the file bitmapdemo/16bitdemo.c.
The firmware will then show your image.

Have fun.

Blog Series
Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 1
Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 2: GIO configuration
Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 3: PWM for the backlight
Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 4: Draw, Write and show Bitmaps
Attachments:
RM46_BOOSTXL-EDUMKII-LCD_BITMAP.zip
  • Sign in to reply

Top Comments

  • DAB
    DAB over 7 years ago +3
    Nice update Jan. DAB
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to shabaz +3
    shabaz wrote: Hi Jan, ... That BoosterPack looks really interesting, clearly plenty of scope for student projects, but also fun for games or for controlling (say) motorized stuff. Yes, this BoosterPack…
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to genebren +2
    genebren wrote: I look forward to future update and so far I have thoroughly enjoyed this series. Gene It's finished . Four short blogs but it took me months of work at the time to make it work. I struggled…
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to shabaz

    shabaz  wrote:

     

    Hi Jan,

     

    ...

    That BoosterPack looks really interesting, clearly plenty of scope for student projects, but also fun for games or for controlling (say) motorized stuff.

    Yes, this BoosterPack has a good mix of hardware. If you're an embedded programmer and want to learn GPIO, PWM, ADC, I2C and SPI, there's enough on board to get you busy for a while.

    Also if you're learning about sensors, there are a few good ones available.

    What I like in particular is that you can build real world designs with it.

     

    I'm not 100% happy though. Why share one of the colours of the RGB LED with the backlight of the LCD. You can't use those together. Come on. There were pins left.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 7 years ago

    Hi Jan,

     

    Very impressive work! Nice to see that board running with the Hercules LaunchPad.

    That BoosterPack looks really interesting, clearly plenty of scope for student projects, but also fun for games or for controlling (say) motorized stuff.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 7 years ago

    Those are seriously fast updates on the screen.  Thanks for the link to the LCD image converter.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Nice update Jan.

     

    DAB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to Jan Cumps

    Here is that DMA story: High Throughput SPI traffic part 1a - Buffers and DMA

     

    It gave this funny wrong picture on the display:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube