It is time for you to face a real challenge, during this phase you gonna develop an application that even though it is really simple its develop is pretty close to what you gonna face in a real job. Be ready to learn the most advanced programming techniques like reusable driver development, state machines, schedulers, and more. Step by step you will have to increase the complexity and the features requested to the point to reach a little more than 2000 lines of code written which includes besides the code, unit testing and documentation, plus I recommend version control with git, MISRA checks and Continuous Integration.

The project it is a simple 24 hours clock with date, it will display the time using a graphical LCD display and can be programmed using the serial port trough some predefined commands, explained in the requirements section

Project Requirements

The following are the initial requirements, keep in mid the project will be implemented step by step and therefore some of these requirements will change and some other will be added

REQ-001

The program must make use of the internal STM32 RTC peripheral to manage everything related to read and write time, date and alarm, It is mandatory to configure this peripheral to work with the low power oscillator (LSE) using the external low frequency crystal which should be ready included in any stm32 board, in case not, the use its internal version. stability and accuracy is not required.

REQ-002

Date and time should be displayed via semihosting via standard library until required to use and external LCD. In case using a SEGGER JLink you can switch to RTT

REQ-003

Clock programming will be done through the serial port using a series of pseudo AT commands made of string of characters. Commands can be send at any time been able for the clock to be updated upon reception.

REQ-004

The AT+TIME command will be use to set-up a new time in the clock, the format of the command should be as follow AT+TIME=hh:mm:ss\r, all number shall be represented in BCD format, example: AT+TIME=20:28:59\r

REQ-005

The AT+DATE command will be use to set-up a new date in the clock, the format of the command should be as follow AT+DATE=dd/mm/yyyy\r all number shall be represented in BCD format, example: AT+DATE=10/05/2025\r

REQ-006

The AT+ALARM command will be use to set-up a new alarm in the clock, the format of the command should be as follow AT+ALARM=hh:mm\r all number shall be represented in BCD format, example: AT+DATE=11:35\r

REQ-007

The time format will be in 24-hour format only, while the date will cover only the years from 1901 to 2099.

REQ-008

The alarm can only be set in hours and minutes, seconds are not needed

REQ-009

If any of the commands are correct and accepted an OK\r string, the paramter format and correctness has to evaluated as well.

REQ-010

If an invalid message is received or was not carried out successfully or an invalid value was send an ERROR\r string should be returned

Source Control

When you download the template, you do it using a version control system called Git, which is probably the most famous and widely used. You might not have noticed, but you can find a folder called .git, which holds all the versioning information that has been done. If for some reason you don't want your project to be versioned, simply delete this folder. In fact, I recommend it; it's better to start fresh.

$ rm -r .git

Now, we will start versioning our project with git init. This will create the .git folder again, and now we can work on our project using Git.

$ git init

We give our master branch an initial commit.

$ git add .
$ git commit -m "initial commit"

Git Flow simplified

To make the most of Git, all the new features you integrate into your project should be developed in a separate branch. Create a branch with the name you prefer and switch to it.

$ git branch <branch name>
$ git checkout <branch name>

Once you start working on your branch, you can make as many commits as you want to track your changes.

$ git add <file>
$ git commit -m "commit description"

 And when you feel that what you're developing is ready, merge into the master branch using rebase or any other method you like.

$ git checkout master
$ git rebase <branch name>

 You shouldn't develop anything in the master branch, as it should only contain stable versions of your project without errors. And every time you integrate a branch, you should delete it.

$ git branch -d <branch name>

And finally, make as many commits as you want. With practice, you will learn how to structure them better. In general words the git flow simplified will look like this:

master branch -—>  new feature branch                      
                     commits as many as you like 
master branch <----  merge feature branch to master
                     delete branch