Renesas


Renesas Electronics Corporation (TSE: 6723), the world's number one supplier of microcontrollers, is a premier supplier of advanced semiconductor solutions including microcontrollers, SoC solutions and a broad range of analog and power devices.

GR PEACH Getting Started

Information

This page is for GR-PEACH rev.E and GR-PEACH rev.C.
If your GR-PEACH is rev.B, go to Information of GR-PEACH rev.B. To identify GR-PEACH revision, see here.


This page is an introduction to Mbed for one who never touched GR-PEACH and Mbed site.

Setup!

Create an Mbed account

You need to create an Mbed account if you don't have one.
This step is necessary only for the first time.

  1. Move from https://mbed.org/ to Mbed Classic Developer site.
    /media/uploads/MasaoHamanaka/mbed_org_site_3.png

  2. Click "Login or signup".
    /media/uploads/MasaoHamanaka/mbed_org_site_top2.png

  3. Click "Signup".
    /media/uploads/MasaoHamanaka/mbed_org_site_login2.png

  4. Click "No, I haven’t created an account before".
  5. Enter your user name and password, check the "agree" and "confirm" check boxs, then click "Signup".
    /media/uploads/MasaoHamanaka/mbed_org_site_signup2.png

How to log in

You may already be logged in by your browser depending on the cookie setting.

  1. Move to Mbed Classic Developer Site from https://mbed.org/.
    /media/uploads/MasaoHamanaka/mbed_org_site.png

  2. Click "Login or signup."
    /media/uploads/MasaoHamanaka/mbed_org_site_top2.png

  3. Fill the following fields and click "Login".
    • user name (mail address)
    • password
      /media/uploads/MasaoHamanaka/mbed_org_site_login3.png

Add "Renesas GR-PEACH" to your Mbed compiler

You can build programs for GR-PEACH by adding "Renesas GR-PEACH" platform to your Mbed compiler.

  1. Move to Platforms page from Developer Site.
    /media/uploads/MasaoHamanaka/add_platform1.png

  2. Check "Renesas" of Target Vender on the left side, and click "Renesas GR-PEACH" platform.
    /media/uploads/MasaoHamanaka/add_platform2.png

  3. Click "Add to your Mbed compiler" on the right side.
    /media/uploads/ShinjiYamano/jpn_gettingstarted010.png

Install the USB Serial communication driver to your PC

Only for Windows(R) user:
You will be able to print debug by install USB Serial communication driver.
Please refer to this page for details of Seriarl Communication with a PC.
Please prepare a USB cable(A-MicroB) to connect between your PC and GR-PEACH, before starting steps as below.

  1. Connect GR-PEACH and PC with USB cable.
    GR-PEACH side conecttor is showen as below.
    /media/uploads/MasaoHamanaka/gr-peach_connecter2.png
  2. After the mount GR-PEACH as "MBED" volume label, install this driver.
    "Download latest driver" at the destination link is the target driver.
  3. As Mbed default setting of Serial is as below.
    Set Terminal of your PC to Mbed default setting.
    If you want to modify the setting, refer SerialPC page of Handbook.
Baudrate9600
Data bits8bits
Parity bitnone
Stop bit1bit
Flow Controlnone


How to build at Mbed Online Compiler

You can open the Mbed online compiler window by pressing the "Compiler" button at the upper right corner of the page when you are logged in at the site.
/media/uploads/MasaoHamanaka/how_to_build1.png

programs and libraries

Program and library are defined in Mbed as follows:

/media/uploads/RyoheiHagimoto/icon_program.png programA collection of code that can make up an executable program including main.cpp.
/media/uploads/RyoheiHagimoto/icon_library.png libraryA code that can be cut off as a unit function in the folder for the program.
Its contents may be a collection of code or stored in a library format (*.ar).


Import a "program"

You may import a program either by importing it from the Compiler window or by expanding the program at the Mbed site.

Within the Mbed Compiler

Take the following actions in the Mbed Compiler window:

  1. Press the Import button.
  2. Select the "`Programs" tag.
  3. Search program you need.
    If you click "Search" button when input box is empty, all programs will apair.
  4. Select the program you want to import.
  5. Press the "Import!" button
    /media/uploads/MasaoHamanaka/import_program2.png
  6. Do not check "Update all libraries to the latest version" if you want to import the program in the environment in which the writer of the program published it. To use the latest version of the libraries, check "Update all libraries to the latest version."
    At last, click "Import" button.
    /media/uploads/MasaoHamanaka/import_program3.png

At the Mbed site

  1. Move to the page for the target program at the Mbed site.
  2. Click "Import this program" located on the right side of the window.
    /media/uploads/RyoheiHagimoto/import_from_mbed_page.png
  3. Do not check "Update all libraries to the latest version" if you want to import the program in the environment in which the writer of the program published it.
    To use the latest version of libraries, check "Update all libraries to the latest version."
    At last, click "Import" button.
    /media/uploads/MasaoHamanaka/import_program3.png

Let's blink LED!!

  1. Connect GR-PEACH to your PC and wait the mount as "MBED" drive.
  2. Click "Import program" button of "mbed_blinky" below.

    Import programmbed_blinky

    The example program for mbed pin-compatible platforms

  3. Check "Update all libraries to the latest version".
  4. Get the source code by clicking "Import" button.
  5. Create binary file by clicking the "Compile" button.
    /media/uploads/RyoheiHagimoto/build.png
  6. When compile is finished, binary file is downloaded using browser function.
    Copy this file to Mbed drive.
  7. When GR-PEACH's reset button as below is pushed or reconnect USB cable, the program runs. /media/uploads/MasaoHamanaka/gr-peach_reset.png

How to modify sample code

You can change blink LED by changing LED name.
Below table shows defined name of LED and the colors.

LED nameColor
LED1RED
LED2GREEN
LED3BLUE
LED4RED


  1. Double-click "main.cpp" and main.cpp will be displayed.
    /media/uploads/MasaoHamanaka/change_code1.png

  2. Modify LED name and Save Code.
    /media/uploads/MasaoHamanaka/change_code2.png

  3. Create binary file by clicking the "Compile" button.
  4. After you get the binary file, copy the file to Mbed drive and check LED coloer by pushing reset button.

If you want to add blink LED, add "DigitalOut" difine in yout code as below.

Add Blink LED

DigitalOut addled_1(LED2);
DigitalOut addled_2(LED3);


If you want to change timing of blink, modify argument of wait().
The wait() provides function that "Waits for a number of seconds".

Change wait time

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1;
//        wait(0.2);         //wait 0.2s
        wait(1);              //wait 1s
        myled = 0;
//        wait(0.2);         //wait 0.2s
        wait(1);              //wait 1s
    }
}

USE Other samples

At this point, you become to be able to import some sample code that you want, and you can modify the code as you want.
Let's import various sample code and try to execute.

Use A/D converter

Follow the procedure of "Let's blink LED". The program to import is below.

Import programAnalogIn-HelloWorld

Hello world program for mbed SDK AnalogIn API


Use Serial Peripheral Interface(SPI)

  1. Follow the procedure of "Let's blink LED". The program to import is below.

    Import programSPI_HelloWorld_Mbed

    SPI Hello World

  2. Before compile, edit main.cpp as below.

A part of main.cpp to delete

SPI spi(p5, p6, p7); // mosi, miso, sclk
DigitalOut cs(p8);


A part of main.cpp to add

SPI spi(D11, D12, D13);   // mosi, miso, sclk
DigitalOut cs(D10);


Use microSD

  1. Follow the procedure of "Let's blink LED". The program to import is below.
    During importing, the dialog appears.
    **DO NOT CHECK the "Update all libraries to the latest version".**
    Because the current version of SDFileSystem, will issue an error when you compile.

    Import programSDFileSystem_HelloWorld

    SD File System Hello World

  2. Update Mbed library or Mbed library sources(mbed-dev or mbed-src).
    /media/uploads/RyoheiHagimoto/update_mbed.png
  3. Before compile, edit main.cpp as below.

A part of main.cpp to delete

SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the Mbed Cool Components workshop board


A part of main.cpp to add

SDFileSystem sd(P8_5, P8_6, P8_3, P8_4, "sd");


Use Ethernet

  1. Follow the procedure of "Let's blink LED". The program to import is below.

    Import programTCPSocket_HelloWorld

    TCP Socket Hello World with Ethernet

  2. To specify MAC address, add fllowing function to main.cpp.

Specify MAC address

// set mac address
void mbed_mac_address(char *mac) {
    mac[0] = 0x00;
    mac[1] = 0x02;
    mac[2] = 0xF7;
    mac[3] = 0xF0;
    mac[4] = 0x00;
    mac[5] = 0x00;
}

Use GR-PEACH as USB Device

  1. Follow the procedure of "Let's blink LED". The program to import is below.

    Import programUSBMouse_HelloWorld

    USBMouse Hello World

    If you want to use a function other a mouse, please see USBDevice page.

Use USB Host

  1. To supply VBUS, please close JP3.
  2. Follow the procedure of "Let's blink LED". The program to import is below.

    Import programUSBHostMouse_HelloWorld

    USBHostMouse Hello World

    If you want to use a function other a mouse, please see USBHost page.

Use I2C

  1. To pull up I2C signals, please close jumpers. Platform page shows which jumper is need to close.
  2. Follow the procedure of "Let's blink LED". The program to import is below.

    Import programI2C_HelloWorld_Mbed

    Hello World for I2C

  3. Before compile, edit main.cpp as below.

A part of main.cpp to delete

I2C i2c(p28, p27);


A part of main.cpp to add

I2C i2c(I2C_SDA, I2C_SCL);




Challenge!!

Let's take a look at the video of the camera by "GR-PEACH_WebCamera "!!

GR-PEACH can connect with GR-PEACH AUDIO CAMERA Shield .
GR-PEACH AUDIO CAMERA Shield provides CAMERA-IN, NTSC-IN, Line-OUT/IN, and more.
/media/uploads/MasaoHamanaka/audiocamerashield2.jpg Let's challenge to monitoring of the camera image by using GR-PEACH AUDIO CAMERA Shield and GR-PEACH_WebCamera sample.
GR-PEACH_WebCamera sample needs the following H/W.

  • Needed H/W
    • GR-PEACH
    • Audio/Camera Shield
    • CMOS Camera Module(MT9V111) or Analog Camera(NTSC)
    • Your PC

Appendix

Code debug

If you want to do code debugging, please refer following page.
Code debug by IDE DS 5


All wikipages