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
STEM Academy
  • Learn
  • Learning Center
  • STEM Academy
  • More
  • Cancel
STEM Academy
Forum STM32F4 Discovery and SSD2119 LCD driver with the LCD_35T example
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STEM Academy to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 6 replies
  • Subscribers 51 subscribers
  • Views 3028 views
  • Users 0 members are here
  • lcd
  • ssd2119
  • stm32f4dis
Related

STM32F4 Discovery and SSD2119 LCD driver with the LCD_35T example

Former Member
Former Member over 9 years ago

I'm trying to loading the LCD_35T example on an STM32F4 Discovery connected to a 320x240 TFT LCD with the SSD2119 driver (connected like in the expansion board).

What I get is that I'm not able to write on all the pixels of the display. I suppose it is a problem of register initialization:

  LCD_WriteReg(SSD2119_SLEEP_MODE_1_REG, 0x0001);
  // Set initial power parameters.
  LCD_WriteReg(SSD2119_PWR_CTRL_5_REG, 0x002B);
  LCD_WriteReg(SSD2119_VCOM_OTP_1_REG, 0x0006);
  // Start the oscillator.
  LCD_WriteReg(SSD2119_OSC_START_REG, 0x0001);
  // Set pixel format and basic display orientation (scanning direction).
  LCD_WriteReg(SSD2119_OUTPUT_CTRL_REG, 0x72EF); //72-30EF
  LCD_WriteReg(SSD2119_LCD_DRIVE_AC_CTRL_REG, 0x0600);
  // Exit sleep mode.
  LCD_WriteReg(SSD2119_SLEEP_MODE_1_REG, 0x0000);
  _delay_(5);
  // Configure pixel color format and MCU interface parameters.
  LCD_WriteReg(SSD2119_ENTRY_MODE_REG, ENTRY_MODE_DEFAULT);
  // Set analog parameters
  LCD_WriteReg(SSD2119_SLEEP_MODE_2_REG, 0x0999);
  LCD_WriteReg(SSD2119_ANALOG_SET_REG, 0x3800);
  // Enable the display
  LCD_WriteReg(SSD2119_DISPLAY_CTRL_REG, 0x0033);
  // Set VCIX2 voltage to 6.1V.
  LCD_WriteReg(SSD2119_PWR_CTRL_2_REG, 0x0005);
  // Configure gamma correction.
  LCD_WriteReg(SSD2119_GAMMA_CTRL_1_REG, 0x0000);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_2_REG, 0x0303);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_3_REG, 0x0407);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_4_REG, 0x0301);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_5_REG, 0x0301);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_6_REG, 0x0403);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_7_REG, 0x0707);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_8_REG, 0x0400);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_9_REG, 0x0A00);
  LCD_WriteReg(SSD2119_GAMMA_CTRL_10_REG, 0x1000);
  // Configure Vlcd63 and VCOMl
  LCD_WriteReg(SSD2119_PWR_CTRL_3_REG, 0x000A);
  LCD_WriteReg(SSD2119_PWR_CTRL_4_REG, 0x2E00);
  LCD_WriteReg(SSD2119_GATE_SCAN_START_REG, 0x0001); // Vertical offset
  // Set the display size and ensure that the GRAM window is set to allow
  // access to the full display buffer.
  LCD_WriteReg(SSD2119_V_RAM_POS_REG, (LCD_PIXEL_HEIGHT-1) << 8);
  LCD_WriteReg(SSD2119_H_RAM_START_REG, 0x0000);
  LCD_WriteReg(SSD2119_H_RAM_END_REG, LCD_PIXEL_WIDTH-1);
  //LCD_WriteReg(SSD2119_H_PORCH, 0x001D);
  //LCD_WriteReg(SSD2119_V_PORCH, 0x0003);
  //LCD_WriteReg(SSD2119_FW_START, 0x0000);
  //LCD_WriteReg(SSD2119_FW_END, 0x00EF);
  //LCD_WriteReg(SSD2119_SW_START, 0x0000);
  //LCD_WriteReg(SSD2119_SW_END, 0x00EF);
  LCD_WriteReg(SSD2119_X_RAM_ADDR_REG, 0x00);
  LCD_WriteReg(SSD2119_Y_RAM_ADDR_REG, 0x00);
  // clear the lcd
  LCD_WriteReg(SSD2119_RAM_DATA_REG, 0x0000);

The strange thing is that if I configure the SSD2119_H_RAM_END_REG [0x46] to be between 0 and 255 the display becomes wider but the last 65 pixels (320-255) are overwritten in the first pixels, like in the first two images. If I configure the same register to be greater than 255 (up to 320) the display shows just the last 65 pixels leaving undefined the rest of the display area.

Attachments:
image
image
image
image
  • Sign in to reply
  • Cancel
  • kulky64
    0 kulky64 over 9 years ago

    Hi gvol,

    do you have original  STM32F4DIS-BBSTM32F4DIS-BB and  STM32F4DIS-LCDSTM32F4DIS-LCD For me this demo works fine I can send you my HEX file to try out Is there any particular reason you changed value loaded to SSD2119OUTPUTCTRLREG from 0x30EF to 0x72EF

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 9 years ago

    Hi,

     

    I had quite similar symptom with an SSD1289 and a PSoC, in my case I was trying to write the memmmory of the LCD too fast.

    You can check the kulky64 hex file if using the ST boards (or if using the same pin out).

    You could also check with him if clock configuration in the same.

    Other easy check from you side to discard timing issue, is compile your code with a much slower timing configuration.

     

    Hope that helps

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to kulky64

    Hi,

    I'm using an homemade expansion board with the same pinout, while the LCD is not the STM32F4DIS-LCDSTM32F4DIS-LCDbut one with the same SSD2119 driver .

    Could you send me your HEX to try what it does?

    The value of SSD2119_OUTPUT_CTRL_REG has been changed to rotate the screen; it works fine as I desire but does not solve the problem even with the previous value.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to gihu

    Hi gihu,

    you or kulky64 have any idea in how I could change the writing speed on the memmemory of the LCD?

    Kulky64 did you changed something in the clock configuration? Because I'm using the predefined values in the project without any modification.

     

    Thanks both

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • kulky64
    0 kulky64 over 9 years ago in reply to Former Member

    Hi,

    if you have different LCD, then i'm affraid my hex will not help you much. The SSD2119 driver may be the same, but for different display the correspondence between controller's GDDRAM and physical dot matrix may be different, so you have to tweak some registers to accomodate this. I have just compiled the provided example and for me it worked without any modifications.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago

    SOLVED!,

    the problem both in the registry setting and in the default font.

     

      LCD_WriteReg(0x0028,0x0006);    // VCOM OTP
      LCD_WriteReg(0x0000,0x0001);    // start Oscillator
      LCD_WriteReg(0x0010,0x0000);    // Sleep mode
      LCD_WriteReg(0x0001,0x72EF);    // Driver Output Control
      LCD_WriteReg(0x0002,0x0600);    // LCD Driving Waveform Control
      LCD_WriteReg(0x0003,0x6A38);    // Power Control 1
      LCD_WriteReg(0x0011,0x6270);    // Entry Mode Horizontal screen mode 320*240 65k colour
      LCD_WriteReg(0X000F,0x0000);    // Gate Scan Position
      LCD_WriteReg(0X000B,0x5308);    // Frame Cycle Control
      LCD_WriteReg(0x000C,0x0003);    // Power Control 2
      LCD_WriteReg(0x000D,0x000A);    // Power Control 3
      LCD_WriteReg(0x000E,0x2E00);    // Power Control 4
      LCD_WriteReg(0x001E,0x00BE);    // Power Control 5
      LCD_WriteReg(0x0025,0x8000);    // Frame Frequency Control
      LCD_WriteReg(0x0026,0x7800);    // Analog setting
      LCD_WriteReg(0x004E,0x0000);    // Ram Address Set
      LCD_WriteReg(0x004F,0x0000);    // Ram Address Set
      LCD_WriteReg(0x0012,0x08D9);    // Sleep mode
      LCD_WriteReg(0x0030,0x0000); // Gamma Control (R30h to R3Bh)
      LCD_WriteReg(0x0031,0x0104);
      LCD_WriteReg(0x0032,0x0100);
      LCD_WriteReg(0x0033,0x0305);
      LCD_WriteReg(0x0034,0x0505);
      LCD_WriteReg(0x0035,0x0305);
      LCD_WriteReg(0x0036,0x0707);
      LCD_WriteReg(0x0037,0x0300);
      LCD_WriteReg(0x003A,0x1200);
      LCD_WriteReg(0x003B,0x0800);
      LCD_WriteReg(0x0007,0x0033);    // Display Control
      LCD_WriteReg(0x0022,0x0000);   // RAM data write/read */

     

    After this setting if I set the font to a smaller size like Font12x12 instead of Font16x24 it works. Keeping the Font16x24 is able to clear all the display, removing the undefined area, but the problem in the string overwriting still exists.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • 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