Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you are getting started on development for the Controls system, please take a look at Setting up an Embedded Development Environment.

Structure

Image Modified

Files in the Controls code base are split into three main groups: Board Support Package (BSP) Drivers, Device Drivers, and Applications. These layers enable us to separate low-level implementation details (such as specific peripheral initialization) from higher-level details (cruise control code, for example).

Applications

The apps layer sits atop the other two layers, making calls to driver code and operating system code in order to implement necessary logic for the function of the car. This code is divided into separate, independent tasks, each of which controls a certain aspect of the car.

...

  • The Debug Dump and Command Line tasks currently serve as purely debugging tasks and may be useful during competition (not to be used on the final vehicle).

Device Drivers

The device drivers layer sits right above the BSP. Its job is to provide the hardware interface for all of our higher level code. This includes implementing device-specific behavior over the peripherals provided by the BSP, and in general aids in reducing the complexity of the application layer.

Device DriverDescription
CANbusmutex-protects and adds semaphores for each CAN line to record the number of open mailboxes, provides an interface for Apps to use the CANbus, uses the CAN Lookup Table described in CANLUT.c
Contactorsprovides an interface to control precharge via the Array Precharge Bypass Contactor and Motor Precharge Bypass Contactor
Displayprovides an interface to control & send messages to the display
Minionsprovides an interface to control the lights and read the physical switches/buttons on the car
Pedalsprovides an interface to read the pedals

BSP (Board Support Package)

The board support package is our lowest abstraction layer. Its job is to hide away microcontroller specific initialization code, and present an interface to built-in peripherals.

BSP DriverDescription
BSP_ADCread the Analog to Digital Converter
BSP_CANread/write on the CAN bus
BSP_GPIOread/write digital values from pins on the processor
BSP_UARTread/write to UART (Universal Asynchronous Receiver/Transmitter)
BSP_SPI (unused)read/write to SPI (Serial Peripheral Interface)

Environment

Currently, the Controls system is using the Micrium µCOS-III (pronounced micro-C OS three) as its Real Time Operating System. (documentation)

...