foxBMS  1.6.0
The foxBMS Battery Management System API Documentation
ftask_cfg.c File Reference

Task configuration. More...

#include "ftask_cfg.h"
#include "HL_gio.h"
#include "HL_het.h"
#include "adc.h"
#include "algorithm.h"
#include "bal.h"
#include "bms.h"
#include "can.h"
#include "contactor.h"
#include "database.h"
#include "diag.h"
#include "dma.h"
#include "fram.h"
#include "htsensor.h"
#include "i2c.h"
#include "imd.h"
#include "interlock.h"
#include "led.h"
#include "meas.h"
#include "pex.h"
#include "redundancy.h"
#include "rtc.h"
#include "sbc.h"
#include "sof_trapezoid.h"
#include "spi.h"
#include "sps.h"
#include "state_estimation.h"
#include "sys.h"
#include "sys_mon.h"
#include <stdint.h>
Include dependency graph for ftask_cfg.c:

Go to the source code of this file.

Macros

#define TASK_10MS_COUNTER_FOR_50MS   (5u)
 
#define TASK_100MS_COUNTER_FOR_1S   (10u)
 

Functions

void FTSK_InitializeUserCodeEngine (void)
 Initializes the database. More...
 
void FTSK_RunUserCodeEngine (void)
 Engine task for the database and the system monitoring module. More...
 
void FTSK_InitializeUserCodePreCyclicTasks (void)
 Initialization function before all tasks started. More...
 
void FTSK_RunUserCodeCyclic1ms (void)
 Cyclic 1 ms task. More...
 
void FTSK_RunUserCodeCyclic10ms (void)
 Cyclic 10 ms task. More...
 
void FTSK_RunUserCodeCyclic100ms (void)
 Cyclic 100 ms task. More...
 
void FTSK_RunUserCodeCyclicAlgorithm100ms (void)
 Cyclic 100 ms task for algorithms. More...
 
void FTSK_RunUserCodeI2c (void)
 Continuously running task for I2C. More...
 
void FTSK_RunUserCodeAfe (void)
 Continuously running task for AFEs. More...
 
void FTSK_RunUserCodeIdle (void)
 Idle task. More...
 

Variables

OS_TASK_DEFINITION_s ftsk_taskDefinitionEngine
 Definition of the engine task. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic1ms
 Task configuration of the cyclic 1 ms task. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic10ms
 Task configuration of the cyclic 10 ms task. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic100ms
 Task configuration of the cyclic 100 ms task. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclicAlgorithm100ms
 Task configuration of the cyclic 100 ms task for algorithms. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionI2c
 Task configuration of the continuously running task for MCU I2C communication. More...
 
OS_TASK_DEFINITION_s ftsk_taskDefinitionAfe
 Task configuration of the continuously running task for AFEs. More...
 

Detailed Description

Task configuration.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2019-08-26 (date of creation)
Updated
2023-10-12 (date of last update)
Version
v1.6.0
Prefix
FTSK

Definition in file ftask_cfg.c.

Macro Definition Documentation

◆ TASK_100MS_COUNTER_FOR_1S

#define TASK_100MS_COUNTER_FOR_1S   (10u)

counter value for 1s in 100ms task

Definition at line 96 of file ftask_cfg.c.

◆ TASK_10MS_COUNTER_FOR_50MS

#define TASK_10MS_COUNTER_FOR_50MS   (5u)

counter value for 50ms in 10ms task

Definition at line 93 of file ftask_cfg.c.

Function Documentation

◆ FTSK_InitializeUserCodeEngine()

void FTSK_InitializeUserCodeEngine ( void  )

Initializes the database.

Start up after scheduler starts

Warning
Do not change the content of this function. This will very likely break the system. This function is kept in the configuration file to have a uniform task configuration.

Definition at line 157 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_InitializeUserCodePreCyclicTasks()

void FTSK_InitializeUserCodePreCyclicTasks ( void  )

Initialization function before all tasks started.

This function is called after the scheduler started but before any cyclic task runs. Here modules get initialized that are not used during the startup process.

Definition at line 193 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeAfe()

void FTSK_RunUserCodeAfe ( void  )

Continuously running task for AFEs.

Implements the communications with AFEs without state machine.

Definition at line 301 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeCyclic100ms()

void FTSK_RunUserCodeCyclic100ms ( void  )

Cyclic 100 ms task.

TODO

Perform SOC and SOE calculations only every 1s. Not suited if analog integration of current sensor is NOT used. Manual integration of current requires a higher frequency.

Definition at line 263 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeCyclic10ms()

void FTSK_RunUserCodeCyclic10ms ( void  )

Cyclic 10 ms task.

TODO

Definition at line 237 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeCyclic1ms()

void FTSK_RunUserCodeCyclic1ms ( void  )

Cyclic 1 ms task.

TODO

Definition at line 225 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeCyclicAlgorithm100ms()

void FTSK_RunUserCodeCyclicAlgorithm100ms ( void  )

Cyclic 100 ms task for algorithms.

TODO

Definition at line 283 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeEngine()

void FTSK_RunUserCodeEngine ( void  )

Engine task for the database and the system monitoring module.

Start up after scheduler start. First task to be run, all other tasks only starts when this task has started

Warning
Do not change the content of this function. This will very likely break the system. This function is kept in the configuration file to have a uniform task configuration.

Definition at line 184 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeI2c()

void FTSK_RunUserCodeI2c ( void  )

Continuously running task for I2C.

Implements the MCU communication over I2C

Definition at line 292 of file ftask_cfg.c.

Here is the call graph for this function:

◆ FTSK_RunUserCodeIdle()

void FTSK_RunUserCodeIdle ( void  )

Idle task.

Called by vApplicationIdleHook() if configUSE_IDLE_HOOK in FreeRTOSConfig.h is enabled. If you do not need this hook, you can disable it in the FreeRTOS configuration.

Definition at line 308 of file ftask_cfg.c.

Variable Documentation

◆ ftsk_taskDefinitionAfe

OS_TASK_DEFINITION_s ftsk_taskDefinitionAfe
Initial value:
= {
#define FTSK_TASK_AFE_STACK_SIZE_IN_BYTES
Stack size of continuously running task for AFEs.
Definition: ftask_cfg.h:171
#define FTSK_TASK_AFE_CYCLE_TIME
Cycle time of continuously running task for AFEs.
Definition: ftask_cfg.h:180
#define FTSK_TASK_AFE_PHASE
Phase of continuously running task for AFEs.
Definition: ftask_cfg.h:177
#define FTSK_TASK_AFE_PV_PARAMETERS
pvParameters of the continuously running task for AFEs
Definition: ftask_cfg.h:183
#define FTSK_TASK_AFE_PRIORITY
Priority of continuously running task for AFEs.
Definition: ftask_cfg.h:174

Task configuration of the continuously running task for AFEs.

Continuously running task for AFEs

Definition at line 145 of file ftask_cfg.c.

◆ ftsk_taskDefinitionCyclic100ms

OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic100ms
Initial value:
= {
#define FTSK_TASK_CYCLIC_100MS_STACK_SIZE_IN_BYTES
Stack size of cyclic 100 ms task.
Definition: ftask_cfg.h:120
#define FTSK_TASK_CYCLIC_100MS_PV_PARAMETERS
pvParameters of the 100ms task
Definition: ftask_cfg.h:135
#define FTSK_TASK_CYCLIC_100MS_PRIORITY
Priority of cyclic 100 ms task.
Definition: ftask_cfg.h:123
#define FTSK_TASK_CYCLIC_100MS_CYCLE_TIME
Cycle time of 100ms task.
Definition: ftask_cfg.h:129
#define FTSK_TASK_CYCLIC_100MS_PHASE
Phase of cyclic 100 ms task.
Definition: ftask_cfg.h:126

Task configuration of the cyclic 100 ms task.

Cyclic 100 ms task

Definition at line 127 of file ftask_cfg.c.

◆ ftsk_taskDefinitionCyclic10ms

OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic10ms
Initial value:
= {
#define FTSK_TASK_CYCLIC_10MS_PRIORITY
Priority of cyclic 10 ms task.
Definition: ftask_cfg.h:105
#define FTSK_TASK_CYCLIC_10MS_PV_PARAMETERS
pvParameters of the 10ms task
Definition: ftask_cfg.h:117
#define FTSK_TASK_CYCLIC_10MS_STACK_SIZE_IN_BYTES
Stack size of cyclic 10 ms task.
Definition: ftask_cfg.h:102
#define FTSK_TASK_CYCLIC_10MS_CYCLE_TIME
Cycle time of 10 ms task.
Definition: ftask_cfg.h:111
#define FTSK_TASK_CYCLIC_10MS_PHASE
Phase of cyclic 10 ms task.
Definition: ftask_cfg.h:108

Task configuration of the cyclic 10 ms task.

Cyclic 10 ms task

Definition at line 121 of file ftask_cfg.c.

◆ ftsk_taskDefinitionCyclic1ms

OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclic1ms
Initial value:
= {
#define FTSK_TASK_CYCLIC_1MS_STACK_SIZE_IN_BYTES
Stack size of cyclic 1 ms task.
Definition: ftask_cfg.h:84
#define FTSK_TASK_CYCLIC_1MS_PRIORITY
Priority of cyclic 1ms task.
Definition: ftask_cfg.h:87
#define FTSK_TASK_CYCLIC_1MS_CYCLE_TIME
Cycle time of 1ms task.
Definition: ftask_cfg.h:93
#define FTSK_TASK_CYCLIC_1MS_PV_PARAMETERS
pvParameters of the 1ms task
Definition: ftask_cfg.h:99
#define FTSK_TASK_CYCLIC_1MS_PHASE
Phase of cyclic 1ms task.
Definition: ftask_cfg.h:90

Task configuration of the cyclic 1 ms task.

Cyclic 1 ms task

Definition at line 115 of file ftask_cfg.c.

◆ ftsk_taskDefinitionCyclicAlgorithm100ms

OS_TASK_DEFINITION_s ftsk_taskDefinitionCyclicAlgorithm100ms
Initial value:
= {
#define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PRIORITY
Priority of cyclic 100 ms task for algorithms.
Definition: ftask_cfg.h:141
#define FTSK_TASK_CYCLIC_ALGORITHM_100MS_CYCLE_TIME
Cycle time of 100ms task for algorithms.
Definition: ftask_cfg.h:147
#define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PV_PARAMETERS
pvParameters of the 100ms task for algorithms
Definition: ftask_cfg.h:153
#define FTSK_TASK_CYCLIC_ALGORITHM_100MS_PHASE
Phase of cyclic 100 ms task for algorithms.
Definition: ftask_cfg.h:144
#define FTSK_TASK_CYCLIC_ALGORITHM_100MS_STACK_SIZE_IN_BYTES
Stack size of cyclic 100 ms task for algorithms.
Definition: ftask_cfg.h:138

Task configuration of the cyclic 100 ms task for algorithms.

Cyclic 100 ms task for algorithms

Definition at line 133 of file ftask_cfg.c.

◆ ftsk_taskDefinitionEngine

OS_TASK_DEFINITION_s ftsk_taskDefinitionEngine
Initial value:
= {
#define FTSK_TASK_ENGINE_STACK_SIZE_IN_BYTES
Stack size of engine task.
Definition: ftask_cfg.h:66
#define FTSK_TASK_ENGINE_CYCLE_TIME
Cycle time of engine task.
Definition: ftask_cfg.h:75
#define FTSK_TASK_ENGINE_PRIORITY
Phase of engine task.
Definition: ftask_cfg.h:69
#define FTSK_TASK_ENGINE_PV_PARAMETERS
pvParameters of the engine task
Definition: ftask_cfg.h:81
#define FTSK_TASK_ENGINE_PHASE
Phase of engine task.
Definition: ftask_cfg.h:72

Definition of the engine task.

Task configuration of the engine task.

Task is not delayed after the scheduler starts. This task must have the highest priority.

Warning
Do not change the configuration of this task. This will very likely break the system.

Definition at line 109 of file ftask_cfg.c.

◆ ftsk_taskDefinitionI2c

OS_TASK_DEFINITION_s ftsk_taskDefinitionI2c
Initial value:
= {
#define FTSK_TASK_I2C_PV_PARAMETERS
pvParameters of the continuously running task for I2C
Definition: ftask_cfg.h:168
#define FTSK_TASK_I2C_CYCLE_TIME
Cycle time of continuously running task for I2C.
Definition: ftask_cfg.h:165
#define FTSK_TASK_I2C_STACK_SIZE_IN_BYTES
Stack size of continuously running task for I2C.
Definition: ftask_cfg.h:156
#define FTSK_TASK_I2C_PRIORITY
Priority of continuously running task for I2C.
Definition: ftask_cfg.h:159
#define FTSK_TASK_I2C_PHASE
Phase of continuously running task for I2C.
Definition: ftask_cfg.h:162

Task configuration of the continuously running task for MCU I2C communication.

Continuously running task for MCU I2C communication

Definition at line 139 of file ftask_cfg.c.