In this tutorial, you will build a simple application from scratch that blinks all 4 LEDs on the S3A7 fast prototyping board. This tutorial extends the earlier S3A7 tutorial located here: http://learn.iotcommunity.io/t/blinky-on-the-s3a7-iot-fast-prototyping-kit/636. In this case, we use the board support package for the fast prototyping board rather than forcing another bsp to work.
1) S3A7 IoT Fast Prototyping Kit including the J-Link debugger
2) Renesas e2 studio - latest version is 5.4.0.015 as of 5/25/2017
3) Renesas Synergy Software Package SSP v 1.1.3 (not the latest, but required for this board)
4) Segger J-Flash Lite 6.14a or later (older versions probably work, too)
Follow the "Building Smart Chef Demo from Source" tutorial far enough to put the downloaded pack file, user.s3_iot_lcd_dev.1.1.3.pack in the correct directory. Without this step, you won't have the board support package (bsp) you need to create this application.
Open e2 Studio in a new blank workspace
Select 'New – Synergy C Project'
Make sure to point to the synergy license location (default shown)
Select Synergy 1.1.3 (that is the version the BSP used). Select the correct board (highlighted).
Select the project template for our board.
Open the Synergy perspective.
Generate content (sanity check – there is no content yet). We are just making sure that everything is configured properly so far.
Build empty project from C/C++ perspective (also a sanity check to make sure you have configured everything correctly).
Configure the 4 GPIO pins which will drive the 4 LEDs. The 4 LEDs on the fast prototyping board are connected to port 7 pins 0-3. These 4 pins must be configured as GPIO outputs. The two screen shots below show you how to do this from within the synergy perspective.
Press 'Generate Project Content' again to auto-generate code which implements the changes you just made to the GPIO pins.
Open the file 'hal_entry.c'. This is where custom application code goes. It is not reset every time the 'Generate Project Content' is clicked.
Paste in the blinky code below:
/* HAL-only entry function */
bool OnOff = true;
bool OffOn = false;
OnOff = !OnOff; //toggle
OffOn = !OffOn; //toggle
for (int i = 0; i < 2.2E5; i++)
//Clock is 48MHz
//Counting to 220,000 results in a frequency of roughly 1Hz
//Next step is to use timer module to control this precisely
Build the project again. There should be no errors or warnings. Next, locate the .srec file. You will need to point the Segger J-Link Lite software to that file in order to flash the board with this new project.
Flash the board by pointing to the file above with the J-Link software. The correct settings are shown below:
Here is a J-Link tutorial in case you haven't done this before:
After flashing the board and resetting it, the LEDs should now flash 2 at a time at roughly 1Hz.
A more sophisticated version of this would use the S3A7 timers to accurately set the frequency. I'll work on that version next.