HAL/FSM Library: MS 12

DescriptionAbstracts all the hardware into nice APIs
Target release
Epic

ELEC-18 - Getting issue details... STATUS

Document owner
Project leadsCalder Kitagawa, Titus Chow
Team members

Goals

  • Support X86 and STM32 (possibly MSP430 as well)
  • Support all used peripherals with a common interface
  • Data-driven design
  • Add event-driven FSM library

Background and strategic fit

We would like to be able to simulate our boards on x86 so that we aren't blocked by hardware. This should be possible without modification to the business logic, allowing us to unit test our code and verify our implementations.

Assumptions

  • We have a custom Makefile that allows us to selectively include headers and source
  • We only need to support simulation on Linux (allowing us to use socketcan)
  • The FSM will be event-driven
  • We use a global event queue

Requirements

#TitleUser StoryImportanceNotes
1Support common peripherals

We want to be able to use hardware peripherals on our boards and simulate them on x86.


Supporting SPI, UART, and the ADC might be a challenge. An alternative option is to simulate the device that uses SPI/UART to communicate. We probably want to display GPIO states as well.

2Support inter-board communication on x86 and STM32We want to be able to simulate the entire car on x86.
Board communication should be solely done through CAN.
3FSMWe want an FSM library that is easy to understand and debug. There should be state tracking.

4Unit testsWe want to have be able to quickly test the library so we can verify changes.

User interaction and design

Questions

Below is a list of questions to be addressed as a result of this requirements document:

QuestionOutcome

Do we include default configs for boards that use the controller board?


Are we only supporting boards that use the controller board?
How do we display GPIO state?We could use a curses-based display. This would allow us to reflect GPIO state, LCD output, and other information.
How do we handle external ICs? How do we reflect communication over SPI or UART?
Do we support HSMs? Can the event be consumed by more than one FSM?

Not Doing

  • We are not supporting peripherals and features that we will most likely not be using in the foreseeable future.