S7G2 Blinky Lights using external LED's, configuring GPIO pins

s7g2

#1

Simple LED circuit, from the pins to a resistor to ground pin on the board.

I. Introduction

The purpose of this project was to light up LED’s other than the ones on the board. This serves a bigger purpose. My final intent is to implement an Arduino Shield with the Renesas board. The first thing to learn is how to configure GP pins to input or output and what is the C code to write or read these pins. In this project was enabled me to research the manual and actually look for the names of the pins and their ports, which is essential to configuring these pins. I made a simple circuit, each LED is delayed. If you are old like me, I made the LEDs to light up like the “Knight Rider” car, “KITT” in the old TV series.

II. Configuring the GPIO Pins

The first step was to actually find the names of the ports. My intent is to connect an Arduino Shield. So, I research the names of the pins and ports for the J27,J26 interface. These are the pins in the center of the board where the shields connect. If we look at the board schematic manual, the Port and pin names for the J27 interface are the characters in red, below. Basically, if we looked at Pin 10, on the J24 interface, we discover that the actual port and pin name is “P5_12”.
This translates into Port 5, Pin 12. I will go over how to find this pin in e2 Studio.


III. e2Studio Pin configuration

We can use the basic blink light project as a starting point. We navigate to the “Pins” tab in the configuration summary window.

Click on Ports:

Now we navigate to the name of the port and pin we want to configure: In my case it was Port 5 Pin 12, which translate to P512

Now we set the “Mode” to output:

III. Code Construction

There are basically two variable initializations in the code.

  1. Declaration of the Delay units :

    const bsp_delay_units_t bsp_delay_units = BSP_DELAY_UNITS_MILLISECONDS;

or it can be in seconds

 const bsp_delay_units_t bsp_delay_units = BSP_DELAY_UNITS_SECONDS;
 const uint32_t delay = 30; //Can be 30 seconds or milli seconds depending on Delay units initialization
 R_BSP_SoftwareDelay(delay, bsp_delay_units); //delays the lights
  1. Setting the code to pinWrite to the ports:

    g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01,IOPORT_LEVEL_HIGH); //Turn the LED on
    g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01,IOPORT_LEVEL_LOW); //Turn the LED off

  2. Overall Code. The led will turn on, delay 30 millisecs, turn off, then move on to the next LED.

    void hal_entry(void)

    {

     /* Define the units to be used with the software delay function */
     const bsp_delay_units_t bsp_delay_units = BSP_DELAY_UNITS_MILLISECONDS;
     const uint32_t delay = 30;
    
         for(uint32_t i = 0; i < 50; i++)  //Repeats for 50 Cycles
         {
             R_BSP_SoftwareDelay(delay, bsp_delay_units); //Delays for 30 millisecs
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01,IOPORT_LEVEL_HIGH); //Turns On
             R_BSP_SoftwareDelay(delay, bsp_delay_units); //Delay
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01,IOPORT_LEVEL_LOW); //Turns Off
             R_BSP_SoftwareDelay(delay, bsp_delay_units); //Delay
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_01_PIN_05,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_01_PIN_05,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_01_PIN_04,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_01_PIN_04,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_07,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_07,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
             g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_06,IOPORT_LEVEL_HIGH);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
             g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_06,IOPORT_LEVEL_LOW);
             R_BSP_SoftwareDelay(delay, bsp_delay_units);
    
    
         }
    

    }

Conclusion

This project enables for the familiarization of how to configure the ports and pins. It also incorporated the C code used to send commands to those pins.

Robinson Paniagua


[SOLVED] S7G2 GUIX Touch Drivers error with SSP1.2.0
#2

Wonderful! Thanks for this great contribution.

I’ve been thinking of the contributions from high-quality people like yourself. It’s fantastic that you’re taking your learning and career development into your own hands.

I spent some time looking into Renesas as a company and Synergy as a platform to confirm that getting deep into this platform will pay off for everyone’s career development.

From the Forbes 2016 list of the top 2000 largest companies in the world, Renesas has a market cap of $10.1 billion with sales of $5.85 billion a year. They’re a big company with a lot of revenue.

From this deck on Renesas Mid-Term Growth Strategy, published in Nov 2016, it looks like the company is committed to Synergy and IoT.

The smart home and smart factory areas look relevant to Synergy and IoT. As these are high-growth areas, makes sense that Synergy is a good investment in learning.


#3

Statistics looks good. I think I’m in love with embedded systems. lol…Hopefully I can find a well paying job when I graduate.


#4

https://www.indeed.com/jobs?q=renesas&l=

https://www.indeed.com/q-Iot-Embedded-Firmware-Engineer-jobs.html

https://angel.co/internet-of-things/jobs

https://www.indeed.com/jobs?q=renesas+synergy&l=