Table of Contents generated with DocToc
A bugswarm connector for Renesas 8- and 16-bit microcontrollers. This code turns a compatible evaluation board into a real-time internet enabled device. Once the connector is deployed to a device, the device will automatically connect to the bugswarm platform and share it's peripherals using a standardized API. This enables developers to create applications for the evaluation board in a wide variety of languages, without needing to download an SDK or physical access to the device.
- RL78/G13 Demonstration Kit (YRDKRL78G13) yrdkrl78g13 branch
- Redpine companion WiFi Card (RS-RL78G13-2200CC)
- RL78/G14 Demonstration Kit (YRDKRL78G14) (this branch)
- Built-in Gainspan GS1011-MIPS module
The RL78/G14 board with built-in Gainspan module
This is the most recent bugswarm-enabled device. The firmware is currently in beta, using the IAR RL78 Workbench development environment. For the final firmware release, the code will be ported to the CubeSuite+ environment and Applilet3 driver generation tool. Notable improvements:
- Swarm credentials are automatically generated based on the device mac address, no user intervention required
- Wifi access point can be set using the web provisioning feature of the gainspan module
- A single firmware can be used for all RL78G14 development boards.
Connect the RDK board to a USB power source using a USB-Mini cable.
The RDK board now needs to be configured for an active wireless access point with an internet connection. Hold down
Switch 2, Press and release the
Resetbutton, and then release the
Switch 2button. See this video for a demonstration: Enter Wifi Provisioning Mode.
Using a smartphone, tablet, or laptop, connect to the wireless access point indicated on the LCD screen.
Open a web browser and go to the URL indicated on the LCD screen. Click on the
Wireless and Network Configurationlink.
To scan for an access point to connect to, click on
Select an Existing Network
Pick a wireless AP from the list and click on it's
Enter the wireless password, leaving the other fields at default values. Click on
Save And Applyto confirm the selection.
You should see the following message displayed on the LCD screen. Press the
After rebooting, the device will automatically connect and begin producing data. Note the
ID:field on the third line, and keep an eye on the screen for any errors.
You will need to re-connect to a wireless access point with an internet connection. Navigate to buglabs.github.com/bugswarm-renesas/. In the first dropdown box, select the YRDKRL78G14 board and click "Go!".
Click on the second dropdown box. You should see the
IDfrom the LCD screen in the list. Select that entry and click "Go!".
You should now see live data from your Renesas device. See the tutorial folder for examples of how to use this data in your own application.
- Download and install the Renesas Flash Programmer V2 from http://am.renesas.com/products/tools/flash_prom_programming/rfp/downloads.jsp#
Locate SW5 in the middle of the RL78G14 RDK board. Move Switch 2 of SW5 in the Off position, or towards the green square in this photo:
Connect the RDK board to the PC using a USB-Mini cable.
The PC should detect a new device. If you see the following message, the driver was installed successfully and you can continue. Otherwise, you must click the following link to Install the Driver.
Renesas Flash Programmer V2.00from the start menu. Click on Next to create a new workspace for the RL78G14.
RL78from the Microcontroller dropdown. Then select the
R5F104PJMCU from the Device Name Column. Finally, enter
YRDKRL78G14as the worksapce and project name, then click Next.
In the next dialog, open the Tool dropdown list, and select the lowermost COM port. This should correspond to the COM port listed when the device was first added to the system. Then click Next.
Click next through the following two dialog boxes, leaving the default values intact.
Erasefrom the Microcontroller drop down menu, then click the large Start button. If successful, the
PASStext should be visible in green.
Programfrom the Microcontroller drop down menu.
Download the newest software release from this link. Each release is a snapshot of the entire repository. Extract the downloaded zip file to the PC, then click on the
Browsebutton on the Renesas Flash Progreammer, and select the .mot file that corresponds to the software release you would like to deploy:
Click on the large Start button. The firmware will be deployed to the device, displaying a progress bar and percentage readout. If successful, the
PASStext should be visible in green.
Move Switch 2 of SW5 in the On position, or towards the green square in this photo:
The new software should begin running on the device, see the user guide above. Repeat the Erase and Program steps for each board to be programmed.
Install the Driver
Follow these instructions to install the Virtual USB Com Port driver, required ONLY to deploy firmware to the board. This is not required to use the board.
After following the programming instructions above, and after plugging in the RL78 board to your PC, you may have seen the following error:
Download the following ZIP file and extract it to a known location (like the Desktop) Renesas USB Drivers
- Open the Device Manager on your PC. If you are unsure of how to do this, see this tutorial
Find the RL78 board in your list of devices. It should appear with a small yellow exclaimation point under the heading
USB Devices. Right click on the
Unknown Deviceand click
Update Driver Software...
On the next screen, direct Windows to install the driver manually by clicking on the
Browse my computer for driver softwarebutton.
Click on the
Browsebutton and navigate to the folder in which you extracted the USB Drivers earlier. In this case, they were extracted to the Desktop. Then click
Windows will now install the drivers. You should be greeted by the following success screen:
You can now delete the driver files you extracted earlier. If you open up the Device Manager again, you will see the RL78 board correctly installed. Note the COM Port number:
Pseudocode for the firmware:
- Check status of switches. If SW1 is held down, enter Gainspan web demo. If SW2 is held down, enter web provisioning mode
- Initialize hardware and read wireless AP data from nonvolatile storage. If no SSID has been saved, enter web provisioning mode
- Read wifi MAC address and execute API call to swarm server. Swarm credentials will be created if the device is new, and then returned.
- If Swarm credentials could not be retreived from server, use default ID of "UnknownDevice".
- Open a streaming "producer" session with the swarm API, and wait for message from server acknowledging the "presence" of the module.
- Enter production loop, in which each sensor on the board is sampled and transmitted to the server, every second.
- The watchdog timer has not been enabled in the beta release, adding this will improve reliability when the module is suddenly disconnected from the internet.
- Serial debugging occurs over UART0 (at 115200 baud) which is used by the debugger. We haven't been able to use the USB debugger tool to read this data, we instead used a seperate USB->Serial converter connected to pins 54 and 55.
- If the device appears on the Renesas Web Portal as "UnknownDevice", try rebooting it. Occasionally the first API call can fail if the wireless access point has not finished opening the connection.
- If an error is printed to the LCD screen on line 4 or line 8, and the error does not go away for a few minutes, try manually resetting the board.
- If the RDK board never appears on the web portal, use a smartphone or laptop to verify that the selected wireless access point has an internet connection, particularly to demo.bugswarm.com or developer.bugswarm.net.