Simple PMOD Display Application Example for DK-S128 Contents

Simple PMOD Display Application Example for DK-S128 Contents

Application Note Renesas Synergy™ Platform R12AN0071EU0101 Simple PMOD Display Application Example Rev.1.01 for DK-S128 Mar 16, 2018 Introduction This application note describes a Pmod™-based display application on the DK-S128 kit using the Renesas e2 studio ISDE and Renesas Synergy Software Package (SSP). Also included in this document are how-to steps on importing the project, so that you can recreate the application with the e2 studio Integrated Solutions Development Environment (ISDE/IAR SSC). Minimum PC Requirements • Microsoft® Windows® 7 or 10 • Intel® Core™ family processor running at 2.0 GHz or higher (or equivalent processor) • 8 GB memory • 2 GB of free space hard disk or SSD • USB 2.0. Required Resources The example application targets Renesas Synergy S128 MCU group. To build and run the application, you will need: • Renesas DK-S128 kit • e2 studio ISDE v6.2.0 or greater or IAR EW for Synergy v8.21.1 or later • Synergy Software Package (SSP) 1.4.0 or greater, Synergy Standalone configurator (SSC) 6.2.0 or later • Segger J-link® USB driver • Micro USB cables • An Okaya Pmod™-based LED display (included with the DK-S128 kit) You can download the required Renesas Synergy™ software from the Renesas Synergy Gallery (https://synergygallery.renesas.com). Prerequisites and Intended Audience As the user of this application note, you are assumed to have some experience with the Renesas e2 studio ISDE and SSP. For example, before you perform the procedure in this application note, you should follow the procedure in your board’s Quick Start Guide to build and run the OOB application project. By doing so, you will become familiar with e2 studio and the SSP, and ensure that the debug connection to your board is functioning properly. R12AN0071EU0101 Rev.1.01 Page 1 of 15 Mar 16, 2018 Renesas Synergy™ Platform Simple PMOD Display Application Example for DK-S128 Contents 1. Application Overview ............................................................................................................... 3 1.1 Application Software Architecture ........................................................................................................... 3 1.1.1 LCD Thread ........................................................................................................................................... 3 1.1.2 Control Thread....................................................................................................................................... 4 2. Procedure to Create Simple Pmod Display Example Project ................................................... 6 3. Running the Pre-existing DK-S128 Simple PmodTM Display Demonstration ........................... 12 3.1 Powering up the Board .......................................................................................................................... 12 3.2 Importing, Building, and Running the Project ........................................................................................ 12 3.3 Verifying the Demonstration .................................................................................................................. 12 4. Next Steps ............................................................................................................................. 14 5. Limitations and Assumptions ................................................................................................. 14 R12AN0071EU0101 Rev.1.01 Page 2 of 15 Mar 16, 2018 Renesas Synergy™ Platform Simple PMOD Display Application Example for DK-S128 1. Application Overview This document shows how to create a simple graphics-enabled application using the Okaya Pmod™-based LCD display and drivers within the SSP. When the application is running, you can control the content displayed using two on-board pushbuttons and a potentiometer. The example can be adapted to add visual effects to more complex applications. 1.1 Application Software Architecture The main components of this application are: • Control Thread • LCD Thread. Figure 1 DK-S128 Simple PmodTM Display Application Architecture 1.1.1 LCD Thread The Simple Pmod™ display application is controlled by pushbutton switches S1 and S2 (found in the lower right corner of the DK-S128 board) and a potentiometer POT (located to the right of the two buttons). Both pushbuttons are connected to hardware interrupt pins, which are controlled by the external IRQ framework. The framework allows you to control thread execution using hardware IRQs. In most cases, the application uses sf_irq. p_api->wait with the TX_WAIT_FOREVER timeout argument, to block processing in the thread until the given interrupt request is received. In the simple display example, however, the lcd thread scans through both button interrupts with a timeout value of zero, and, if neither button is pressed, it waits for 20 ms before repeating the process (IRQs are buffered by the framework before the next sf_irq. p_api->wait call). This gives enough processor ticks to lower-priority threads while still providing a responsive interface. The simple display example uses an Okaya Pmod™ LCD driver running on the SCI peripheral in Simple SPI mode. All driver files are contained inside the src/lcd_setup folder and can be easily copied into another application to enable the use of the PMOD display. The SPILCD_Init function accepts two arguments: a pointer to the SPI instance and an initial value for screen rotation. The SPI module needs to be configured for the right channel and bit rate (9 and R12AN0071EU0101 Rev.1.01 Page 3 of 15 Mar 16, 2018 Renesas Synergy™ Platform Simple PMOD Display Application Example for DK-S128 2.5 Mbps, respectively). However, the callback function input in the configurator is discarded as the display driver overrides it automatically with its own implementation, allowing for better data flow control when outputting data through the PMOD. The Okaya PmodTM LCD driver works with Simple SPI on SCI as well as RSPI, though you must be careful to remove the transfer drivers for the RSPI interface to allow 8-bit data width. LCD Thread Entry Button S1: SF_EXTERNAL_IRQ_Wait Increment “stage” value Exceeded APP_MAX_STAGE? Set APP_MAX_STAGE to APP_MIN_STAGE Draw next stage Button S2: SF_EXTERNAL_IRQ_Wait Increment “rotation” value Yes Exceeded No 270 degrees? Set rotation to zero Reset “stage” value and draw first stage tx_thread_sleep (2) Figure 2 Simplified view of LCD Thread processing 1.1.2 Control Thread The Simple PmodTM display application uses Okaya LCD driver to draw 15 different screens, each implementing different features of the driver. In addition to the displayed content, control of backlight intensity is provided through an ADC peripheral running inside the control thread. This task is launched before the LCD thread is initialized, to ensure that all setup is complete before displaying any data on the screen. The ADC peripheral running in continuous scan mode takes periodic readings of the channel 7 potential difference, through a connection to the on-board potentiometer, POT1. Despite the module being configured to read data with 12-bit resolution, software manipulates the data so that readings become an integer value contained within the 0-100 range. While the level of precision required for smooth backlight control is still sufficient, R12AN0071EU0101 Rev.1.01 Page 4 of 15 Mar 16, 2018 Renesas Synergy™ Platform Simple PMOD Display Application Example for DK-S128 reducing the effective resolution acts as a jitter-filter to prevent unnecessary PWM duty cycle updates when the ADC readings are rapidly oscillating. If the reading (post-processing) is different from the previous one, the duty cycle of the GPT (connected to the PMOD display backlight-enable pin) is updated using R_GPT_DutyCycleSet. ADC sampling frequency is limited to 33 Hz by suspending the thread for 30 ms using tx_thread_sleep (3) after each reading. Control Thread Entry PWM Timer: R_GPT_Open R_ADC_Open Button S1: SF_External_IRQ_Open Button S2: SF_External_IRQ_Open LCD Thread: tx_thread_resume R_ADC_ScanConfigure R_ADC_ScanStart R_ADC_Read Process the ADC reading Not Equal Compare with previous reading R_GPT_DutyCycleSet Equal tx_thread_sleep (3) Figure 3 Control Thread Processing R12AN0071EU0101 Rev.1.01 Page 5 of 15 Mar 16, 2018 Renesas Synergy™ Platform Simple PMOD Display Application Example for DK-S128 2. Procedure to Create Simple Pmod Display Example Project The following steps are used to recreate the DK-S128 PmodTM display example application project from scratch using the e2 studio ISDE. Step 1: Create a new project with RTOS included: 1. Create a new Synergy project by clicking File->New->Synergy C\C++ Project. 2. Select the ‘Renesas Synergy C Executable Project’. 3. Enter the project name and setup the Synergy license file. 4. Choose the DK-S128 board by selecting S128 DK in the Board window. 5. Choose BSP option in the Project Template Selection window. Figure 4 Synergy Project Creation window Step 2: Create Control thread 1. Under the Thread tab, click ‘New Thread’ to create a new thread. 2. Set the property of this new thread, as shown in Figure 5. 3. In the Control Thread Stacks window, click ‘New Stack’to add the ADC driver (ADC Driver on r_adc), GPT driver (Timer driver on r_gpt) modules, as shown in Figure 5. Figure 5 Adding ADC and r_gpt driver module 4. Go to the Properties tab for the ADC driver and select the resolution and channels, as shown in Figure 6. For details on the ADC driver properties, see the ADC module guide. Use the keyword “r_adc” in

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    17 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us