Table of Contents
Introduction
The Renesas GreenPAK family of integrated circuits is interesting; they contain a mix of digital circuitry, such as flip-flops, counters, and logic gates, plus analog circuitry that can include op-amps and comparators. All of these internals can be connected together under command from an I2C serial bus and programmed into the built-in storage inside the chip.
I have not used GreenPAK devices before. This blog post describes my first ‘blinky’ level of experiment, to achieve a square wave output from one of the pins! This blog post contains the detail to follow along, and also try out circuits for yourself with minimal hardware needed.
To get there, we need to design the blinky circuit, simulate it, and then generate the output binary ‘bit file’ (it is actually a text file containing the binary values) that needs to be programmed into the non-volatile memory (NVM) inside the chip. The GreenPAK chip is programmed using I2C. A Pi Pico will be used as the programmer tool, with some Python code running on the PC to transfer the NVM file contents.
If you wish to replicate the experiment, you don’t need any hardware to perform the design and simulation. After that, you’ll need the SLG47004V GreenPAK chip (it is in a surface-mount QFN package so an IC adapter is needed), and a Pi Pico to act as the USB-to-I2C programmer. If you don’t have the hardware but have an interesting design simulated, please send it to me, and I’ll try it out and post the results!
QFN Adapter Board
An off-the-shelf QFN adapter board could be used, alternatively, there are Adapter Board Gerber files that can be sent to any PCB manufacturer.
There is space on the underside for soldering passives to the ground or adjacent pins if required. I used the space to solder decoupling capacitors (100nF across the digital supply pins, and 10uF across the analog supply pins), and connecting the analog and digital ground pins together with zero-ohm resistors.
Then, the board can be used with usual SIL pin headers or soldered to a 24-pin DIP IC-style header, as shown in the photo below.
Designing Blinky
Install Renesas Go Configure Software Hub, and then when it starts up, select the SLG47004V and double-click the part number.
A Project Settings window will appear. I want the circuit to operate at 3.3V and at room temperature, so I set the values accordingly, and then pressed OK.
A GreenPAK Designer window appears with a black area in the center for schematics. There are panes on the left and right side. The left side initially shows a pane containing components external to the chip. The right side has a Components list that contains things that are internal to the chip (you have to scroll down inside the Components list to see them).
The center schematic area shows the chip pins around the outside, and some circuit elements are already drawn. I ignored those for now.
The schematic is zoomed by holding down Ctrl and using the mouse scroll wheel. The display is panned by holding down the mouse center button and moving the mouse.
I selected the OSC0 component (it’s an oscillator!), and a green box appeared in the schematic, as shown in the screenshot above. I dragged it toward the desired output pin.
If you hover your mouse over the OSC0 component in the schematic, you’ll see all the input and output connections annotated. The color code is simple.
Green nodes provide connections that the user can make; click on a node, and a dotted elastic wire will be attached to the cursor. Click on another node, and a green wire will automatically be routed and drawn.
The user cannot make connections to orange items in this way. Orange means that something else must be configured, and then the connection will be automatically made. For instance, some op-amp connections may be dedicated to specific pins on the chip. The op-amp first needs to be configured to be powered on (perhaps by connecting a green power enable connection first), and then the remainder of the connections will be automatically drawn to the allowed pins in orange.
At the bottom of the left pane, you can click on Properties to examine what you can do with the OSC0 component (or just double-click on the OSC0 component in the schematic, and the left pane will automatically display the properties).
As seen in the screenshot above, I forced the oscillator on (it has a frequency of 2.048 kHz) and then selected to divide by 8 and 64 to achieve 4 Hz (a fast blinky). Then, I clicked on Apply by scrolling to the bottom of the properties list, clicked on the oscillator OUT0 node to see the dashed elastic line, and clicked on Pin 18. The blinky circuit is now complete!
Optionally, for the simulation, you could add an external resistor (to act as a load) onto pin 18, but it’s unnecessary. I saved the circuit at this point. Now, it’s time to simulate!
Simulation
Click on the green triangle Debug icon at the top, and then click on Software Simulation. Now you’ll be able to add virtual ‘scope probes by right-clicking on a node and selecting Add Probe. I decided to simulate for 4 seconds, with a step size of 1 ms.
Click on Simulate. After a few seconds, you’ll see the oscilloscope output! The first two charts are labelled V1 and V2 and they represent the voltage at the VDDA and VDD pins (if you zoom out in the schematic, you’ll see those pins are pre-attached to V1 and V2 voltage sources). The third chart shows the output for the user-added probe.
That looks pretty good, so it’s time to try it for real. Click on File->Export->Export NVM and save to a file called (say) blinky.txt. The file contains three columns of values for a total of 2048 binary bits (i.e. 256 bytes). That’s the size of the configuration NVM inside the chip.
Building the Circuit
The diagram here shows what was assembled.
Check out the separate blog on the topic of how to convert a Pi Pico into a USB-to-I2C adapter.
Using the Pi Pico as a SLG47004V Programmer
Download greenpak-utils from GitHub which contains the Python gp_prog.py GreenPak programmer code.
When you run it, a menu will be displayed (you’ll get an error message if you run it without the USB-to-I2C adapter connected):
The GreenPAK device internally contains 256 bytes of general-purpose EEPROM and 256 bytes of NVM, which stores the configuration generated by the Renesas software.
The program is arranged to work with three sources/destinations of data:
(a) The GreenPAK device memory (either NVM or EEPROM)
(b) Files of data on the PC (either bit-files generated by the Renesas development environment or raw 256-byte files
(c) A 256-byte RAM buffer on the PC
The gp_prog Python code allows the data (a) (b) (c) listed above to be transferred in any direction, e.g. send (a) to (b), but (c) is always used as an intermediary.
For example, if you wish to transfer data from a raw binary file on the PC to EEPROM, then you’ll need to first transfer it to the RAM buffer on the PC and then transfer that buffer into the EEPROM. Here’s what you’d see and type to perform such an operation:
*** Menu *** GreenPAK<->Local Buffer device operations: 1. Read EEPROM into buffer 2. Write buffer to EEPROM 3. Read NVM into buffer 4. Write buffer to NVM File<->Local Buffer operations: 5. Retrieve GreenPAK bit file into buffer 6. Store buffer to GreenPAK bit file 7. Retrieve Raw Bytes File into buffer 8. Store buffer to Raw Bytes File 9. Retrieve Dickens content into buffer Enter choice (1-9) >7 Enter the raw bytes file name to read (e.g. rawbytes.bin): testraw.bin Data from file 'testraw.bin' in hex format: 00: 68 6f 6d 65 73 3f 20 57 68 61 74 20 77 61 73 20 : homes? What was 10: 6d 65 72 72 79 20 43 68 72 69 73 74 6d 61 73 20 : merry Christmas 20: 74 6f 20 53 63 72 6f 6f 67 65 3f 20 4f 75 74 20 : to Scrooge? Out 30: 75 70 6f 6e 20 6d 65 72 72 79 20 43 68 72 69 73 : upon merry Chris 40: 74 6d 61 73 21 0a 57 68 61 74 20 67 6f 6f 64 20 : tmas!.What good 50: 68 61 64 20 69 74 20 65 76 65 72 20 64 6f 6e 65 : had it ever done 60: 20 74 6f 20 68 69 6d 3f 0a 0a 22 54 68 65 20 73 : to him?.."The s 70: 63 68 6f 6f 6c 20 69 73 20 6e 6f 74 20 71 75 69 : chool is not qui 80: 74 65 20 64 65 73 65 72 74 65 64 2c 22 20 73 61 : te deserted," sa 90: 69 64 20 74 68 65 20 47 68 6f 73 74 2e 20 22 41 : id the Ghost. "A a0: 20 73 6f 6c 69 74 61 72 79 20 63 68 69 6c 64 2c : solitary child, b0: 0a 6e 65 67 6c 65 63 74 65 64 20 62 79 20 68 69 : .neglected by hi c0: 73 20 66 72 69 65 6e 64 73 2c 20 69 73 20 6c 65 : s friends, is le d0: 66 74 20 74 68 65 72 65 20 73 74 69 6c 6c 2e 22 : ft there still." e0: 0a 0a 53 63 72 6f 6f 67 65 20 73 61 69 64 20 68 : ..Scrooge said h f0: 65 20 6b 6e 65 77 20 69 74 2e 20 41 6e 64 20 68 : e knew it. And h *** Menu *** GreenPAK<->Local Buffer device operations: 1. Read EEPROM into buffer 2. Write buffer to EEPROM 3. Read NVM into buffer 4. Write buffer to NVM File<->Local Buffer operations: 5. Retrieve GreenPAK bit file into buffer 6. Store buffer to GreenPAK bit file 7. Retrieve Raw Bytes File into buffer 8. Store buffer to Raw Bytes File 9. Retrieve Dickens content into buffer Enter choice (1-9) >2 Are you sure you want to write to the EEPROM? (y/n) y Erasing entire eeprom... Writing 256 bytes to the eeprom... *** Menu *** GreenPAK<->Local Buffer device operations: 1. Read EEPROM into buffer 2. Write buffer to EEPROM 3. Read NVM into buffer 4. Write buffer to NVM File<->Local Buffer operations: 5. Retrieve GreenPAK bit file into buffer 6. Store buffer to GreenPAK bit file 7. Retrieve Raw Bytes File into buffer 8. Store buffer to Raw Bytes File 9. Retrieve Dickens content into buffer Enter choice (1-9) >
For test purposes, for convenience, there is a menu option 9 which fills the RAM buffer with random text from A Christmas Carol.
Programming the GreenPAK chip
Now that the programmer has been described, here are the steps to program a chip.
Select menu option 5, and enter the name of the bit-file saved by the Renesas development environment earlier (e.g. blinky.txt). The data will be read into the gp_prog software RAM buffer mentioned earlier.
Next, select menu option 4 and press ‘y’ when prompted to confirm the write operation. Within seconds, the NVM will be programmed.
Power-cycle the chip, and the configuration will begin execution. If all is well, pin 18 will have a square wave; an attached LED (with a current-limiting resistor) should be blinking!
Summary
The Renesas Go Configure Software Hub is very easy to use to design and simulate a circuit. A simple blinky circuit was designed, and then the physical circuit, consisting of the Renesas GreenPAK chip and an LED, was assembled. It was attached to a USB-to-I2C adapter, and Python software was used to program the chip to achieve the blinking result.
The GreenPAK chip contains a lot of interesting analog and digital functionality that can be explored.
If you found it interesting too and wish to try it out, you'll need a Pi Pico, a SLG47004V chip, and a 0.4 mm TQFN 24-pin breakout board. Alternatively, there are ready-made eval boards for the chip.
Thanks for reading!