MCU Design Overview

The MCU (STM32L432KC) was key for the implementation of our projects. One of these was operating the RFID reader. The MCU connected to the reader and read the different IDs of the cards via SPI. It used these IDs to select a song saved on an SD card reader through a DFPlayer, and played that song. It also sent a signal to the FPGA to indicate when to start the servo motor and the lights. The FLASH memory of the microcontroller was programmed to store color data to be sent to the FPGA to be displayed on the LEDs. A diagram ofthe

A diagram of the MCU operation is given below. MCU block diagram

RFID Reader

We implemented an RFID-RC522 RFID sensor to read the IDs from 13.56 MHz RFID cards. Communication to the RFID Reader was done via SPI. We translated an existing library for use of the RFID-RC522 with an Arduino (found here) to C for use with the STM32L432KC. A block diagram, from the MFRC522 datasheet, is given below. An antenna is used to detect the RFID cards.

Simplified block diagram of the MFRC522

DFPlayer

A DFPlayer takes MP3 files from an SD card and translates them into signals that can be sent to a speaker. It communicates with the MCU via USART, and takes 7 bytes at a time to initialize, pick and play a song from the SD card, and pause a song. The byte string that had to be sent to the DFPlayer is given below.

FLASH

The last component of our MCU design was the use of the FLASH peripheral. We had to create an unlock, lock, program and erase function in order to properly store strings in the FLASH memory. We had not explored this functionality of the MCU before in labs and so the reference manual was used extensively as well as the official STM32L4 HAL_Library. In order to program the FLASH our main program first executed the unlocking of the FLASH. Then we erased the FLASH at a specific page. The page by page erase method allowed us to be more cautious. After erasing the specific page we programmed strings into the page incrementing the address after 8 bits. Finally, we created a function that would transmit 16 bits of flash memory at a time over SPI to the FPGA.