Programming RoEnDi With Arduino IDE

by LessButBetter in Circuits > Arduino

654 Views, 3 Favorites, 0 Comments

Programming RoEnDi With Arduino IDE

FYQ0J2HKVUYR0F9.jpg

Hey everyone,

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!

Cheers!

Supplies

  • Roendi encoder
  • Micro USB cable
  • ST-LINK/V2 (optional)
  • PC (Win / Mac / Linux)
  • Arduino IDE (link)
  • STM32CubeProgrammer (link)
  • Code examples (link)

Get Arduino IDE

arduino_download_page.png

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.

Get STM32CubeProgrammer

st1.png
st2.png
st3.png
st4.png

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.

Get the Example Code

done.png

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.

Installing STM32duino Core

Arduini_step1.png
step2.png
step3.png
step4.png
step5.png

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:

https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/package_stmicroelectronics_index.json

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.


Adding Libraries.

arduino_gfx.png
step8.png

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.

Selecting the Correct Board Settings.

step6.png
step7.png

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

Selecting the Upload Method.

step10.png
IMG_20210822_140230.jpg
back.png
bootloader.png

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.

With debugger

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.

Without debugger

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.