element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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
Avnet Boards Community
  • Products
  • Dev Tools
  • Avnet Boards Community
  • More
  • Cancel
Avnet Boards Community
Avnet Boards Blog Summer of FPGA: Using the Mikroe LCD Click Mini on the Ultra96-V2 - Part One
  • Avnet Boards Blog
  • Forums
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Community to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Andrew J
  • Date Created: 3 Sep 2021 6:43 PM Date Created
  • Views 5543 views
  • Likes 11 likes
  • Comments 18 comments
  • ultra96-v2
  • lcd mini click
  • click mezzanine
  • summer of fpga
Related
Recommended

Summer of FPGA: Using the Mikroe LCD Click Mini on the Ultra96-V2 - Part One

Andrew J
Andrew J
3 Sep 2021

I want to build on the design created in Workshop 4 of the Summer of FPGA series with the Ultra96-V2.  That workshop created a design to use the UART click board and a PWM IP to drive the backlight on a LCD Mini Click board.  The foundation of what follows is that design, and I'm assuming that if you are following along, you have that in place and you can fill in the simple blanks without me describing them in detail.  I have additional useful posts associated with that workshop:

https://www.element14.com/community/groups/fpga-group/blog/2021/08/27/summer-of-fpga-workshop-4-elaborating-on-the-workshop-design

Summer of FPGA, Workshop 4: Elaborating on creating custom IP

 

EDIT 17th December 2021: I wrote my own driver code, but MikroElektronika have now released a C library to drive this click board: https://github.com/MikroElektronika/mikrosdk_click_v2/tree/master/clicks/lcdmini

  • Introduction
  • Schematics
    • LCD Click Mini
    • Click Mezzanine
    • Ultra96-V2
  • Limitations
  • Datasheets
  • Block Design
    • Block Design
  • Setting Constraints
    • Pin Mappings for Constraints
  • Final Vivado Steps
  • Create the Application in Vitis
  • Sanity Test
  • Scope Test
  • Test Code
  • Next Steps

 

Introduction

The LCD Mini Click is a 2 line LCD from Mikroe which plugs in to a Click Mezzanine which, in turn, clicks into the 40-pin low speed header on the Ultra96-V2 board.  In this post, part one, I'm going to create a test build that will create a SPI output via the PL on the Ultra96-V2.  The intention isn't to drive the LCD Mini Click but to ensure I have a working hardware build and test application that will generate an SPI signal.

 

In Part Two, to follow, I'm going to extend the workshop 4 design with the work accomplished here to actually drive the LCD through its SPI interface via the PL on the Ultra96-V2.  The PL design created here will be incorporated and the test application extended to actually include the right commands to operate the LCD Mini Click and display information on it.

 

Schematics

It's worth checking out the schematics to determine how the Ultra96-V2, Click Mezzanine and LCD Mini Click will interface at the pin level.

 

LCD Click Mini

https://download.mikroe.com/documents/add-on-boards/click/lcd-mini/lcd-mini-click-schematic-v101.pdf  PDF document

image

The Click Board uses SPI to interface so the MikroBus pins I'm interested in are CS, SCK and MOSI.  The PWM pin is already covered by the existing design so I'm not exercising that here.  The LCD Mini Click contains a digital potentiometer to control the LCD contrast and this can also be set through the SPI interface with its Chip Select is connected to the AN pin on the MikroBus, but see limitations below.

 

Click Mezzanine

https://www.avnet.com/opasdata/d120001/medias/docus/197/HW_Click%20Mezzanine_v103_Output%20Files_PDF_Click%20Mezzanine_v103_Schematic.PDF PDF document

image

It's a bit small when viewed as an image but the header J1 connects to the Low Speed Header on the Ultra96-V2 board.  The pins on the header are all passed through a level shifter before they are used by the parts on the Mezzanine Board.  I will be using the LCD Mini Click on MikroBus slot 1 so the pins I'm interested in are SPI_CS1, SPI_SCK, SPI_MOSI.  Tracing these along the bus through the level shifter, these map to SPIO_CS, SPIO_SCLK and SPIO_DOUT which are pins 12, 8 and 14 on header J1.  Note I haven't traced MB1_AN back due to limitations covered below.

 

Ultra96-V2

https://www.element14.com/community/docs/DOC-92273/l/ultra96-v2-rev1-schematic Available on the Element 14 site but you must download it to see all the information.  The on-line viewer doesn't display all the pin identifiers for example.  What I'm particularly interested in is the Low Speed Header and the Banks used to connect to the PL.

 

{gallery} Ultra96-V2 Pin Mappings

image

Low Speed Header, J5:  This matches up to the header J1 on the Click Mezzanine.

image

Bank 501: Contains the LS Header to PS/PL mapping.  All the expected LS pins are on this bank but I'm going to find that this won't work!

image

Bank 26: Contains additional LS Header PS/PL mappings.  I'm going to find that I will need this!

image

Bank 501/Bank 26 Power Rail: Identifies the power rail used, VCCO_PSIO1_501 -> +VCC_PSAUX and VCCO_26 -> +VCCAUX

image

Power Rail VCCPSAUX: +1.8V

image

Power Rail VCCAUX: +1.8V

Limitations

The LCD Mini Click has the ability to control contrast through the on-board digi-pot with its chip select pin connected to AN on the MikroBus.  The AN pins however are not accessible through the Click Mezzanine header, J1.  It might be tempting to think that SPIO_CS2 is used, as CS2 is the label given on the LCD Mini Click schematic.  However that is connected to the Click Mezzanine's on-board ADC (just below MikroBus slot 2 on the schematic) to select it, and the AN pins, MB1_AN and MB2_AN are the analog inputs for conversion.  Thus, the Click Mezzanine board cannot be used to access the AN pins on the MikroBus slots for anything except Analog In from an attached Click Board.  In fact, there is no means at all for the Click Mezzanine to pass through an analog input from a Click Board.  Clearly an assumption in the design of the Click Mezzanine is that the AN pins will only be used for, e.g., Sensor Click boards, and no downstream board would want/need access to an analog input.  In some respects that's ok as it can get converted on-board, however, it makes no sense to not provide access to the MB_AN pins for digital purposes, e.g. CS2 and CS3.

 

So no controlling the display contrast on the LCD.

 

Datasheets

Useful for understanding development.

The LCD is a Topway LMB162XFW module and a readable data sheet is available here.

The LCD is driven through a MCP23017 port expander, data sheet available here.  This indicates the maximum clock frequency is 10MHz.

 

Block Design

For SPI, I want to access through PL, so I'm going to use an AXI Quad SPI IP block and to get going I will create a new, test solution.  I can then incorporate it back into the original design when working. So, create a new Vivado project and create a new block design, drop a Zynq IP and run the board automation.  Next, drop a AXI Quad SPI IP block on the design and double-click to customise it.

image

I will want to operate the LCD Mini Click as a slave, the only one, in standard mode, so this IP will be configured as a Master.  The frequency ratio is a 'divider' for the input clock in order to generate a correct output clock (SCK) frequency.  I'm setting it to 8 because I will add a clock wizard to generate an input clock as a ratio of the Zynq PL clock and this value coupled with the clock wizard clock will give me the frequency I need.

 

Drop a Clock Wizard onto the design and double click to customise it.  The Clock frequency for the LCD Mini Click is a maximum of 10MHz but for my purposes I'm going to run it at half that so that I can avoid any 'edge' issues while I'm testing, at least that's my hope!  I want to take the 100MHz Zynq bus frequency down to 40MHz thus when it is divided by the AXI QSPI Frequency Ratio of 8, I end up with 5MHz:

 

{gallery} AXI QUAD SPI Customisation

image

Clocking Options: Select PLL.  The Product Guide has useful information about the IP.

image

Output Clocks: Set to 40MHz.  The reset pin needs to be active low to be driven from the Processor System Reset.

 

Block Design

It's easier to connect the clk_out1 pin to the ext_spi_clk pin manually, then run connection automation which should hook up the rest of the pins.

image

This is what I ended up with.  I also renamed the output pin to spi from spi_rtl.

 

Setting Constraints

Next, I need to map the SPI output pins to the header pins.  First step is to create a constraints file: under the existing constraints set, create a constraints file called spi_test_constraints and in the Design Hierarchy, set it as a target

image

 

Then create the HDL Wrapper, run synthesis and open the Elaborated Design under the Flow Navigator.  This will display a schematic with the name of the SPI pins that need constraining: these are described in the AXI Quad SPI Product Guide in table 2.2 on page 19.

 

Pin Mappings for Constraints

Using the information from the schematics linked above, I can derive the Pin and IO Standards for the constraints:

AXI QSPI Pin Function Click Mezzanine Header J5 Pin Low Speed Header Bank PL Pin
spi_ssio[0:0] CS 12 MIO41_SPIO_CS Bank 501 B10
spi_sck_io SCK 8 MIO38_SPIO_SCLK Bank 501 C9
spi_io0_io MOSI 14 MIO43_SPIO_MOSI Bank 501 E13
spi_i01_i0 MISO 10 MIO42_SPIO_MISO Bank 501 D12

 

All these pins are on bank 501 so the IO Standard will be 1.8V.  I don't need a MISO pin as I won't be reading anything from the LCD Mini Click but I still need to provide a constraint.  On the menu bar, select IO Planning to add an I/O Ports tab to the bottom of the view and expand it to find the 4 ports to be constrained.

 

Now I have a problem!  The defined pins on the LS Header for the SPI functions I need are already constrained to PS and I can't select them to connect the PL SPI pins.  To get around this, I'm going for a bit of a bodge which I hope will ultimately work.  I'll connect to alternate LS pins, not used by the Click Mezzanine, and cross-connect them with hook up wire to the pins used by the LCD Mini - fortunately the Click Mezzanine provides access to the LS Header from the top of the board.  However, the pins are 0.2mm diameter so standard hook up wire won't fit; fortunately, 26AWG twisted pair does which I have to hand.

 

I can find suitable pins on the LS Header that are connected to Bank 26 and available to connect to the PL SPI pins:

 

AXI QSPI Pin Function Click Mezzanine Header J5 Pin Cross-Connect to J5 Pin Low Speed Header Bank PL Pin
spi_ssio[0:0] CS 16 12 HD_GPIO_9 Bank 26 E6
spi_sck_io SCK 22 8 HD_GPIO_10 Bank 26 D5
spi_io0_io MOSI 18 14 HD_GPIO_11 Bank 26 E5
spi_io1_io MISO 20 10 HD_GPIO_12 Bank 26 D6

 

All these pins are on Bank 26 so the IO Standard will be 1.8V.  The I/O Ports constraints will look like this:

image

And the constraints file contains:

set_property PACKAGE_PIN E6 [get_ports {spi_ss_io[0]}]
set_property PACKAGE_PIN E5 [get_ports spi_io0_io]
set_property PACKAGE_PIN D6 [get_ports spi_io1_io]
set_property PACKAGE_PIN D5 [get_ports spi_sck_io]
set_property IOSTANDARD LVCMOS18 [get_ports {spi_ss_io[0]}]
set_property IOSTANDARD LVCMOS18 [get_ports spi_io0_io]
set_property IOSTANDARD LVCMOS18 [get_ports spi_io1_io]
set_property IOSTANDARD LVCMOS18 [get_ports spi_sck_io]

 

Close the Elaborated Design.

 

Final Vivado Steps

That should be it.  Generate the output products, generate the bitstream and export the Hardware.

 

Create the Application in Vitis

In Vitis, I'll create a new Platform Project, SPI_Test_App, and import the XSA exported from Vivado, targeting a standalone OS on the A53 PSU. In the Board Support Package, I always set the UARTs to psu_uart_1 for the FSBL, Standalone and PMU.  I also build the Platform to save a bit of time later.

 

Sanity Test

I'm going to run a loopback test to perform a basic sanity test on the implementation.  Xilinx provide an example application for this called xspi_low_level_example:

image

This example writes out a number of bytes and then reads them back again, performing a comparison to make sure they are equivalent.  Adding this example, building it and then debugging it - I always create a debug configuration and launch that, breaking at main - gives me a positive result.

image

Not a lot of detail issued, but following the code through, it would only print that success message if the write/read comparison was equivalent.

 

Scope Test

Next, I want to run a test that transmits some data so that I can see it on a scope.  For this, I'm going to use the xspi_polled_example, modified to suit my purposes.  Out of the box, this example performs a self test to make sure that the hardware is built correctly, then performs a loopback test.  I'm modifying it to perform the self test, delete the loopback test, then output some data to Slave 0 (as configured in hardware) 10 times.  Having built this and run it under debug I see the following:

image

Success.  The following images are what were captured on the scope:

 

{gallery} SPI Signals

image

Board Connections: a rather Heath-Robinson affair, but it seems to work.

image

Captured Signals: channel 1, yellow, is CS; channel 2, magenta is MOSI; channel 3, cyan, is SCK

image

Captured Signals: Dropped the CS channel, showing more of the data and clock signals.

image

Captured Signals: Showing even more of the data and clock signals.

This looks ok, a fair bit of ringing but I would expect that given the speed and the connection used.  At least it shows my idea of using GPIO pins to cross connect to the SPI pins on the Click Mezzanine has legs (or at least can crawl!)

 

Test Code

It's well commented but if something isn't clear, please ask.  The main steps are:

  1. Initialise and configure the SPI Driver (lines 141 - 157)
  2. Run a self test to check the hardware (lines 159 - 168)  Essentially, this will reset the device to a known state and then run a loopback test.  It's a driver provided function.
  3. Configure the SPI device as a Master and the Slave as Manual Select.  This means that the CS line will not be dropped during transmission but will remain active throughout (lines 171 - 181)
  4. Select the Slave to transmit to (lines 183 - 193)  The driver will drive the connected CS wire active.
  5. Transmit the data (lines 215 - 226)  I do this 10 times but it's not really necessary for this test.

The SPI driver takes care of driving the wires based on the configured hardware so actually using it is very simple from a programming point of view.  Must be, as I've never used SPI before and coupled with my beginner knowledge of FPGAs I'm amazed to get it running with little difficulty.

 

/******************************************************************************
* Copyright (C) 2008 - 2021 Xilinx, Inc.  All rights reserved.
* SPDX-License-Identifier: MIT
******************************************************************************/

/*****************************************************************************/
/**
* @file xspi_polled_example.c
*
*
* This file contains a design example using the Spi driver (XSpi) and the Spi
* device using the polled mode.
*
* To put the driver in polled mode the Global Interrupt must be disabled after
* the Spi is Initialized and Spi driver is started.
*
* This example works with a Cortex A53 processor on an Ultra96-V2 board.  Altered
* from the original example to output only with a test signal to prove the SPI
* configuration is correct.
*
******************************************************************************/

/***************************** Include Files *********************************/

#include "xparameters.h"  /* XPAR parameters */
#include "xspi.h"  /* SPI device driver */
#include "xspi_l.h"
#include "xil_printf.h"
#include "sleep.h"

/************************** Constant Definitions *****************************/

/*
 * The following constants map to the XPAR parameters created in the
 * xparameters.h file. They are defined here such that a user can easily
 * change all the needed parameters in one place.
 */
#define SPI_DEVICE_ID XPAR_SPI_0_DEVICE_ID

/*
 *  This is the size of the buffer to be transmitted in this example.
 */
#define BUFFER_SIZE 12

/*
 * The following constant defines the slave select signal that is used to
 * to select the slave device on the SPI bus, this signal is connected
 * to the chip select of the device
 */
#define SLAVE_SPI_SELECT 0x01

/**************************** Type Definitions *******************************/

/*
 * The following data type is used to send data on the SPI
 * interface.
 */
typedef u8 DataBuffer[BUFFER_SIZE];


/***************** Macros (Inline Functions) Definitions *********************/


/************************** Function Prototypes ******************************/

int SpiPolledExample(XSpi *SpiInstancePtr, u16 SpiDeviceId);

/************************** Variable Definitions *****************************/

/*
 * The instances to support the device drivers are global such that they
 * are initialized to zero each time the program runs.
 */
static XSpi  SpiInstance;  /* The instance of the SPI device */

/*
 * The following variables are used to read and write to the  Spi device, they
 * are global to avoid having large buffers on the stack.
 */
u8 WriteBuffer[BUFFER_SIZE];


/*****************************************************************************/
/*
* Main function to call the Spi Polled example.
*
*
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note None
*
******************************************************************************/
int main(void)
{
  int Status;

  xil_printf("Spi polled Example Start Test.\r\n");

  /*
  * Run the Spi Polled example.
  */
  Status = SpiPolledExample(&SpiInstance, SPI_DEVICE_ID);
  if (Status != XST_SUCCESS) {
  xil_printf("Spi polled Example Failed\r\n");
  return XST_FAILURE;
  }

  xil_printf("Successfully ran Spi polled Example\r\n");
  return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* This function does a minimal test on the Spi device and driver as a
* design example. The purpose of this function is to illustrate how to use
* the XSpi component using the polled mode.
*
* This function sends data only.
*
*
* @param  SpiInstancePtr is a pointer to the instance of Spi component.
* @param  SpiDeviceId is the Device ID of the Spi Device and is the
* XPAR_<SPI_instance>_DEVICE_ID value from xparameters.h.
*
* @return XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note
*
* This function contains an infinite loop such that if the Spi device is not
* working it may never return.
*
******************************************************************************/
int SpiPolledExample(XSpi *SpiInstancePtr, u16 SpiDeviceId)
{
  int Status;
  u32 Count;
  u8 Test;
  XSpi_Config *ConfigPtr; /* Pointer to Configuration data */

  /*
  * Initialize the SPI driver so that it is  ready to use.
  */
  xil_printf("Initialising the SPI Driver...");
  ConfigPtr = XSpi_LookupConfig(SpiDeviceId);
  if (ConfigPtr == NULL) {
  xil_printf("...Failed, not found\r\n");
  return XST_DEVICE_NOT_FOUND;
  }

  Status = XSpi_CfgInitialize(SpiInstancePtr, ConfigPtr,
    ConfigPtr->BaseAddress);
  if (Status != XST_SUCCESS) {
  xil_printf("...Failed, not initialised\r\n");
  return XST_FAILURE;
  }
  xil_printf("...Initialised\r\n");

  /*
  * Perform a self-test to ensure that the hardware was built correctly.
  */
  xil_printf("Running self test...");
  Status = XSpi_SelfTest(SpiInstancePtr);
  if (Status != XST_SUCCESS) {
  xil_printf("...Failed.\r\n");
  return XST_FAILURE;
  }
  xil_printf("...Passed\r\n");


  /*
  * Set the Spi device as a master and manual slave select.
  */
  xil_printf("Setting SPI options for test...");
  Status = XSpi_SetOptions(SpiInstancePtr, XSP_MASTER_OPTION |
  XSP_MANUAL_SSELECT_OPTION);
  if (Status != XST_SUCCESS) {
  xil_printf("...Failed to set options.\r\n");
  return XST_FAILURE;
  }
  xil_printf("...Options set.\r\n");

  /*
  * Select the slave on the SPI bus so that it can be
  * written using the SPI bus
  */
  xil_printf("Selecting Slave on 0..");
  Status = XSpi_SetSlaveSelect(SpiInstancePtr, SLAVE_SPI_SELECT);
  if (Status != XST_SUCCESS) {
  xil_printf("...Failed to select slave.\r\n");
  return XST_FAILURE;
  }
  xil_printf("...Slave selected.\r\n");

  /*
  * Start the SPI driver so that the device is enabled.
  */
  XSpi_Start(SpiInstancePtr);

  /*
  * Disable Global interrupt to use polled mode operation
  */
  XSpi_IntrGlobalDisable(SpiInstancePtr);

  /*
  * Initialize the write buffer with pattern to write.
  * Test value that is added to the unique value allows the value to be
  * changed in a debug environment.
  */
  Test = 0x10;
  for (Count = 0; Count < BUFFER_SIZE; Count++) {
  WriteBuffer[Count] = (u8)(Count + Test);
  }

  /*
  * Transmit the data 10 times .
  */
  xil_printf("Transmitting starts\r\n");
  for (Count = 0; Count < 10; Count++) {

  xil_printf("Transmitting ");
  xil_printf("%d\r\n", Count);
  XSpi_Transfer(SpiInstancePtr, WriteBuffer, NULL, BUFFER_SIZE);
  usleep_A53(500000); // Sleep for 0.5 seconds
  }
  xil_printf("Transmitting ends\r\n");

  /*
  * Deselect the Slave and stop the SPI driver so that the device is disabled.
  */
  XSpi_SetSlaveSelect(SpiInstancePtr, 0x0);
  XSpi_Stop(SpiInstancePtr);

  return XST_SUCCESS;
}

 

Next Steps

I appear to have a successful PL build and some test code that I can build on.  So, my plan next is to incorporate it into the Workshop 4 design and actually start sending commands to the LCD.

 

Part Two extends on the work in this post and creates an application that actually drives the LCD.

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 4 years ago in reply to Andrew J +5
    jc2048 wrote a recent blog with a VHDL SPI implementation. It's a good example to view how clock and data work together.
  • jc2048
    jc2048 over 4 years ago in reply to Jan Cumps +5
    The recent one was a receiver. This older blog included a transmitter to send data to a Microchip DAC FPGA: Making Waves it was very simple, just a shift register to serialise the data, a counter to count…
  • jc2048
    jc2048 over 4 years ago +5
    If you wanted to experiment with the Digi-Pot, I can think of two things you could try (neither very elegant): 1) solid-core wire from the AN pin of the LCD Click Mini plugged in to the CS socket on the…
  • Andrew J
    Andrew J over 3 years ago in reply to bhfletcher

    No problem, I was just checking to see if it was an initialisation problem or a contrast problem.  In the end it turned out to be contrast: with 1-line mode default contrast is ok but too dim on 2-line mode.  To resolve this, there are a number of 'solutions' (aka Heath Robinson workarounds) given in the comments below and I did work out a non-intrusive solution that works with an empty Mikrobus slot or a Mikrobus slot where the board doesn't use it's CS pin.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bhfletcher
    bhfletcher over 3 years ago in reply to Andrew J

    Hi Andrew J ,

     

    Sorry for my delay. We did a lot of testing on the Mezzanine itself, but our main objective there was to make sure each Click site signal was accessible. We did that with a couple example modules as well as the Tester LED module, which is what we use in our own functional tests for continuity. However, I'm not aware of application work with the LCD Click. It was assumed (and I know it is bad to assume) that MikroE's modules were sufficiently designed and tested.

     

    I really appreciate the great work you are doing now. Your blogs are really excellent work! Thank you so much for sharing with the community!

    Bryan

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

    That would work as well Jan.

     

    However, what I've done is strung a wire from the CS1 pin of MikroBus port 2, in which I have the I2CUSB Click board and the CS pin is not connected, to the AN pin of MikroBus port 1 in which I have the LCD Mini Click.  I wrapped exposed ends around the relevant Click Board pins and put into the headers - this keeps it secure without any soldering and checking with a DMM ensures I haven't cross-connected pins; the boards still make good contact.  I only need to configure the extra PL pin and a few lines of code and voila, I can change the contrast and a low value (30) gives me a good display for 2-line mode.

     

    As a solution, it only works because the CS pin of the I2C USB Click isn't used but the advantage is I don't need to mess around with any of the boards.

     

    EDIT: I realise that Jon suggested this approach in a much earlier post but I’d forgotten.  Kudos in to him for the best, least destructive option.

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

    Remove the digital pot and replace it with a multiturn physical one, like most boards for this Hitachi do?

    The digital pot can then be repurposed for exciting newer projects.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Andrew J
    Andrew J over 3 years ago in reply to Andrew J

    Ok (part 2)....What is happening is I am initialising it properly.  What I am seeing is that with 1-line mode, the text is very readable; what was throwing me then was operating it in 2-line mode where the text is very dim.  Looking carefully, I can see written characters 41+ appear on line 2.

     

    This IS down to contrast and, thus, the voltage on the Vee pin.  The LCD is running at 5V and the Vee voltage at 2.6V.  In 1-Line mode, the LCD is operating at 2x the duty cycle than 2-line mode so the voltage on Vee is suitable; I believe I need to get it closer to 0v when in 2-line mode and the only nice way to do that is via the digipot's CS pin.  Doh! 

     

    The not nice way but only way is to bodge it, which I may but probably won't try:

     

    1. My first thought.  Solder a wire from the AN pin that I can insert into the LS header on the Click Mezzanine that is available to the PL.  However the digipot is powered at 3.3V and the LS header pins at 1.8V so that feels like a problem!
    2. Switch the Click board to run at 5V instead of 3.3V.  I'm pretty convinced that won't provide enough of a voltage difference on Vee, probably make it worse.
    3. Do as Jon suggests above and stick the click board on a breadboard and re-program it via an Arduino.  That may end up meaning that 1-line mode is over contrasted and I see black blobs rather than characters.

     

    I keep coming back to the fact that the Click Mezzanine board hasn't been designed to drive this Click Board.

    • Cancel
    • Vote Up +3 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