Persistence OF Vision Display
description
Transcript of Persistence OF Vision Display
PERSISTENCEOF VISION
DISPLAY
Software Design Review
Andres Rodriguez
General System Design MCU: STM32F405 MCU Bus Frequency: 84MHz Memory Requirements Flash: ~ 10Kb RAM: ~ 15Kb
Kernel: FreeRTOS RTOS Tick period 1ms
Kernel Selection Real-time preemptive
multitasking kernel
FreeRTOS
3. Start Task4. OutputLED Task5. Bluetooth Receive Task6. Motor Control Task7. LEDBufferUpdate Task
Priority of tasks
Start TaskDescription:
Initializes system, Creates other tasks and Sets semaphores and Flags to proper value to Ensures POV does not run until the User hits the “ON” button
Priority #3 Period: once (at start-up) Execution time ~ 10ms Average CPU Load N/A
Bluetooth TaskDescription:
Every 40ms checks for incoming Bluetooth data.If data ready to receive, receives first byte and uses it to sort the rest of the incoming data onto appropriate index of a structure and also sets variable used by Motor module to enable or disable motor.
Priority #5 Period: 40 ms (Periodic) Execution time ~ 430us Execution time ~ 1.6ms (max) Average CPU Load = 1.07 % Peak CPU Load = 4%
User InterFace (App)
Description: Allows user to turn motor on and off, change background color, change text color, enter text or choose pre-programmed animations.
Motor Task
Description: Checks the MotorEnable variable to Enable or
disable Motor. Maintains motor speed as close as possible to 1500 RPM and saves it to a variable that Output LED task can access Via mutex
Priority #6 Period: 200 ms (Periodic) Execution time ~ 20 us (max) Average CPU Load = 0.01%
LEDOutput TaskDescription:
Reads LED Buffer and outputs it to the LEDs at the correct refresh rate. Pends on mutex to acces LEDBuffer. Gets MotorSpeed from motor module to determine LED refresh rate. Priority #3 Period: 220 usec (Periodic) updating 180 times per revolution
Execution time ~ 110us (max) Avg CPU Load: 50%
LEDBuffUpdate TaskDescription:
Pends on a semaphore to read text and colors from structure and then waits for LEDBuff mutex to update the LEDBuff with the new buffer. Priority #7 Period: sporadic Execution time ~ 4.12 ms (max) assuming the array is for updating 180 times per revolution.
CPU Load: 0.824%Assuming Semaphore gets set every 500 ms
CPU load
L max= (20us) + (1.6ms) + (110us) + (4.12ms)
(200ms) (40 ms) (220us) (500ms)
L max= 54.83%
L average = 51.9 %
ModulesModule Tasks Public Functions DataMain.c Start Task
Bluetooth.cAdapted From STM32F4_USART Sample
BTReceiveTask Bluetooth_Init();Bluetooth_Put();SetMotorEnable();
LEDUpdate SemaphoreUserInput Structure
SPICom.c
Adapted From STM32F4_SPI Sample
LEDSPI_Init();RPMSPI_Init();LEDSPI_Send();RPMSPI_Send();
MotorControl.c MotorControlTask PWM_init(); Power Motor variableMotor Speed variable
LEDs.c OutputLED TaskLEDBuffUpdate Task
UpdateLEDBuff();GetMotorSpeed();GetColors();
LEDBuffer Array
Dataflow Diagram
Questions?