Skip to main content

Subsection 1.3.2 Part 2: Port blinkySlowToFast to the Nucleo

Now we’ll put that same register-level C onto the real STM32C031C6. We’ll begin with a code review, reading a neighbor’s design and explaining our own, and then flash the code and watch it run on the board.

Activity 1.3.1. Review, Port, and Verify.

(a)

Show a neighbor your simulator design and walk through theirs. For their approach, answer the following, then share your feedback:
  • What variable controls the blink rate, and how does it change from one cycle to the next?
  • What is the reset condition: how does the program know it has reached “fast” and should return to “slow”?
  • Will the approach produce a smooth ramp, or will there be a jump? Is there an edge case where the reset might not trigger correctly?
  • Is there anything you would change or question?

(b)

Copy your working simulator code into blinkySlowToFast.c in STM32CubeIDE, the copy of blinky.c you made at the start of class. Build, flash, and confirm the LED ramps on the real board.

(c)

Did the board behave exactly like the simulator? Note any difference you see (timing, brightness, anything) and explain why the real hardware might not match the simulation.