The attached two applications display real time on LCD 1602 (or similar - just find the address). stm_clock_lcd uses the internal clock of the stm32 and with the addition of an Encoder it can modify the time and set it while running. The encoder is used by clicking the switch to select which parameter to change by rotating the knob (parameter name is displayed). stm_RTC1302_LCD connects the stm to realtime external clock - the ds1302. Probably due to working with 32 bits, the reading every second time is incorrect so it uses a 1 sec addition to the previous reading instead of using that reading. So the workaround for this problem is in the b4r code, maybe someone can adjust the rds1302 library for the stm32 case... Thanks to Starchild https://www.b4x.com/android/forum/threads/software-real-time-clock.77158/ for the STM32 in general and the RTC specifically , to Peter Simpson https://www.b4x.com/android/forum/threads/using-an-incremental-rotary-encoder.79611/ for the encoder. Edit: file stm_rtc1302_lcd updated. Edit: see post 2 and 3.