B4R Code Snippet STM32 - With int/ext RTC and LCD

Discussion in 'B4R Code Snippets' started by derez, Oct 11, 2017.

Similar threads

B4R Code Snippet STM32 - Bluetooth
B4R Question STM32 and SoftwareSerial
B4R Question STM32
Wish STM32 SPI interface - SDcard
Wish STM32 Support?
  1. derez

    derez Expert Licensed User

    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.
     

    Attached Files:

    Last edited: Oct 12, 2017
    rbghongade likes this.
  2. derez

    derez Expert Licensed User

    The RTS1302 application fails after long time (1-2 hours) with this:
    I have no idea where it happens so I guess it is something with the library operation in stm32.
    I'll write another application which shall use the internal RTC, updating it by the ds1302 at start.
     
  3. derez

    derez Expert Licensed User

    The update use the DS1302 just to update once the internal clock, at startup. Still, I worked hard to find when the reading is correct and when wrong...
     

    Attached Files:

Loading...