element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • 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
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 2: GIO configuration
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 24 May 2018 12:52 PM Date Created
  • Views 447 views
  • Likes 7 likes
  • Comments 2 comments
  • hercules_launchpad
  • educational_boosterpack
  • boosterpack
  • hercules
  • safety
Related
Recommended

Educational BoosterPack MKII and Hercules LaunchPad - LCD Driver part 2: GIO configuration

Jan Cumps
Jan Cumps
24 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 first post was an intro to my driver library for that LCD. This time we'll do the first easy steps: We'll use the Hercules Generic I/O module to control the LCD behavior.

image

The LCD signals

Next to the power supply, we have to control 3 types of signals to the LCD.

  • A Reset and Data/Command line. Two lines that determine the behavior of the screen.
  • A signal that controls the intensity of the backlight,
  • and a set of 3 signals for the communicaton of data and commands.

In this blog, we'll dive into the Reset and Data/command line.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Generic I/O

Like all microcontrollers, Hercules has a set of generic input/output pins (GIO). These are pins that we can directly control from within our firmware. We can drive them high and low.
In our library, we will not use any input lines. Our LCD screen is an output design. We don't need to read any signal from that LCD. We only write to it.

There are two signals on the LCD driver that are go candidates for GIO control: The reset and the data/control signal.

image

The reset signalis called nRST (in the schema, you see that there's a line above the RST characters. That means that the signal is active low.

If we drive the GIO pin that's connected to that signal high, the LCD is not in reset, if we drive the signal low, we reset the LCD display.

When we read the schematic of the BoosterPack, we see that this signal is connected to connector J2, pin 17.

image

The data/control signal switches the LCD between two modes. Listen to commands, or accept data.
An example of a command is: invert the screen, set resolution, ...
The name of the signal is D/nC (the character C in the schema has a line above it).
This indicates that when we have to set the signal high in the firmware when we want to send data to the display. When we want to send a command, we have to pull the signal low.

The D/nC signal is connected to J4, pin 31

Hercules GIO configuration

We'll mount the Educational BoosterPack on the leftmost postion of our hercules LaunchPad. We can then see what LCD signals match what Hercules pins.
That nRST position matches with the Hercules pin 3 of GIO port B.
The D/nC signal connects to pin 0 if port A.

We'll have to enable the GIO module in HALCoGen, verify that the multiplex options for those pins are set to GIO, and set both pins as type output.

image

On the PINMUX screen, you see that one particular pin of your microcontroller can serve multiple purposes. We assign the I/O function to the pins that are connected to GIOB[3] and FIOA[0].

image

Last action is to set both pins to output

image

HALCoGen will generate the firmware code to put our Hercules controller's GIO block in the correct status. It will set the right bits in the right registers to activate GIO, set the multiplexing and set the I/O direction of our two pins to output.
It will also generate a GIO API for us. A set of functions that help us to work with those pins.

We'll use two of those functions. One to initialize the GIO hardware( apply the settings we've clicked in HALCoGen). And one to drive our nRST and D/nC lines high and low.

Firmware

The full source of library and example is attached to the first post, as a Code Composer Studio project. The HALCoGen configuration files can be found in the HALCoGen folder of the project.
The parts of the source where we use the GIO functions are in the LCD library folder, HX8353E.

In HX8353E.c, we first include the GIO API definitions:

#include "HX8353E.h" 

gioPORT_t *_portReset; // the port the signal line is on 
uint32_t _pinReset; // the pin the signal line is on 
gioPORT_t *_portDataCommand; // the port the signal line is on 
uint32_t _pinDataCommand; // the pin the signal line is on 

_portReset = gioPORTB; 
_pinReset = 3; 
_portDataCommand = gioPORTA; 
_pinDataCommand = 0;

 

In the lib's screenInit() function, we prime the GIO module:

gioInit();

 

And in several places of the code, we drive the nRST and D/nC:

    gioSetBit(_portReset, _pinReset, 1);
// ...
    gioSetBit(_portReset, _pinReset, 0);
// ...
   gioSetBit(_portDataCommand, _pinDataCommand, 0);

 

That's how we control those two GIO signals. Have a read into the screenInit() and screenBegin() functions of the library. Try to understand what's happening there.

 

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

 

  • Sign in to reply

Top Comments

  • genebren
    genebren over 5 years ago +1
    Another great blog. Thanks for sharing your project. Gene
  • DAB
    DAB over 5 years ago +1
    Nice update Jan. DAB
  • DAB
    DAB over 5 years ago

    Nice update Jan.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 5 years ago

    Another great blog.  Thanks for sharing your project.

    Gene

    • Cancel
    • Vote Up +1 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 © 2023 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube