Versions Compared

Key

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

This is for design testing only. Not for hardware tests.

3 Types of testing

  • hardware tests (only on hardware)

  • design tests (only on simulation)

  • smoke tests (both?)

...

So the design of the testing architecture will be similar to the CAN architecture. See CAN Documentation for more details.

Essentially since this is design testing and simulation only, don’t need to worry about the memory usage. So we will defined output and input global variables to evaluate “black box” testing.

...

Thus there are 3 main functionality of steering which will roughly translate to their own TASKS.

Project Design

The project design for steering should be as follows

Code Block
initialize all GPIOs, SPI, etc
initialize all TASKS
start TASKS in cycle
cycle = 0

while (true)
  CAN receive Task  -> Non-concurrent
  GPIO Tasks  -> Concurrent
  ADC Tasks   -> Concurrent
  CAN Send Task -> Non-concurrent
  cycle++
  #ifdef TESTING
    post(cycle_finish)
    mutex(test_mux)
  #endif

Projects should start with initialization of all modules and then start running each tasks. Each tasks should be run in what’s called a cycle.

  • So the CAN receiving tasks starts first. This is because other tasks depend on the CAN messages coming in.

  • Next the GPIO and ADC tasks can run. These don’t depend on each other, thus can be parallel

  • Finally CAN send tasks runs last. This depends on GPIO and ADC to finish before running.

In the case of testing, there’s 2 additional functions to be run. A post operation indicating the end of a cycle, and a mutex operation that will block the tasks from running.

The test that is run will look something like this

Code Block
void test_setup()
{
  setups all the modules
  starts the tasks
}

void run_cycle(int c)
{
  for (int i = 0; i < c; i++)
  {
    mutex(cycle_finish);
    post(test_mux);
  }
}

void test_steering()
{
  set steering inputs
  run_cycle(1);
  trigger GPIOs
  run_cycle(1);
  change ADC values
  run_cycle(5);
  
  ....
  
}

And this should be the framework. While the test_steering input is running, all other tasks should be blocked. Once test_steering runs run_cycle then test_steering is block and all other tasks should run.