Introduction: Programming RoEnDi With Arduino IDE
In this intractable I will show you how to program Roendi encoder using Arduino IDE. Hopefully this will give you an idea how this encoder with display can be integrated into your project.
You can get one through my campaign on Crow Supply here. Please subscribe to the mail updates or share the project.
I am looking forward to your questions and comments!
Step 1: Get Arduino IDE
This step is straight forward, just go to https://www.arduino.cc/en/software select the version suitable for your operating system. Then follow the installation steps.
Step 2: Get STM32CubeProgrammer
We need the Cube Programmer for the drivers of the ST link and the DFU drivers for the microcontroller. Make sure you select this option when installing the Cube Programmer.
There is an extra step. You will need to make a registration on the ST site to get to the download page.
Step 3: Get the Example Code
Go to the git repo here
In the Software folder you will find ArduinoDemo folder containing all examples available. For our tutorial we will use the Display demo. So go ahead and download it.
In the example code you will see an extra function SystemClock_Config. This function sets the internal clocks of the STM32 MCU in the correct ways, so you need to leave it there. With that said everything else is the same.
Step 4: Installing STM32duino Core
Open Arduino IDE and go to File -> Preferences and find Additional Boards Manager URLs click on the icon next to the text box.
You need to add the following URL, if it is not yet added:
Click OK and close the window.
Go to Tools -> Board -> Board Manager in the search box type stm32 MCU and you will find "STM32 MCU based boards". Click on install on the bottom right corner. This will take a while.
Step 5: Adding Libraries.
We need to add two libraries, one is GFX Library for Arduino and the other one is Adafruit GFX Library
To do so go to Sketch -> Include Library -> Manage Libraries...
In the search box you can put the name of the libraries. Then click on the install button.
Step 6: Selecting the Correct Board Settings.
Next thing is to select the generic variant for the STM32L433CBU6 board.
Go to Tools -> Board -> STM32 Board Groups - > Generic STM32L4 series
Next go to Tools -> Board part number -> Generic L433CBx
Step 7: Selecting the Upload Method.
There are two ways you can program the Encoder. One is using a debugger, but if you are not familiar or you don't have one, there is an alternative.
Connect the debugger to the board as shown on the picture. Then connect the debugger to your PC. Power up the encoder with micro USB cable. Go to Arduino IDE and select Tools -> Upload method -> SWD. From then on is business as usual. Click on compile button and then you can upload your sketch.
You only need the encoder and a micro USB cable. Connect one end of the cable to the encoder, but do not plug it in the PC just yet. Then hold the BOOT button on the back while you plug the other end of the cable into the PC. You will see STM32BOOTLOADER device connected to your PC. Then select Tools -> Upload method -> DFU. You are ready to compile and upload your sketch.
You have to repeat the process every time you upload a new sketch.