Previous Blog


This blog is the third part detailing my progress on roadtesting the STM32L4R9I-discovery board for Element14 STM32L4R9I-DISCO Discovery Kit  and I will be using these blogs to write my final roadtest report/evaluation. I opted to use the freely available and unconstrained System Workbench addin for Eclipse by AC6. This approach will suit me better as I see this as a long journey of learning and do not want to suddenly be faced with a loss in IDE when a probation period expires.


1.     'Bricking' My Board


It wasn't long into testing out SW4STM32 and ST-LINK that I managed to compile one of the test programs and upload it to the board. The screen stopped working and it appeared to be doing nothing. A check on the COM port also showed no activity. I had a slight feeling that I had accidentally 'bricked' the board - perhaps accidentally overwriting vital boot information. Assuming that I hadn't and that I had just corrupted the program or indeed it was working but I just wasn't looking in the right place for the output, I carried on.

2.     STM32 Demo Application

I was eager to find the demo application and to download that to the board to get it back to the initial state when I received it. Looking through the STMCubeL4 projects I managed to find the demo.

{gallery} STM32 Demo

I was slightly perplexed as to why there are so many project files and Cproject files in the SW4STM32 structure but I clicked on the top-most and opened it in SW4STM32 IDE.


Below is the imported Demo application,

This also confused me as the various folders each contained their own HEX files. Dragging the STM32Cube_Demo hex file to the ST-LINK Utility and then programming the target board however worked.

This seems to take a very long time to download to the board (the chosen HEX file was 112MBytes) and I'm currently not sure why, or if that is normal. However - it does work, so that is a real bonus for me !


So, what were the other HEX files?....I tried to download those to the board. Starting with the MenuLauncher HEX file:

It downloads OK and at the end the board also had the full demo available just like when I downloaded the STM32Cube_Demo HEX.....strange ?!


This section gave me the hope I was looking for. It proved I was able to program the board even if at this point it was following some simple steps, I'm not entirely sure what is happening and I haven't changed the code. However, using the system starts to gain familiarity and confidence about the various aspects. As I progress I hope to over come issues and get more proficient at this STM32 board and ARM programming.


3.     The Board Support Package (BSP) Example

So far as a newcomer I have found this board difficult to understand but, like anything, the more I read in the background and the more I try practically the better I get. Perhaps I don't quite understand the WHY but I can start to see what works. Somewhere along my journey so far I've managed to try out several of the STM32CubeL4 examples; this example is the BSP.


What is interesting is that it includes several separate sections:

  • Joystick
  • LCD
  • SD Card
  • Audio Play
  • Audio Record


There should be something in there that I can easily tweak to then make my 'own' program !


From my File Explorer I browsed to the top level for my development IDE (ie SW4STM32) and double clicked the project icon, this opened Eclipse and the System Workbench addon.

I clicked PROJECT>>BUILD_ALL and the project started to build. What is interesting here is to look at the console window as the actual command line instructions and the whole build process is being detailed. I am started to see what the commands consist of, what options are included etc and I hope this will further my understanding of making ARM projects. When the build had finished I was able to browse around the folders and find the newly created BIN file. I eventually found it in the DEBUG folder. At this time I am still unsure why it is there, what the ELF files are and indeed why the whole folder structure within Eclipse doesn't seem to map to the folder structure of my HDD. I have seen something similar when using Visual Studio and I'm assuming this is similar - i.e. these are 'project folders' created to assist the developer in managing their code whereas they can be separate to the physical storage location structure on the HDD.....I'm sure all will become clearer later on.


The next step was to drag the BIN file into my ST-LINK Utility. I clicked PROGRAM & VERIFY and the BIN file was written to the STM32 board. It worked, I have a very comprehensive STemWIN test program running.


What is noticeable tome is that the touchscreen function has quite a high latency and requires quite a large area of touch to get registered. This could be the way the software is written for this demo , the settings that the touchscreen uses or maybe it is just the design. It definitely isn't smooth on my tests. I've included screen grabs of this demo below but omitted video as my finger would take up much of the display anyway.


{gallery} STemWIN Example


My apologies for the appalling picture quality above - they look reasonable in my E14 editor page. I'm happy with getting that demo loaded as it proves I can install new programs to the board and also gives me an interesting project that I can now start to read through, understand and try and modify.


4.     Making My Own Copy of a Project

I closed the project in Eclipse, went to my File Explorer, copied the BSP example and then clicked the project file to open my copy. It didn't work as I planned as SW4 knew that project already existed...probably by the project name. In my Eclipse PROJECT EXPLORER I simply renamed the existing "STM32L4R9I_Discovery" project and then I was able to open my copy of the BSP Project. I then renamed mine as well to avoid confusion later on.


Clicking on BUILD_ALL soon revealed that my new names caused issues with the MAKE_ALL process. Delving around some more I think the makefiles are embedded in the Eclipse Project files rather than within the actual folders.


After some time I decided I would just modify the original BSP project but then I found that too didn't work as the source files could not be found. Perhaps when I changed some of the configuration files earlier they were generic.


The following steps might seem drastic, but I don't want to get hung on too much detail when I hope much of that will become clearer later on as I progress my ARM learning. I therefore closed all the projects, deleted them from my Eclipse Workspace, binned the STM32CubeL4 and unzipped a new copy.  Off for a cup of tea while that process completes...

5.     Modified BSP Demo - My First Program ?

Spurred on by the success of being able to compile and understand some of the BSP example I started to tweak the code, initially changing some of the text and then adding my own function call based on the Joystick.c example and calling it in a similar way from the Finite State Machine in main.c


I progressed through making changes, building the code, dragging it to the ST-LINK Utility and programming the board.


My latest version adds a 'Rod' test. The joystick UP, DOWN and LEFT get displayed accordingly on the screen. Right clicking the joystick dims the display before it brightens again. Finally pressing SELECT prints 'Goodbye' and the screen dims before moving on to the next part of the example (as previously). I currently have more questions than I have managed to answer but I am fairly pleased with that outcome using the BSP library.……


7.    Next Steps

I want to get more competent at understanding the STM32 code in these examples and to be more confident at creating my own: either from modifying an example or generating it from the STM32CubeMX utility. I've also noticed that E4 are running the Sixth Sense Design Challenge  that utilises a similar STM32 board (the Nucleo). I'm considering applying as it would encourage me to push on with my knowledge but I'm a bit cautious as I may just as easily fail miserably !


I also need to find a way of removing the audio from a video: I made a video of my simple demo but it comes complete with a nice audio track of people talking in the background.


I'm starting to enjoy this board. I know I have only just scratched the surface and there is far more to learn. The board has plenty of peripherals and I am going to look at the other examples to see how they are actually used.


8.     Millennium Falcon Makes the Jump to Light Speed...only on the STM32L4R9I-discovery !

I couldn't resist having a play with the graphics after writing part3 of my blog earlier today, and so have added this screen shot for tariq.ahmad and the Element14 team. As you can see, scaling a rectangular photo onto a round display is not my forte. I think this is where the GUI tools like STemWin and the third party GUI tools like Embedded Wizard, GFXTouch etc come into their own.

Millenium Falcon Makes Jump to Light Speed