EDITED 10/12/19: Resolved issue with the base build. See below.
This is just a brief note on getting started with the Segger emWin gui development tool which is available free to all Envision kit users. It is necessary to register with Segger as part of the download process but it’s simple enough.
The download, once unzipped, consists of 4 directories:
- Doc: contains the emWin API documentation
- emWin_RX65N: contains an e2Studio project which is a duplicate of the original firmware demo projects that come pre-loaded with the board
- emWin_Simulation: contains a simulator to run on a PC, with a variety of sample projects
- Tool: contains tools to use with emWin, such as a bitmap and font convertor and gui builder
I imported the e2Studio project, emWin_RX65N, to build and load it onto the board as a simple exercise. Of course, the toolchain needs to be updated as the project is set to an older version, but it would appear that the choice of device isn’t quite correct either which is strange as the Envision Board doesn’t come with the 175-pin package of the MCU:
We’ll see if it works before changing it! It certainly compiles (although there are problems reported because of the board/device), but the debugger won’t launch - it’s looking for a file called SlideDemo\RX65N_EnvisionKit.x to launch which doesn’t exist:
That’s because the wrong debug configuration is selected by default, it should be “RX65N_EnvisionKit HardwareDebug”:
Anyway, once those are resolved, it loads and runs and the familiar demo programs appear, albeit V1.1 - so an upgrade!
Clearly in this case, the choice of device doesn’t matter, although I did correct it, rebuilt and tested it.
I wanted to create a base emWin project that has the basic configuration for the LCD and touch. This proved not too complex to get to 95% there - I couldn’t find any documentation to say how, but I figured out from the sample above what was needed. That last 5% has proven impossible to resolve so far. I did find another sample from RenesasRulz that someone had created (a minimum build) and for the life of me I can’t see what the difference with my project is; they look identical, but clearly not. My project will do the same but has a few rows of coloured pixels as well! If I copy that project’s emWin files and configuration to my project, it completely bombs out with a fatal error; if I copy my emWin files and configuration to the other project, it works with a few rows of coloured pixels. Project settings are the same; FIT module configurations are the same; there’s just some underlying something, somewhere that is different that I can’t find. After two days of scratching around, I’ve given up and will use the sample that works as a base. With the way the screen works with my project my suspicion falls on on a file called LCDConf which has the initialisation code in it, but I can’t work out why copying the other project’s files causes such a fatal error yet works fine with that project. The LCDConf file I have came from the Demo Sample that works so my suspicion is itself a bit suspect!!
I’m really frustrated with the complexity of developing for this board. There are some good tools/helpers available but here’s not a lot of basic documentation and samples to work from, and those that do exist need work to get going. I can figure that out without much issue but the underlying point here is that nowhere I can find is it explained clearly what needs to be done. I’m definitely not an idiot: if I can figure out what FIT modules are needed and how they should be configured it’s clear I have some brains! However, with software development it’s the little things that kill you and that’s where you have to fall back on the documentation and clear, working examples to help. The two days spent trying to get this working was a result of this and basically having to use my experience to try different things to fix it (not wanting to give up on it!)
I’ve asked on the Renesas Forum but that’s proving to be a less than useful resource than I thought it would be. It’s easier to use Google to search the Forum than its own search engine and it doesn’t appear to be as active as I hoped. If I do find a resolution, I’ll update this post.
EDIT 10/12/19: I was pointed at the Section table in the Linker by the original author of the project that I ended up using as a minimum build. This revealed what the problem was: the User Stack was set incorrectly and causing the issue. Setting this properly resolved things.
With emWin, it’s clear that the LCDConf, GUIConf and PIDConf files are important and need to be changed to match the device but how? If anyone with experience of working with the Envision board and emWin can help out, please get in touch.
In order to continue and not get bogged down I’ve given up on that and re-purposed the working basic project as a baseline from which to start all emWin applications - I’ve attached it to this post. It is set up to run Hello World, just to prove it works:
I’ve also tried it with one of the emWin sample apps that came with it. These are designed to work with the simulator, but only need minimal changes to work with the Envision board: copy the sample directory, delete 3 files not needed, and make a call to Main_Task() in the main() routine. It's better seen with a video than a still image:
(For some reason, the video embed function won't find this so I've had to paste a link.)
Summary Thoughts
Well, I’ve come to expect that the Toolchain won’t be right as versions change and I wouldn’t expect samples to be kept unto date in that respect. I’ve become a lot more astute at resolving the other niggles as well, as would anyone by now. I’m getting immensely frustrated with the lack of provision for understanding the board and offered tools as the documentation and samples provided are not that helpful. I’m happy to shoulder some of that responsibility as being relatively inexperienced with MCU development but I can only assume that Renesas feel that users coming to their MCU offerings are very experienced.
Further Entries
I will update this entry to provide links to further instalments as I create them:
Part Three: Development Software
Part Four A: Smart Configuration
Part Four C: Segger emWin Introduction (this post)
Part Four D: Removal of the LCD
Part Four E: Analog to Digital Conversion
Part Five: Static Setup of the GUI
Part Six: Getting the Display Working
Part Seven: USB/Serial Interface
Also, worth reading Jan Crump's road test as he's taking a more technical approach.