The Renesas Flash Programmer: Programming and Configuration

In the last post, we started to look at the Renesas Flash Programmer and how we could use it to connect to a Renesas Synergy™ microcontroller. We successfully connected the flash programmer, but now we need to use the utility to load our software onto the microcontroller. In this post, we will examine how we can go about loading our code through the flash programmer.

Before our application can be loaded onto the microcontroller, we need to output our application as either an s-record, hex or rpi file. By default, when a Synergy project is compiled, an s-record is generated for the project. For example, a RtosTest application that was compiled in e2 Studio produced RtosTest.srec located in the Debug directory as shown below:

   

No extra work required! The developers can use the browse button on the Operation tab inside the flash programmer to open a dialog that can be used to locate the desired srec file. Multiple files can be selected to program simultaneously. A production system will most likely have a bootloader and an application image that need to be programed. Select all the necessary files and then press ok. When this is completed, the developer can press the very large “Start” button in order to program the microcontroller. If everything goes as planned, the flash programmer should look very similar to the following:

 

 If something went wrong, the window may look something like the following:

 

When this happens, it seems that the microcontroller has timed out. All a developer needs to do is short the reset pins again, release them and then try again.

There are several other options available in the flash programmer that developers may want to consider when they are programming their device. First, under the Operation Settings tab, it’s a good idea to check the “Erase Before Program” checkbox. This will ensure that the device is fresh before programming. For end-of-line programming this may not be necessary but if you are working on a prototype system and debugging without a debugger attached, erasing flash before reprogramming is a good idea.

Another option that could be set are the “Fill with 0xFF” checkboxes. These allow a programmer to fill unused code, user boot and data flash space with 0xFF. Now, if an erase sequence was executed or if the microcontroller is fresh off the press (never been programmed), the chances are that the unprogrammed space is already 0xFF. However, it doesn’t hurt to be sure. These options can be seen below:

 

Sometimes it may be that special flash areas exist that contain constant tables or calibration information that is already programmed into memory and should not be erased. The flash programmer allows individual memory sectors to be selected and programmed using the Block Settings tab. Simply uncheck the areas that should not be erased or not programmed as shown below:

 

One final trick, that I have found to be helpful when debugging (or hack) a system is the ability to read out the memory. Sometimes during the debugging process when the program changes rapidly developers can lose track or question the software version that is currently loaded on a device. If they haven’t built into their software some way to read a version, they can use the Device Information > Read Memory option to read out all the flash memory into an s-record file. That file can then be compared to a “golden” image to ensure that they match.

Programming a Synergy microcontroller using the Renesas Flash Programmer is that simple. In most cases, the default values are good enough and a developer can ignore the fine-tuning configuration features. However, it’s still good to know that they are there, because you never know when you are going to need them.

 

Until next time,

Live long and profit!

Professor_IoT

 

Hot Tip of the Week

Don’t forget that when you start to design your own printed circuit board you can use the Synergy Starter Kit Design data as a great starting point (that’s why we call them starter kits!) Design Data is available on the Synergy Tools and Kits page in the Downloads Tab: https://www.renesas.com/en-us/products/synergy/tools-kits.html#downloads

Just select the Renesas Starter Kits Design data filter and press the “Filters for Advanced search button” to find the design data you want. Most kits include schematic and layout files in popular formats to give you a leg up on designing your own PCB.