foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
nxpfs85xx.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2023, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file nxpfs85xx.c
44  * @author foxBMS Team
45  * @date 2020-03-18 (date of creation)
46  * @updated 2023-02-03 (date of last update)
47  * @version v1.5.0
48  * @ingroup DRIVERS
49  * @prefix SBC
50  *
51  * @brief Driver for the SBC module
52  *
53  * @details It must always be used when creating new c source files.
54  *
55  */
56 
57 /*========== Includes =======================================================*/
58 #include "nxpfs85xx.h"
59 
60 #include "HL_gio.h"
61 #include "HL_system.h"
62 
63 #include "diag.h"
64 #include "fram.h"
65 #include "fstd_types.h"
66 #include "fsystem.h"
67 #include "io.h"
68 #include "masterinfo.h"
69 #include "mcu.h"
70 
71 #include <stdint.h>
72 
73 /*========== Macros and Definitions =========================================*/
74 
75 /*========== Static Constant and Variable Definitions =======================*/
76 typedef enum {
82 
83 /*========== Extern Constant and Variable Definitions =======================*/
86  .configValues.watchdogSeed = FS8x_WD_SEED_DEFAULT,
87  .configValues.communicationMode = fs8xSPI,
88  .configValues.i2cAddressOtp = 0, /* Not used as SPI is selected */
89  .fin.finUsed = false,
90  .fin.finState = STD_NOT_OK,
91  .fin.pGIOport = &(systemREG1->SYSPC4), /* FIN connected to ECLK1 (ball A12): PRIVILEGE MODE REQUIRED! */
92  .fin.pin = 0,
93  .mainRegister = {0},
94  .fsRegister = {0},
95  .nvram.entry = FRAM_BLOCK_ID_SBC_INIT_STATE,
96  .nvram.data = &fram_sbcInit,
97  .mode = SBC_NORMAL_MODE, /* default value */
98 };
99 
100 /*========== Static Function Prototypes =====================================*/
101 /**
102  * @brief Checks register value against expected value
103  * @details If actual register value equals expected value #STD_OK is
104  * returned if this is not the case this indicates an error and
105  * #STD_NOT_OK is returned.
106  * @param[in] registerValue actual register value of interest
107  * @param[in] expectedRegisterValue expected register value
108  * @return #STD_OK if register value equals expected, else #STD_NOT_OK
109  */
110 static STD_RETURN_TYPE_e SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue);
111 
112 /**
113  * @brief Updates fail safe register values
114  * @details Updates fail safe register value of passed SBC instance
115  * with new values
116  * @param[in,out] pFsRegister pointer to fail-safe registers
117  * @param[in] registerAddress address of register that is updated
118  * @param[in] registerValue register value
119  */
120 static void SBC_UpdateFailSafeRegister(
121  FS85_FS_REGISTER_s *pFsRegister,
122  uint32_t registerAddress,
123  uint32_t registerValue);
124 
125 /**
126  * @brief Updates main register values
127  * @details Updates main register value of passed SBC instance with new
128  * values
129  * @param[in,out] pMainRegister pointer to main registers
130  * @param[in] registerAddress address of register that is updated
131  * @param[in] registerValue register value
132  */
133 static void SBC_UpdateMainRegister(
134  FS85_MAIN_REGISTERS_s *pMainRegister,
135  uint32_t registerAddress,
136  uint32_t registerValue);
137 
138 /**
139  * @brief Updates register values
140  * @details Updates register value of passed SBC instance with new
141  * values
142  * @param[in,out] pInstance SBC instance that is updated
143  * @param[in] isFailSafe true if fail-safe register, false if main register
144  * @param[in] registerAddress address of register that is updated
145  * @param[in] registerValue register value
146  */
147 static void SBC_UpdateRegister(
148  FS85_STATE_s *pInstance,
149  bool isFailSafe,
150  uint32_t registerAddress,
151  uint32_t registerValue);
152 
153 /**
154  * @brief Reads SBC register value
155  * @details Reads SBC register value from registerAddress and updates
156  * register in SBC state variable if reading was successful
157  * @param[in,out] pInstance SBC instance that is updated
158  * @param[in] isFailSafe true if fail-safe register, false if main
159  * register
160  * @param[in] registerAddress address of register that is read from
161  * @return #STD_OK if reading was successful, otherwise #STD_NOT_OK
162  */
163 static STD_RETURN_TYPE_e SBC_ReadBackRegister(FS85_STATE_s *pInstance, bool isFailSafe, uint8_t registerAddress);
164 
165 /**
166  * @brief Write to fail-safe register
167  * @details Writes to fail-safe register (can be done during FS_INIT phase
168  * only)
169  * @param[in] pInstance SBC instance that is updated
170  * @param[in] registerAddress address of register
171  * @param[in] registerValue value that is written into register
172  * @return #STD_OK if writing was successful, other #STD_NOT_OK
173  */
175  FS85_STATE_s *pInstance,
176  uint8_t registerAddress,
177  uint16_t registerValue);
178 
179 /**
180  * @brief Write to fail-safe register
181  * @details Writes to fail-safe register (can be done during FS_INIT
182  * phase only), reads back if write process was successful and
183  * afterwards updates register value of passed SBC instance
184  * @param[in,out] pInstance SBC instance that is updated
185  * @param[in] registerAddress address of register
186  * @param[in] registerValue value that is written into register
187  * @return #STD_OK if writing was successful, other #STD_NOT_OK
188  */
190  FS85_STATE_s *pInstance,
191  uint8_t registerAddress,
192  uint16_t registerValue);
193 
194 /**
195  * @brief Clears flags in register
196  * @details Writes to register, reads back if clear process was
197  * successful and afterwards updates register value of passed
198  * SBC instance
199  * @param[in,out] pInstance SBC instance that is updated
200  * @param[in] registerAddress address of register
201  * @param[in] isFailSafe true if fail-safe register, false if main register
202  * @param[in] registerValue value that is written into register
203  * @return #STD_OK if writing was successful, other #STD_NOT_OK
204  */
206  FS85_STATE_s *pInstance,
207  uint8_t registerAddress,
208  bool isFailSafe,
209  uint16_t registerValue);
210 
212 
213 /**
214  * @brief Perform RSTB safety path check
215  * @details This functions performs a safety path check to make sure
216  * external components connected to RSTB are available to
217  * bring the safety critical outputs to known levels during
218  * operation.
219  * @param[in,out] pInstance SBC instance for which the RSTB path is checked
220  * @return #STD_OK if path check was successful, other #STD_NOT_OK
221  */
223 
224 /**
225  * @brief Perform FS0B safety path check
226  * @details This functions performs a safety path check to make sure
227  * external components connected to FS0B are available to
228  * bring the safety critical outputs to known levels during
229  * operation.
230  * @param[in,out] pInstance SBC instance for which the FS0B path is checked
231  */
233 
234 /*========== Static Function Implementations ================================*/
235 static STD_RETURN_TYPE_e SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue) {
236  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
237  /* AXIVION Routine Generic-MissingParameterAssert: expectedRegisterValue: parameter accepts whole range */
238  STD_RETURN_TYPE_e retval = STD_OK;
239  if (registerValue != expectedRegisterValue) {
240  retval = STD_NOT_OK;
241  }
242  return retval;
243 }
244 
246  FS85_FS_REGISTER_s *pFsRegister,
247  uint32_t registerAddress,
248  uint32_t registerValue) {
249  FAS_ASSERT(pFsRegister != NULL_PTR);
250  FAS_ASSERT(registerAddress <= FS8X_M_DEVICEID_ADDR);
251  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
252  switch (registerAddress) {
254  pFsRegister->grl_flags = registerValue;
255  break;
257  pFsRegister->iOvervoltageUndervoltageSafeReaction1 = registerValue;
258  break;
260  pFsRegister->iOvervoltageUndervoltageSafeReaction2 = registerValue;
261  break;
263  pFsRegister->iWatchdogConfiguration = registerValue;
264  break;
266  pFsRegister->i_safe_inputs = registerValue;
267  break;
268  case FS8X_FS_I_FSSM_ADDR:
269  pFsRegister->iFailSafeSateMachine = registerValue;
270  break;
271  case FS8X_FS_I_SVS_ADDR:
272  pFsRegister->i_svs = registerValue;
273  break;
275  pFsRegister->watchdogWindow = registerValue;
276  break;
278  pFsRegister->watchdogSeed = registerValue;
279  break;
281  pFsRegister->watchdogAnswer = registerValue;
282  break;
284  pFsRegister->overvoltageUndervoltageRegisterStatus = registerValue;
285  break;
287  pFsRegister->releaseFs0bPin = registerValue;
288  break;
290  pFsRegister->safeIos = registerValue;
291  break;
293  pFsRegister->diag_safety = registerValue;
294  break;
296  pFsRegister->intb_mask = registerValue;
297  break;
298  case FS8X_FS_STATES_ADDR:
299  pFsRegister->states = registerValue;
300  break;
301  default:
302  FAS_ASSERT(FAS_TRAP); /* This case should never be reached */
303  break; /* LCOV_EXCL_LINE */
304  }
305 }
306 
308  FS85_MAIN_REGISTERS_s *pMainRegister,
309  uint32_t registerAddress,
310  uint32_t registerValue) {
311  FAS_ASSERT(pMainRegister != NULL_PTR);
312  FAS_ASSERT(registerAddress <= FS8X_M_DEVICEID_ADDR);
313  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
314  switch (registerAddress) {
315  case FS8X_M_FLAG_ADDR:
316  pMainRegister->flag = registerValue;
317  break;
318  case FS8X_M_MODE_ADDR:
319  pMainRegister->mode = registerValue;
320  break;
322  pMainRegister->registerControl1 = registerValue;
323  break;
325  pMainRegister->registerControl2 = registerValue;
326  break;
327  case FS8X_M_AMUX_ADDR:
328  pMainRegister->analogMultiplexer = registerValue;
329  break;
330  case FS8X_M_CLOCK_ADDR:
331  pMainRegister->clock = registerValue;
332  break;
334  pMainRegister->int_mask1 = registerValue;
335  break;
337  pMainRegister->int_mask2 = registerValue;
338  break;
339  case FS8X_M_FLAG1_ADDR:
340  pMainRegister->flag1 = registerValue;
341  break;
342  case FS8X_M_FLAG2_ADDR:
343  pMainRegister->flag2 = registerValue;
344  break;
346  pMainRegister->vmon_regx = registerValue;
347  break;
349  pMainRegister->lvb1_svs = registerValue;
350  break;
351  case FS8X_M_MEMORY0_ADDR:
352  pMainRegister->memory0 = registerValue;
353  break;
354  case FS8X_M_MEMORY1_ADDR:
355  pMainRegister->memory1 = registerValue;
356  break;
358  pMainRegister->deviceId = registerValue;
359  break;
360  default:
361  FAS_ASSERT(FAS_TRAP); /* This case should never be reached */
362  break; /* LCOV_EXCL_LINE */
363  }
364 }
365 
366 static void SBC_UpdateRegister(
367  FS85_STATE_s *pInstance,
368  bool isFailSafe,
369  uint32_t registerAddress,
370  uint32_t registerValue) {
371  FAS_ASSERT(pInstance != NULL_PTR);
372  FAS_ASSERT((isFailSafe == true) || (isFailSafe == false));
373  FAS_ASSERT(registerAddress <= FS8X_M_DEVICEID_ADDR);
374  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
375 
376  /* Check if fail-safe or main register needs to be updated */
377  if (isFailSafe == true) { /* Update fail-safe register */
378  SBC_UpdateFailSafeRegister(&(pInstance->fsRegister), registerAddress, registerValue);
379  } else { /* Update main register */
380  SBC_UpdateMainRegister(&(pInstance->mainRegister), registerAddress, registerValue);
381  }
382 }
383 
384 static STD_RETURN_TYPE_e SBC_ReadBackRegister(FS85_STATE_s *pInstance, bool isFailSafe, uint8_t registerAddress) {
385  FAS_ASSERT(pInstance != NULL_PTR);
386  FAS_ASSERT((isFailSafe == true) || (isFailSafe == false));
387  /* AXIVION Routine Generic-MissingParameterAssert: registerAddress: parameter accepts whole range */
388 
389  STD_RETURN_TYPE_e retval = STD_NOT_OK;
390  fs8x_rx_frame_t rxTemp = {0};
391 
392  FAS_ASSERT(pInstance != NULL_PTR);
393 
394  if (fs8xStatusOk !=
395  FS8x_ReadRegister(pInstance->pSpiInterface, &(pInstance->configValues), isFailSafe, registerAddress, &rxTemp)) {
396  retval = STD_NOT_OK;
397  } else {
398  SBC_UpdateRegister(pInstance, isFailSafe, registerAddress, rxTemp.readData);
399  retval = STD_OK;
400  }
401  return retval;
402 }
403 
405  FS85_STATE_s *pInstance,
406  uint8_t registerAddress,
407  uint16_t registerValue) {
408  FAS_ASSERT(pInstance != NULL_PTR);
409  /* AXIVION Routine Generic-MissingParameterAssert: registerAddress: parameter accepts whole range */
410  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
411 
412  STD_RETURN_TYPE_e retval = STD_OK;
413 
414  FAS_ASSERT(pInstance != NULL_PTR);
415 
416  /* Write to register */
417  if (fs8xStatusOk !=
418  FS8x_WriteRegisterInit(pInstance->pSpiInterface, &(pInstance->configValues), registerAddress, registerValue)) {
419  retval = STD_NOT_OK;
420  } else {
421  retval = STD_OK;
422  }
423  return retval;
424 }
425 
427  FS85_STATE_s *pInstance,
428  uint8_t registerAddress,
429  uint16_t registerValue) {
430  FAS_ASSERT(pInstance != NULL_PTR);
431  /* AXIVION Routine Generic-MissingParameterAssert: registerAddress: parameter accepts whole range */
432  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
433 
434  STD_RETURN_TYPE_e retval = STD_OK;
435  fs8x_rx_frame_t rxTemp = {0};
436 
437  FAS_ASSERT(pInstance != NULL_PTR);
438 
439  /* Write to register */
440  if (fs8xStatusOk !=
441  FS8x_WriteRegisterInit(pInstance->pSpiInterface, &(pInstance->configValues), registerAddress, registerValue)) {
442  retval |= STD_NOT_OK;
443  } else {
444  /* Read back register value and check if write process was successful */
445  if (fs8xStatusOk !=
446  FS8x_ReadRegister(pInstance->pSpiInterface, &(pInstance->configValues), true, registerAddress, &rxTemp)) {
447  retval |= STD_NOT_OK;
448  } else {
449  if (rxTemp.readData == registerValue) {
450  /* Written register value equals read value */
451  SBC_UpdateRegister(pInstance, true, registerAddress, rxTemp.readData);
452  } else {
453  retval |= STD_NOT_OK;
454  }
455  }
456  }
457  return retval;
458 }
459 
461  FS85_STATE_s *pInstance,
462  uint8_t registerAddress,
463  bool isFailSafe,
464  uint16_t registerValue) {
465  FAS_ASSERT(pInstance != NULL_PTR);
466  /* AXIVION Routine Generic-MissingParameterAssert: registerAddress: parameter accepts whole range */
467  /* AXIVION Routine Generic-MissingParameterAssert: isFailSafe: parameter accepts whole range */
468  /* AXIVION Routine Generic-MissingParameterAssert: registerValue: parameter accepts whole range */
469 
470  STD_RETURN_TYPE_e retval = STD_OK;
471  fs8x_rx_frame_t rxTemp = {0};
472 
473  FAS_ASSERT(pInstance != NULL_PTR);
474 
475  /* Write to register */
476  if (fs8xStatusOk !=
478  pInstance->pSpiInterface, &(pInstance->configValues), isFailSafe, registerAddress, registerValue)) {
479  retval |= STD_NOT_OK;
480  } else {
481  /* Read back register value and check if write process was successful */
482  if (fs8xStatusOk !=
484  pInstance->pSpiInterface, &(pInstance->configValues), isFailSafe, registerAddress, &rxTemp)) {
485  retval |= STD_NOT_OK;
486  } else {
487  /* Check if all flags have been cleared: '1' is written to registers to clear respective flags */
488  if ((rxTemp.readData & registerValue) == 0u) {
489  /* Written register value equals read value */
490  SBC_UpdateRegister(pInstance, isFailSafe, registerAddress, rxTemp.readData);
491  } else {
492  retval |= STD_NOT_OK;
493  }
494  }
495  }
496  return retval;
497 }
498 
499 /*========== Extern Function Implementations ================================*/
501  FAS_ASSERT(pInstance != NULL_PTR);
502 
503  STD_RETURN_TYPE_e retval = STD_OK;
504  uint16_t registerMask = 0u;
505  uint16_t expRegisterValue = 0u;
506  uint16_t registerValue = 0u;
507 
508  FAS_ASSERT(pInstance != NULL_PTR);
509  /* Default init value: #STD_NOT_OK, will be set to #STD_OK later in init if
510  no short-circuit between FIN and RSTB detected. Do not apply external
511  clock on this pin until finState == #STD_OK */
512  FAS_ASSERT(pInstance->fin.finState == STD_NOT_OK);
513 
514  /** First: Verify following conditions:
515  1. Verify LBIST (logical-built-in-self-test) and ABIST1 (analog-built-in-self-test1) are pass
516  2. Verify Debug mode is not activated
517  3. Verify there is no OTP CRC error
518  4. Verify PGOOD was released: PGOOD is connected to power-on-reset of the MCU
519 
520  Second: Configure FS_I and FS_I_NOT registers
521 
522  - Write the desired data in the FS_I_Register_A (DATA)
523  - Write the opposite in the FS_I_NOT_Register_A (DATA_NOT)
524  - Only the utility bits must be inverted in the DATA_NOT content. The RESERVED bits are not considered and can be
525  written at '0'. If the comparison result is correct, then the REG_CORRUPT is set to '0'. If the comparison result
526  is wrong, then the REG_CORRUPT bit is set to '1'. The REG_CORRUPT monitoring is active as soon as the INIT_FS is
527  closed by the first good watchdog refresh. INIT_FS must be closed by the first good watchdog refresh before 256ms
528  timeout.
529 
530  1. Configure VCOREMON_OV_UV impact on RSTB and FS0B
531  2. Configure VDDIO_OV_UV impact on RSTB and FS0B
532  3. Configure VMONx_OV_UV impact on RSTB and FS0B
533  4. Configure ABIST2 assignment
534  5. Configure the WD window period, the WD window duty cycle, the WD counters limits,
535  and its impact on RSTB and FS0B. Ensure that the configuration does not violate the
536  FTTI requirement at system level.
537  6. Configure the Fault Error Counter limit and its impact on RSTB and FS0B at
538  intermediate value
539  7. Configure the RSTB pulse duration
540  8. Configure MCU FCCU error monitoring and its impact on RSTB and FS0B
541  9. Configure Ext. IC error monitoring and its impact on RSTB and FS0B
542  10.Configure FS0B short to high impact on RSTB
543 
544  Third: Execute
545 
546  1. Close INIT_FS by sending the first good WD refresh
547  2. Execute ABIST2 and verify it is pass
548  3. Clear all the flags by writing in FS_DIAG_SAFETY, FS_OVUVREG_STATUS
549  4. Clear the fault error counter to 0 with consecutive good WD refresh
550  5. Perform RSTB path check (repeat steps 1 to 4 after RSTB is released)
551  6. Release FS0B pin
552  7. Perform FS0B safety path check
553  8. Refresh the WD according to its configuration
554  9. Check FS_GRL_FLAGS register after each WD refresh
555 
556  The FS85 is now ready. If everything is OK for the MCU, it can release its own
557  safety path and the ECU starts.
558  */
559 
560  /* --------------------- First: Verify --------------------------------- */
561 
562  /** 1.: Verify LBIST and ABIST1 */
563  if (STD_OK != SBC_ReadBackRegister(pInstance, true, FS8X_FS_DIAG_SAFETY_ADDR)) {
564  retval = STD_NOT_OK;
565  }
567  expRegisterValue = (FS8X_FS_LBIST_OK_PASS | FS8X_FS_ABIST1_OK_PASS);
568  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.diag_safety & registerMask), expRegisterValue)) {
569  retval = STD_NOT_OK;
570  }
571 
572  /** Read FS STATES register */
573  if (STD_OK != SBC_ReadBackRegister(pInstance, true, FS8X_FS_STATES_ADDR)) {
574  retval = STD_NOT_OK;
575  }
576 
577  /** 2.: Check if debug mode is active */
578  registerMask = FS8X_FS_DBG_MODE_MASK;
579  expRegisterValue = FS8X_FS_DBG_MODE_NO_DEBUG;
580  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.states & registerMask), expRegisterValue)) {
581  /* Debug mode active: this can only be the case if debugger connected */
583  pInstance->mode = SBC_DEBUG_MODE;
584  } else {
585  /* Debug mode not active: no debugger connected */
587  pInstance->mode = SBC_NORMAL_MODE;
588  }
589 
590  /** 3.: Verify that no OPT CRC error */
591  registerMask = FS8X_FS_OTP_CORRUPT_MASK;
592  expRegisterValue = FS8X_FS_OTP_CORRUPT_NO_ERROR;
593  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.states & registerMask), expRegisterValue)) {
594  retval = STD_NOT_OK;
595  }
596 
597  /** -------- Second: Configure fail-safe init registers ------------------*/
598  /** Check if SBC is in FS_INIT state, if not switch SBC in FS_INIT state.
599  * Specific configurations can only be done in FS_INIT state */
600  registerMask = FS8X_FS_FSM_STATE_MASK;
601  expRegisterValue = FS8X_FS_FSM_STATE_INIT_FS;
602  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.states & registerMask), expRegisterValue)) {
603  /* SBC not in FS_INIT state -> request FS_INIT state */
604  /* Write FS_STATE request */
606  if (STD_OK != SBC_WriteRegisterFsInit(pInstance, FS8X_FS_SAFE_IOS_ADDR, registerValue)) {
607  retval = STD_NOT_OK;
608  } else {
609  /* Check if SBC now in FS_STATE */
610  if (STD_OK != SBC_ReadBackRegister(pInstance, true, FS8X_FS_STATES_ADDR)) {
611  retval = STD_NOT_OK;
612  } else {
613  /* Read register now check if SBC in FS_INIT state */
614  if (STD_OK !=
615  SBC_CheckRegisterValues((pInstance->fsRegister.states & registerMask), expRegisterValue)) {
616  /* SBC not in FS_INIT state -> error */
617  retval = STD_NOT_OK;
618  }
619  }
620  }
621  }
622 
623  /** 1.: Configure VCOREMON_OV_UV impact on RSTB and FS0B */
624  /** 2.: Configure VDDIO_OV_UV impact on RSTB and FS0B */
625  /** 4.: Configure ABIST2 assignment */
626  registerValue = 0;
627 
628  /** Select VCOREMON_OV options:
629  * - FS8X_FS_I_VCOREMON_OV_FS_IMPACT_NO_EFFECT
630  * - FS8X_FS_I_VCOREMON_OV_FS_IMPACT_FS0B
631  * - FS8X_FS_I_VCOREMON_OV_FS_IMPACT_FS0B_RSTB */
633 
634  /** Select VCOREMON_UV options:
635  * - FS8X_FS_I_VCOREMON_UV_FS_IMPACT_NO_EFFECT
636  * - FS8X_FS_I_VCOREMON_UV_FS_IMPACT_FS0B
637  * - FS8X_FS_I_VCOREMON_UV_FS_IMPACT_FS0B_RSTB */
639 
640  /** Select VDDIO_OV options:
641  * - FS8X_FS_I_VDDIO_OV_FS_IMPACT_NO_EFFECT
642  * - FS8X_FS_I_VDDIO_OV_FS_IMPACT_FS0B
643  * - FS8X_FS_I_VDDIO_OV_FS_IMPACT_FS0B_RSTB */
645 
646  /** Select VDDIO_UV options:
647  * - FS8X_FS_I_VDDIO_UV_FS_IMPACT_NO_EFFECT
648  * - FS8X_FS_I_VDDIO_UV_FS_IMPACT_FS0B
649  * - FS8X_FS_I_VDDIO_UV_FS_IMPACT_FS0B_RSTB */
651 
652  /** Select ABIST2 options:
653  * + VCOREMON
654  * - FS8X_FS_I_VCOREMON_ABIST2_NO_ABIST
655  * - FS8X_FS_I_VCOREMON_ABIST2_VCOREMON_BIST
656  * + VDDIO
657  * - FS8X_FS_I_VDDIO_ABIST2_NO_ABIST
658  * - FS8X_FS_I_VDDIO_ABIST2_VDDIO_BIST
659  * + VMONx (VMON1 - VMON4)
660  * - FS8X_FS_I_VMONx_ABIST2_NO_ABIST
661  * - FS8X_FS_I_VMONx_ABIST2_VMONx_BIST */
663  registerValue |= FS8X_FS_I_VDDIO_ABIST2_VDDIO_BIST;
664  registerValue |= FS8X_FS_I_VMON1_ABIST2_VMON1_BIST;
665  registerValue |= FS8X_FS_I_VMON2_ABIST2_VMON2_BIST;
666  registerValue |= FS8X_FS_I_VMON3_ABIST2_VMON3_BIST;
667  registerValue |= FS8X_FS_I_VMON4_ABIST2_VMON4_BIST;
668 
669  /* Write register */
670  if (STD_OK != SBC_WriteBackRegisterFsInit(pInstance, FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR, registerValue)) {
671  retval = STD_NOT_OK;
672  }
673 
674  /** 3.: Configure VMONx_OV_UV impact on RSTB and FS0B */
675  registerValue = 0;
676  /** Select VMONx_OV options:
677  * - FS8X_FS_I_VMONx_OV_FS_IMPACT_NO_EFFECT
678  * - FS8X_FS_I_VMONx_OV_FS_IMPACT_FS0B
679  * - FS8X_FS_I_VMONx_OV_FS_IMPACT_FS0B_RSTB */
684 
685  /** Select VMONx_UV options:
686  * - FS8X_FS_I_VMONx_UV_FS_IMPACT_NO_EFFECT
687  * - FS8X_FS_I_VMONx_UV_FS_IMPACT_FS0B
688  * - FS8X_FS_I_VMONx_UV_FS_IMPACT_FS0B_RSTB */
693 
694  /* Write register */
695  if (STD_OK != SBC_WriteBackRegisterFsInit(pInstance, FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR, registerValue)) {
696  retval = STD_NOT_OK;
697  }
698 
699  /** 5.: Configure the WD window period, the WD window duty cycle, the WD counters limits, and its impact on RSTB and
700  FS0B. Ensure that the configuration does not violate the FTTI requirement at system level. */
701  registerValue = 0;
702 
703  /** WD window period options:
704  * - FS8X_FS_WD_WINDOW_DISABLE
705  * - FS8X_FS_WD_WINDOW_xxxxMS */
706  registerValue |= FS8X_FS_WD_WINDOW_128MS;
707 
708  /** WD window duty cycle options:
709  * - FS8X_FS_WDW_DC_31_25
710  * - FS8X_FS_WDW_DC_37_5
711  * - FS8X_FS_WDW_DC_50
712  * - FS8X_FS_WDW_DC_62_5
713  * - FS8X_FS_WDW_DC_68_75 */
714  registerValue |= FS8X_FS_WDW_DC_50;
715 
716  /** WD fault recovery strategy
717  * - FS8X_FS_WDW_RECOVERY_DISABLE
718  * - FS8X_FS_WDW_RECOVERY_xxxxMS */
719  registerValue |= FS8X_FS_WDW_RECOVERY_128MS;
720 
721  /* Write register */
722  if (STD_OK != SBC_WriteBackRegisterFsInit(pInstance, FS8X_FS_WD_WINDOW_ADDR, registerValue)) {
723  retval = STD_NOT_OK;
724  }
725 
726  /** 6.: Configure the Fault Error Counter limit and its impact on RSTB and FS0B at intermediate value */
727  /** Configure the RSTB pulse duration */
728  /** Configure FS0B short to high impact on RSTB */
729  registerValue = 0;
730 
731  /** Fault Error Counter limit options:
732  * - FS8X_FS_I_FLT_ERR_CNT_LIMIT_2
733  * - FS8X_FS_I_FLT_ERR_CNT_LIMIT_4
734  * - FS8X_FS_I_FLT_ERR_CNT_LIMIT_6
735  * - FS8X_FS_I_FLT_ERR_CNT_LIMIT_8 */
736  registerValue |= FS8X_FS_I_FLT_ERR_CNT_LIMIT_8;
737 
738  /** Fault Error Counter impact options:
739  * - FS8X_FS_I_FLT_ERR_IMPACT_NO_EFFECT
740  * - FS8X_FS_I_FLT_ERR_IMPACT_FS0B
741  * - FS8X_FS_I_FLT_ERR_IMPACT_FS0B_RSTB */
742  registerValue |= FS8X_FS_I_FLT_ERR_IMPACT_FS0B_RSTB;
743 
744  /** 7.: RSTB pulse duration options:
745  * - FS8X_FS_I_RSTB_DUR_1MS
746  * - FS8X_FS_I_RSTB_DUR_10MS */
747  registerValue |= FS8X_FS_I_RSTB_DUR_10MS;
748 
749  /** 10.: FS0B short to high impact on RSTB options:
750  * - FS8X_FS_I_FS0B_SC_HIGH_CFG_NO_ASSERTION
751  * - FS8X_FS_I_FS0B_SC_HIGH_CFG_RESET_ASSERTED */
753 
754  /** After POR fault-error counter is set to 1 on default, it is reset after two consecutive good WD refreshes. This
755  part of the register is read-only so a write access has no influence. Set this bit for a successful comparison
756  between written and read register value */
757  registerValue |= FS8X_FS_I_FLT_ERR_CNT_1;
758 
759  /* Write register */
760  if (STD_OK != SBC_WriteRegisterFsInit(pInstance, FS8X_FS_I_FSSM_ADDR, registerValue)) {
761  retval = STD_NOT_OK;
762  }
763 
764  /** 8.: Configure MCU FCCU error monitoring and its impact on RSTB and FS0B */
765  /** 9.: Configure Ext. IC error monitoring and its impact on RSTB and FS0B */
766  registerValue = 0;
767 
768  /** MCU FCCU error monitoring options:
769  * + Input option:
770  * - FS8X_FS_I_FCCU_CFG_NO_MONITORING
771  * - FS8X_FS_I_FCCU_CFG_FCCU1_INPUT
772  * - FS8X_FS_I_FCCU_CFG_FCCU1_FCCU2_INPUT
773  * - FS8X_FS_I_FCCU_CFG_FCCU1_FCCU2_PAIR (bi-stable protocol)
774  * + Polarity option (independent):
775  * - FS8X_FS_I_FCCUx_FLT_POL_FCCUx_L
776  * - FS8X_FS_I_FCCUx_FLT_POL_FCCUx_H
777  * + Polarity option (bi-stable)
778  * - FS8X_FS_I_FCCU12_FLT_POL_FCCU1_L_FCCU2_H
779  * - FS8X_FS_I_FCCU12_FLT_POL_FCCU1_H_FCCU2_L
780  * + Impact option (independent)
781  * - FS8X_FS_I_FCCUx_FS_REACT_FS0B
782  * - FS8X_FS_I_FCCUx_FS_REACT_FS0B_RSTB
783  * + Impact option (bi-stable)
784  * - FS8X_FS_I_FCCU12_FS_IMPACT_FS0B
785  * - FS8X_FS_I_FCCU12_FS_IMPACT_FS0B_RSTB
786  */
787  registerValue |= FS8X_FS_I_FCCU_CFG_NO_MONITORING;
788  registerValue |= FS8X_FS_I_FCCU1_FLT_POL_FCCU1_L;
789  registerValue |= FS8X_FS_I_FCCU1_FS_REACT_FS0B;
790 
791  /** Ext. IC error monitoring options:
792  * + Polarity options:
793  * - FS8X_FS_I_ERRMON_FLT_POLARITY_NEGATIVE_EDGE
794  * - FS8X_FS_I_ERRMON_FLT_POLARITY_POSITIVE_EDGE
795  * + Error acknowledgment time options:
796  * - FS8X_FS_I_ERRMON_ACK_TIME_1MS
797  * - FS8X_FS_I_ERRMON_ACK_TIME_8MS
798  * - FS8X_FS_I_ERRMON_ACK_TIME_16MS
799  * - FS8X_FS_I_ERRMON_ACK_TIME_32MS
800  * + Error monitoring impact options:
801  * - FS8X_FS_I_ERRMON_FS_IMPACT_FS0B
802  * - FS8X_FS_I_ERRMON_FS_IMPACT_FS0B_RSTB */
804  registerValue |= FS8X_FS_I_ERRMON_ACK_TIME_32MS;
805  registerValue |= FS8X_FS_I_ERRMON_FS_IMPACT_FS0B;
806 
807  /* Write register */
808  if (STD_OK != SBC_WriteRegisterFsInit(pInstance, FS8X_FS_I_SAFE_INPUTS_ADDR, registerValue)) {
809  retval = STD_NOT_OK;
810  }
811 
812  /* -------------------- Third: Execute --------------------------------- */
813 
814  /** 1.: Close INIT_FS by sending the first good WD refresh */
815  if (STD_OK != SBC_TriggerWatchdog(pInstance)) {
816  retval = STD_NOT_OK;
817  }
818  /** 2.: Execute ABIST2 and verify it is pass */
819  /** ABIST2 is executed automatically after closing of INIT_FS, duration: 1.2ms max */
820  MCU_Delay_us(1200u);
821 
822  if (STD_OK != SBC_ReadBackRegister(pInstance, true, FS8X_FS_DIAG_SAFETY_ADDR)) {
823  retval = STD_NOT_OK;
824  }
825  registerMask = FS8X_FS_ABIST2_OK_MASK;
826  expRegisterValue = FS8X_FS_ABIST2_OK_MASK;
827  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.diag_safety & registerMask), expRegisterValue)) {
828  retval = STD_NOT_OK;
829  }
830 
831  /** 3.: Clear all the flags by writing in FS_DIAG_SAFETY */
832  registerValue = 0;
833  /** Flags are cleared by writing '1' to register */
835  registerValue |= FS8X_FS_ERRMON_ERROR_DETECTED;
837  registerValue |=
841  if (STD_OK != SBC_ClearRegisterFlags(pInstance, FS8X_FS_DIAG_SAFETY_ADDR, true, registerValue)) {
842  retval = STD_NOT_OK;
843  }
844 
845  /** Clear all the flags by writing in FS_OVUVREG_STATUS */
846  registerValue = 0;
847  /** Flags are cleared by writing '1' to register */
850  registerValue |=
856  registerValue |= FS8X_FS_FS_OSC_DRIFT_OSCILLATOR_DRIFT;
857  if (STD_OK != SBC_ClearRegisterFlags(pInstance, FS8X_FS_OVUVREG_STATUS_ADDR, true, registerValue)) {
858  retval = STD_NOT_OK;
859  }
860 
861  /** Clear flags FLAG1 register */
862  registerValue = FS8X_M_VBOSUVH_EVENT_OCCURRED;
863  registerValue |= FS8X_M_VBOOSTUVH_EVENT_OCCURRED;
864  if (STD_OK != SBC_ClearRegisterFlags(pInstance, FS8X_M_FLAG1_ADDR, false, registerValue)) {
865  retval = STD_NOT_OK;
866  }
867 
868  /** Clear flags FLAG2 register */
869  registerValue = FS8X_M_VSUPUV7_EVENT_OCCURRED;
870  registerValue |=
873  if (STD_OK != SBC_ClearRegisterFlags(pInstance, FS8X_M_FLAG2_ADDR, false, registerValue)) {
874  retval = STD_NOT_OK;
875  }
876 
877  /** Read out all registers for debug purpose */
878  if (STD_OK != SBC_ReadBackAllRegisters(pInstance)) {
879  retval = STD_OK;
880  }
881 
882  return retval;
883 }
884 
886  FS85_STATE_s *pInstance,
887  uint8_t *requiredWatchdogRefreshes) {
888  FAS_ASSERT(pInstance != NULL_PTR);
889  FAS_ASSERT(requiredWatchdogRefreshes != NULL_PTR);
890 
891  STD_RETURN_TYPE_e retval = STD_OK;
892 
893  /** Clear the fault error counter to 0 with consecutive good WD refreshes.
894  * The watchdog refresh counter is used to decrement the fault error counter. Each time the watchdog is properly
895  * refreshed, the watchdog refresh counter is incremented by '1'. Each time the watchdog refresh counter reaches
896  * its maximum value ('6' by default) and if next WD refresh is also good, the fault error counter is decremented
897  * by '1'. Whatever the position the watchdog refresh counter is in, each time there is a wrong refresh watchdog,
898  * the watchdog refresh counter is reset to '0'. */
899 
900  /** Read out FS_I_WD_CFG register to get watchdog refresh counter limit and value */
901  if (STD_OK != SBC_ReadBackRegister(pInstance, true, FS8X_FS_I_WD_CFG_ADDR)) {
902  retval = STD_NOT_OK;
903  }
904 
905  /** Get refresh counter value */
906  uint8_t watchdogRefreshLimit = 0;
907  uint8_t watchdogRefreshCounter = FS8x_BO_GET_REG_VALUE(
909 
910  /** Get refresh counter limit register value */
914  watchdogRefreshLimit = 6u;
915  } else if (
919  watchdogRefreshLimit = 4u;
920  } else if (
924  watchdogRefreshLimit = 2u;
925  } else {
926  watchdogRefreshLimit = 1u;
927  }
928 
929  /** Get fault error counter */
930  uint8_t faultCounter = 0u;
931  if (fs8xStatusOk !=
932  FS8x_GetFaultErrorCounterValue(pInstance->pSpiInterface, &(pInstance->configValues), &faultCounter)) {
933  retval = STD_NOT_OK;
934  }
935 
936  /** Get number of required watchdog refreshes to clear fault error counter to 0 */
937  *requiredWatchdogRefreshes = faultCounter + (watchdogRefreshLimit - watchdogRefreshCounter);
938 
939  return retval;
940 }
941 
943  FAS_ASSERT(pInstance != NULL_PTR);
944  /* AXIVION Routine Generic-MissingParameterAssert: parameters without assertion accept whole range of data type */
945 
946  STD_RETURN_TYPE_e retval = STD_OK;
947 
948  /* Check fault error counter */
949  uint8_t faultCounter = 0u;
950  retval |= FS8x_GetFaultErrorCounterValue(pInstance->pSpiInterface, &(pInstance->configValues), &faultCounter);
951  if (faultCounter != 0u) {
952  retval = STD_NOT_OK;
953  }
954  return retval;
955 }
956 
958  FAS_ASSERT(pInstance != NULL_PTR);
959 
960  STD_RETURN_TYPE_e retval = STD_OK;
961 
962  /* Perform RSTB path check (repeat steps 1 to 4 after RSTB is released) */
963  if (STD_OK != SBC_PerformPathCheckRstb(pInstance)) {
964  retval = STD_NOT_OK;
965  }
966 
967  /* FS0B pin can not be released in debug mode */
968  if (pInstance->mode != SBC_DEBUG_MODE) {
969  /* Release FS0B pin */
970  if (fs8xStatusOk != FS8x_FS0B_Release(pInstance->pSpiInterface, &(pInstance->configValues))) {
971  retval = STD_NOT_OK;
972  }
973  }
974 
975  /* Perform FS0B safety path check */
976  if (STD_OK != SBC_PerformPathCheckFs0b(pInstance)) {
977  retval = STD_NOT_OK;
978  }
979 
980  /* Init finished successfully if retval still okay */
981  if (retval == STD_OK) {
982  pInstance->nvram.data->phase = (uint8_t)SBC_INITIALIZED;
983  FRAM_WriteData(pInstance->nvram.entry);
984  }
985  return retval;
986 }
987 
988 /* AXIVION Next Codeline Style CodingStyle-Naming.Function: The name is pre-defined by the driver provided by NXP. */
990  SPI_INTERFACE_CONFIG_s *pSpiInterface,
991  uint8_t *txFrame,
992  uint16_t frameLengthBytes,
993  uint8_t *rxFrame) {
994  FAS_ASSERT(pSpiInterface != NULL_PTR);
995  FAS_ASSERT(txFrame != NULL_PTR);
996  FAS_ASSERT(rxFrame != NULL_PTR);
997  /* AXIVION Routine Generic-MissingParameterAssert: frameLengthBytes: parameter accepts whole range */
998 
999  uint16_t sbc_txBuffer[FS8x_COMM_FRAME_SIZE];
1000  uint16_t sbc_rxBuffer[FS8x_COMM_FRAME_SIZE];
1001  fs8x_status_t spiCommunicationState = fs8xStatusError;
1002 
1003  /* Copy TX data in TX array, reset RX array */
1004  for (uint8_t i = 0u; i < FS8x_COMM_FRAME_SIZE; i++) {
1005  sbc_txBuffer[FS8x_COMM_FRAME_SIZE - 1u - i] = (uint16_t)txFrame[i]; /* txFrame[0] will be sent last */
1006  sbc_rxBuffer[i] = 0;
1007  }
1008 
1009  STD_RETURN_TYPE_e spiRetval =
1010  SPI_TransmitReceiveData(pSpiInterface, sbc_txBuffer, sbc_rxBuffer, FS8x_COMM_FRAME_SIZE);
1011 
1012  if (spiRetval == STD_OK) {
1013  /* No error flag set - copy RX data in RX array */
1014  for (uint8_t i = 0u; i < FS8x_COMM_FRAME_SIZE; i++) {
1015  rxFrame[i] = (uint8_t)sbc_rxBuffer[FS8x_COMM_FRAME_SIZE - 1u - i];
1016  }
1017  spiCommunicationState = fs8xStatusOk;
1018  }
1019 
1020  return spiCommunicationState;
1021 }
1022 
1024  FAS_ASSERT(pInstance != NULL_PTR);
1025 
1026  STD_RETURN_TYPE_e retval = STD_NOT_OK;
1027  if (fs8xStatusOk == FS8x_WD_Refresh(pInstance->pSpiInterface, &(pInstance->configValues))) {
1028  /* Check GRL_FLAGS register if watchdog refresh was valid */
1029  if (STD_OK == SBC_ReadBackRegister(pInstance, true, FS8X_FS_GRL_FLAGS_ADDR)) {
1030  uint16_t registerMask = FS8X_FS_FS_WD_G_MASK;
1031  uint16_t expRegisterValue = FS8X_FS_FS_WD_G_GOOD_WD_REFRESH;
1032  if (STD_OK == SBC_CheckRegisterValues((pInstance->fsRegister.grl_flags & registerMask), expRegisterValue)) {
1033  /* GOOD watchdog refresh */
1034  retval = STD_OK;
1035  } else {
1036  /* BAD watchdog refresh: get reason */
1037  if (STD_OK == SBC_ReadBackRegister(pInstance, true, FS8X_FS_DIAG_SAFETY_ADDR)) {
1038  registerMask = FS8X_FS_BAD_WD_TIMING_MASK;
1039  expRegisterValue = FS8X_FS_BAD_WD_TIMING_BAD_WD_REFRESH;
1040  if (STD_OK ==
1041  SBC_CheckRegisterValues((pInstance->fsRegister.diag_safety & registerMask), expRegisterValue)) {
1042  /* TODO: Notify someone: bad watchdog refresh was caused by wrong window or in timeout */
1043  }
1044  registerMask = FS8X_FS_BAD_WD_DATA_MASK;
1045  expRegisterValue = FS8X_FS_BAD_WD_DATA_BAD_WD_REFRESH;
1046  if (STD_OK ==
1047  SBC_CheckRegisterValues((pInstance->fsRegister.diag_safety & registerMask), expRegisterValue)) {
1048  /* TODO: Notify someone: bad watchdog refresh was caused by error in data */
1049  }
1050  }
1051  }
1052  }
1053  }
1054  return retval;
1055 }
1056 
1058  FAS_ASSERT(pInstance != NULL_PTR);
1059 
1060  STD_RETURN_TYPE_e retval = STD_OK;
1061 
1062  /* Read all fail-safe registers */
1063  SBC_ReadBackRegister(pInstance, true, FS8X_FS_GRL_FLAGS_ADDR);
1066  SBC_ReadBackRegister(pInstance, true, FS8X_FS_I_WD_CFG_ADDR);
1068  SBC_ReadBackRegister(pInstance, true, FS8X_FS_I_FSSM_ADDR);
1069  SBC_ReadBackRegister(pInstance, true, FS8X_FS_I_SVS_ADDR);
1070  SBC_ReadBackRegister(pInstance, true, FS8X_FS_WD_WINDOW_ADDR);
1071  SBC_ReadBackRegister(pInstance, true, FS8X_FS_WD_SEED_ADDR);
1072  SBC_ReadBackRegister(pInstance, true, FS8X_FS_WD_ANSWER_ADDR);
1075  SBC_ReadBackRegister(pInstance, true, FS8X_FS_SAFE_IOS_ADDR);
1077  SBC_ReadBackRegister(pInstance, true, FS8X_FS_INTB_MASK_ADDR);
1078  SBC_ReadBackRegister(pInstance, true, FS8X_FS_STATES_ADDR);
1079 
1080  /* Read main registers */
1081  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_FLAG_ADDR);
1082  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_MODE_ADDR);
1083  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_REG_CTRL1_ADDR);
1084  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_REG_CTRL2_ADDR);
1085  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_AMUX_ADDR);
1086  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_CLOCK_ADDR);
1087  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_INT_MASK1_ADDR);
1088  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_INT_MASK2_ADDR);
1089  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_FLAG1_ADDR);
1090  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_FLAG2_ADDR);
1091  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_VMON_REGX_ADDR);
1092  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_LVB1_SVS_ADDR);
1093  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_MEMORY0_ADDR);
1094  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_MEMORY1_ADDR);
1095  SBC_ReadBackRegister(pInstance, FALSE, FS8X_M_DEVICEID_ADDR);
1096  return retval;
1097 }
1098 
1100  FAS_ASSERT(pInstance != NULL_PTR);
1101 
1102  STD_RETURN_TYPE_e retval = STD_OK;
1103  resetSource_t rstReason = MINFO_GetResetSource();
1104  bool test_assertionRSTB = false; /* Do not test RSTB assertion on default */
1105 
1106  /** Assertion of RSTB pin will trigger reset, check if reset reason was power-cycle.
1107  If so, check if short circuit between FIN and RSTB pin exists */
1108  if (rstReason == POWERON_RESET) {
1109  /** First check if FIN is used */
1110  if (pInstance->fin.finUsed == true) {
1111  /** Write to NVRAM to determine after reset and if short-circuit
1112  * between RSTB and FIN present what exactly caused the reset. */
1113  pInstance->nvram.data->phase = (uint8_t)SBC_FIN_TEST;
1114  FRAM_WriteData(pInstance->nvram.entry);
1115 
1116  /** MCU SBC is connected to ECLK1 -> privilege mode is required to access register */
1118 
1119  /** Last reset was caused by power-cycle */
1120  /** Set level of FIN pin low and check if this generates reset */
1121  IO_PinReset(pInstance->fin.pGIOport, pInstance->fin.pin);
1122 
1123  /** Pulses longer than 2000ns trigger reset -> wait 10us to check if
1124  reset is triggered by short between RSTB and FIN */
1125  MCU_Delay_us(10u);
1126 
1127  /** If we reach this line of code, no reset has taken place.
1128  Everything okay. Set level of FIN pin back to high */
1129  IO_PinSet(pInstance->fin.pGIOport, pInstance->fin.pin);
1130 
1131  /** No further register access required -> leave privilege mode */
1133 
1134  /** FIN state okay, no short circuit. Update also in nvram struct */
1136  pInstance->fin.finState = STD_OK;
1137  pInstance->nvram.data->finState = STD_OK;
1138 
1139  /** Continue with RSTB assertion test */
1140  test_assertionRSTB = false;
1141  } else {
1142  /** Power-cycle but no FIN pin used -> continue with RSTB check */
1143  test_assertionRSTB = false;
1144  }
1145  } else if (rstReason == EXT_RESET) {
1146  /** Last reset reason was external reset via nRST pin (EXT_RESET)
1147  Readout FRAM to determine in which state the SBC was prior to reset */
1148  FRAM_ReadData(pInstance->nvram.entry);
1149  if ((SBC_INIT_PHASE_e)pInstance->nvram.data->phase == SBC_FIN_TEST) {
1150  /** Short-circuit between FIN and RSTB: Do not apply CLK on FIN */
1151  /** Update nvram FIN state */
1152  pInstance->nvram.data->finState = STD_NOT_OK;
1153  /** FIN state not okay, but still in SBC init phase after power-cycle
1154  * continue now with RSTB assertion */
1155  test_assertionRSTB = false;
1156  } else if ((SBC_INIT_PHASE_e)pInstance->nvram.data->phase == SBC_RSTB_ASSERTION_TEST) {
1157  /** Reset was triggered by SPI RSTB assertion test -> continue with SBC init phase */
1158  test_assertionRSTB = false;
1159 
1160  /** Diagnosis of the RSTB pin/event is available by reading the FS_SAFE_IOs register:
1161  * RSTB_EVENT bit reports an activation of RSTB pin. */
1162  SBC_ReadBackRegister(pInstance, true, FS8X_FS_SAFE_IOS_ADDR);
1163 
1164  /** Check RSTB_EVENT if RSTB has been activated */
1165  if (STD_OK ==
1168  /** RSTB pin should be sensed high and no RSTB short to high */
1170  uint16_t expRegisterValue =
1173  if (STD_OK != SBC_CheckRegisterValues((pInstance->fsRegister.safeIos & mask), expRegisterValue)) {
1174  retval = STD_NOT_OK;
1175  }
1176  /** Reset RSTB_EVENT flag */
1178  /** Update diag flag */
1180  } else {
1181  /** RSTB has not been activated but this should have been the case */
1182  retval = STD_NOT_OK;
1184  }
1185  } else {
1186  /** Reset was not caused by SBC initialization or power-cycle.
1187  * Continue with SBC init phase as RSTB assertion is only tested
1188  * after power-cycle occurred */
1189  test_assertionRSTB = false;
1190  }
1191  /** Copy FIN state info from nvram variable into local state variable. This restores lost data from rest or
1192  updates local FIN state if short-circuit between FIN and RSTB has been detected */
1193  pInstance->fin.finState = pInstance->nvram.data->finState;
1194  if (pInstance->fin.finState == STD_OK) {
1196  } else {
1198  }
1199  } else {
1200  /** Reset was not caused by power-cycle or SBC. SBC has already been initialized successfully after detected
1201  * power-cycle. Everything okay. Read FIN state from NVRAM and continue with normal operation */
1202  FRAM_ReadData(pInstance->nvram.entry);
1203  test_assertionRSTB = false;
1204  pInstance->fin.finState = pInstance->nvram.data->finState;
1205  if (pInstance->fin.finState == STD_OK) {
1207  } else {
1209  }
1210  }
1211 
1212  /** Verify the hardware connection between the MCU reset pin and the FS85 reset pin */
1213  if (test_assertionRSTB == true) {
1214  /** Write to NVRAM to determine after reset and if RSTB was asserted correctly */
1215  pInstance->nvram.data->phase = (uint8_t)SBC_RSTB_ASSERTION_TEST;
1216  FRAM_WriteData(pInstance->nvram.entry);
1217 
1218  SBC_ReadBackRegister(pInstance, true, FS8X_FS_STATES_ADDR);
1219 
1220  uint16_t registerValue = FS8X_FS_RSTB_REQ_RSTB_ASSERTION;
1221  SBC_WriteRegisterFsInit(pInstance, FS8X_FS_SAFE_IOS_ADDR, registerValue);
1222 
1223  while (true) {
1224  ;
1225  }
1226 
1227  /* Controller should never reach this point as reset via RSTB is requested */
1228  }
1229  return retval;
1230 }
1231 
1233  FAS_ASSERT(pInstance != NULL_PTR);
1234 
1235  STD_RETURN_TYPE_e retval = STD_OK;
1236  /* TBD */
1237  return retval;
1238 }
1239 
1240 /*========== Externalized Static Function Implementations (Unit Test) =======*/
1241 #ifdef UNITY_UNIT_TEST
1242 extern STD_RETURN_TYPE_e TEST_SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue) {
1243  return SBC_CheckRegisterValues(registerValue, expectedRegisterValue);
1244 }
1245 
1247  FS85_STATE_s *pInstance,
1248  bool isFailSafe,
1249  uint32_t registerAddress,
1250  uint32_t registerValue) {
1251  return SBC_UpdateRegister(pInstance, isFailSafe, registerAddress, registerValue);
1252 }
1253 
1255  FS85_FS_REGISTER_s *pFsRegister,
1256  uint32_t registerAddress,
1257  uint32_t registerValue) {
1258  return SBC_UpdateFailSafeRegister(pFsRegister, registerAddress, registerValue);
1259 }
1260 
1262  FS85_MAIN_REGISTERS_s *pMainRegister,
1263  uint32_t registerAddress,
1264  uint32_t registerValue) {
1265  return SBC_UpdateMainRegister(pMainRegister, registerAddress, registerValue);
1266 }
1267 
1268 #endif
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
Definition: diag.c:246
Diagnosis driver header.
@ DIAG_EVENT_NOT_OK
Definition: diag_cfg.h:266
@ DIAG_EVENT_OK
Definition: diag_cfg.h:265
@ DIAG_SYSTEM
Definition: diag_cfg.h:278
@ DIAG_ID_SBC_RSTB_STATE
Definition: diag_cfg.h:236
@ DIAG_ID_SBC_FIN_STATE
Definition: diag_cfg.h:235
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
Definition: fassert.h:250
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Definition: fassert.h:129
FRAM_RETURN_TYPE_e FRAM_ReadData(FRAM_BLOCK_ID_e blockId)
Reads a variable from the FRAM.
Definition: fram.c:211
FRAM_RETURN_TYPE_e FRAM_WriteData(FRAM_BLOCK_ID_e blockId)
Writes a variable to the FRAM.
Definition: fram.c:133
Header for the driver for the FRAM module.
FRAM_SBC_INIT_s fram_sbcInit
Definition: fram_cfg.c:73
@ FRAM_BLOCK_ID_SBC_INIT_STATE
Definition: fram_cfg.h:107
Definition of foxBMS standard types.
STD_RETURN_TYPE_e
Definition: fstd_types.h:82
@ STD_NOT_OK
Definition: fstd_types.h:84
@ STD_OK
Definition: fstd_types.h:83
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:77
Function to switch between user mode and privilege mode.
#define FSYS_SwitchToUserMode()
Switch back to user mode.
Definition: fsystem.h:135
long FSYS_RaisePrivilege(void)
Raise privilege.
Definition: test_htsensor.c:67
#define UNIT_TEST_WEAK_IMPL
Definition: general.h:95
fs8x_status_t FS8x_GetFaultErrorCounterValue(SPI_INTERFACE_CONFIG_s *spiInterface, fs8x_drv_data_t *drvData, uint8_t *faultErrorCounterValue)
Reads actual Fault Error Counter value.
Definition: sbc_fs8x.c:270
fs8x_status_t FS8x_WD_Refresh(SPI_INTERFACE_CONFIG_s *spiInterface, fs8x_drv_data_t *drvData)
Performs the watchdog refresh.
Definition: sbc_fs8x.c:160
fs8x_status_t FS8x_WriteRegisterInit(SPI_INTERFACE_CONFIG_s *pSpiInterface, fs8x_drv_data_t *drvData, uint8_t address, uint16_t writeData)
Performs a write to a single FS8x FS init register (during the INIT_FS phase only).
fs8x_status_t FS8x_WriteRegister(SPI_INTERFACE_CONFIG_s *pSpiInterface, fs8x_drv_data_t *drvData, bool isFailSafe, uint8_t address, uint16_t writeData)
Sends write command to the FS8x.
fs8x_status_t FS8x_FS0B_Release(SPI_INTERFACE_CONFIG_s *spiInterface, fs8x_drv_data_t *drvData)
FS0B release routine.
Definition: sbc_fs8x.c:184
fs8x_status_t FS8x_ReadRegister(SPI_INTERFACE_CONFIG_s *pSpiInterface, fs8x_drv_data_t *drvData, bool isFailSafe, uint8_t address, fs8x_rx_frame_t *rxData)
Performs a read from a single FS8x register.
fs8x_status_t
Status return codes.
@ fs8xSPI
@ fs8xStatusOk
@ fs8xStatusError
UNIT_TEST_WEAK_IMPL fs8x_status_t MCU_SPI_TransferData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint8_t *txFrame, uint16_t frameLengthBytes, uint8_t *rxFrame)
This function transfers single frame through blocking SPI communication in both directions....
Definition: nxpfs85xx.c:989
void IO_PinSet(volatile uint32_t *pRegisterAddress, uint32_t pin)
Set pin by writing in pin output register.
Definition: io.c:91
void IO_PinReset(volatile uint32_t *pRegisterAddress, uint32_t pin)
Reset pin by writing in pin output register.
Definition: io.c:98
Header for the driver for the IO module.
resetSource_t MINFO_GetResetSource(void)
Get reason for last reset.
Definition: masterinfo.c:86
void MINFO_SetDebugProbeConnectionState(MINFO_DEBUG_PROBE_CONNECTION_STATE_e state)
Check if debug probe is connected.
Definition: masterinfo.c:90
General foxBMS-master system information.
@ MINFO_DEBUG_PROBE_CONNECTED
Definition: masterinfo.h:70
@ MINFO_DEBUG_PROBE_NOT_CONNECTED
Definition: masterinfo.h:69
void MCU_Delay_us(uint32_t delay_us)
Wait blocking a certain time in microseconds.
Definition: mcu.c:89
Headers for the driver for the MCU module.
static void SBC_UpdateMainRegister(FS85_MAIN_REGISTERS_s *pMainRegister, uint32_t registerAddress, uint32_t registerValue)
Updates main register values.
Definition: nxpfs85xx.c:307
static void SBC_UpdateRegister(FS85_STATE_s *pInstance, bool isFailSafe, uint32_t registerAddress, uint32_t registerValue)
Updates register values.
Definition: nxpfs85xx.c:366
STD_RETURN_TYPE_e FS85_InitializeNumberOfRequiredWatchdogRefreshes(FS85_STATE_s *pInstance, uint8_t *requiredWatchdogRefreshes)
Calculates the number of required watchdog refresh to reset fault error counter.
Definition: nxpfs85xx.c:885
void TEST_SBC_UpdateRegister(FS85_STATE_s *pInstance, bool isFailSafe, uint32_t registerAddress, uint32_t registerValue)
Definition: nxpfs85xx.c:1246
static void SBC_UpdateFailSafeRegister(FS85_FS_REGISTER_s *pFsRegister, uint32_t registerAddress, uint32_t registerValue)
Updates fail safe register values.
Definition: nxpfs85xx.c:245
static STD_RETURN_TYPE_e SBC_ReadBackRegister(FS85_STATE_s *pInstance, bool isFailSafe, uint8_t registerAddress)
Reads SBC register value.
Definition: nxpfs85xx.c:384
static STD_RETURN_TYPE_e SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue)
Checks register value against expected value.
Definition: nxpfs85xx.c:235
FS85_STATE_s fs85xx_mcuSupervisor
Definition: nxpfs85xx.c:84
STD_RETURN_TYPE_e FS85_InitializeFsPhase(FS85_STATE_s *pInstance)
Configures SBC during INIT_FS phase.
Definition: nxpfs85xx.c:500
static STD_RETURN_TYPE_e SBC_PerformPathCheckRstb(FS85_STATE_s *pInstance)
Perform RSTB safety path check.
Definition: nxpfs85xx.c:1099
static STD_RETURN_TYPE_e SBC_PerformPathCheckFs0b(FS85_STATE_s *pInstance)
Perform FS0B safety path check.
Definition: nxpfs85xx.c:1232
STD_RETURN_TYPE_e SBC_TriggerWatchdog(FS85_STATE_s *pInstance)
Trigger watchdog.
Definition: nxpfs85xx.c:1023
STD_RETURN_TYPE_e TEST_SBC_CheckRegisterValues(uint32_t registerValue, uint32_t expectedRegisterValue)
Definition: nxpfs85xx.c:1242
void TEST_SBC_UpdateFailSafeRegister(FS85_FS_REGISTER_s *pFsRegister, uint32_t registerAddress, uint32_t registerValue)
Definition: nxpfs85xx.c:1254
void TEST_SBC_UpdateMainRegister(FS85_MAIN_REGISTERS_s *pMainRegister, uint32_t registerAddress, uint32_t registerValue)
Definition: nxpfs85xx.c:1261
static STD_RETURN_TYPE_e SBC_WriteRegisterFsInit(FS85_STATE_s *pInstance, uint8_t registerAddress, uint16_t registerValue)
Write to fail-safe register.
Definition: nxpfs85xx.c:404
static STD_RETURN_TYPE_e SBC_ClearRegisterFlags(FS85_STATE_s *pInstance, uint8_t registerAddress, bool isFailSafe, uint16_t registerValue)
Clears flags in register.
Definition: nxpfs85xx.c:460
static STD_RETURN_TYPE_e SBC_ReadBackAllRegisters(FS85_STATE_s *pInstance)
Definition: nxpfs85xx.c:1057
STD_RETURN_TYPE_e FS85_SafetyPathChecks(FS85_STATE_s *pInstance)
Performs SBC safety path checks.
Definition: nxpfs85xx.c:957
SBC_INIT_PHASE_e
Definition: nxpfs85xx.c:76
@ SBC_UNINITIALIZED
Definition: nxpfs85xx.c:77
@ SBC_FIN_TEST
Definition: nxpfs85xx.c:78
@ SBC_INITIALIZED
Definition: nxpfs85xx.c:80
@ SBC_RSTB_ASSERTION_TEST
Definition: nxpfs85xx.c:79
static STD_RETURN_TYPE_e SBC_WriteBackRegisterFsInit(FS85_STATE_s *pInstance, uint8_t registerAddress, uint16_t registerValue)
Write to fail-safe register.
Definition: nxpfs85xx.c:426
STD_RETURN_TYPE_e FS85_CheckFaultErrorCounter(FS85_STATE_s *pInstance)
Checks if fault error counter is zero.
Definition: nxpfs85xx.c:942
Header for the driver for the FRAM module.
@ SBC_DEBUG_MODE
Definition: nxpfs85xx.h:114
@ SBC_NORMAL_MODE
Definition: nxpfs85xx.h:113
#define FS8x_WD_SEED_DEFAULT
Watchdog seed default value.
Definition: sbc_fs8x.h:59
#define FS8x_BO_GET_REG_VALUE(value, mask, shift)
Macro for getting value from register.
#define FS8x_COMM_FRAME_SIZE
#define FS8X_FS_I_FLT_ERR_IMPACT_FS0B_RSTB
#define FS8X_FS_VDDIO_UV_UNDERVOLTAGE_REPORTED
#define FS8X_FS_I_WD_RFR_CNT_MASK
#define FS8X_FS_BAD_WD_TIMING_MASK
#define FS8X_FS_VMON2_OV_OVERVOLTAGE_REPORTED
#define FS8X_M_VBOOSTUVH_EVENT_OCCURRED
#define FS8X_FS_I_ERRMON_FS_IMPACT_FS0B
#define FS8X_FS_VCOREMON_OV_OVERVOLTAGE_REPORTED
#define FS8X_FS_FCCU1_ERROR_DETECTED
#define FS8X_FS_RSTB_DIAG_MASK
#define FS8X_FS_I_FCCU_CFG_NO_MONITORING
#define FS8X_FS_RSTB_REQ_RSTB_ASSERTION
#define FS8X_M_WK2FLG_EVENT_OCCURRED
#define FS8X_FS_I_ERRMON_FLT_POLARITY_POSITIVE_EDGE
#define FS8X_M_INT_MASK2_ADDR
#define FS8X_FS_I_VMON2_UV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_I_ERRMON_ACK_TIME_32MS
#define FS8X_FS_WDW_DC_50
#define FS8X_FS_FSM_STATE_INIT_FS
#define FS8X_FS_I_FCCU1_FLT_POL_FCCU1_L
#define FS8X_FS_ABIST1_OK_PASS
#define FS8X_FS_I_VMON2_ABIST2_VMON2_BIST
#define FS8X_FS_I_VMON4_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_DBG_MODE_MASK
#define FS8X_M_MEMORY1_ADDR
#define FS8X_FS_ABIST2_OK_MASK
#define FS8X_FS_I_VMON3_ABIST2_VMON3_BIST
#define FS8X_FS_RSTB_EVENT_MASK
#define FS8X_FS_SPI_FS_CRC_ERROR_DETECTED
#define FS8X_FS_I_WD_RFR_LIMIT_2
#define FS8X_FS_SPI_FS_CLK_WRONG_NUMBER_OF_CLOCK_CYCLES
#define FS8X_FS_LBIST_OK_MASK
#define FS8X_FS_BAD_WD_DATA_BAD_WD_REFRESH
#define FS8X_FS_I2C_FS_CRC_ERROR_DETECTED
#define FS8X_FS_WD_ANSWER_ADDR
#define FS8X_FS_VMON3_UV_UNDERVOLTAGE_REPORTED
#define FS8X_FS_FSM_STATE_MASK
#define FS8X_M_REG_CTRL2_ADDR
Definition: sbc_fs8x_map.h:696
#define FS8X_M_VBOSUVH_EVENT_OCCURRED
#define FS8X_FS_I_VDDIO_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_RSTB_DIAG_NO_FAILURE
#define FS8X_FS_RSTB_EVENT_RESET_OCCURRED
#define FS8X_FS_RELEASE_FS0B_ADDR
#define FS8X_FS_WD_WINDOW_ADDR
#define FS8X_FS_VCOREMON_UV_UNDERVOLTAGE_REPORTED
#define FS8X_FS_I_VDDIO_UV_FS_IMPACT_NO_EFFECT
#define FS8X_M_DEVICEID_ADDR
#define FS8X_M_FLAG1_ADDR
#define FS8X_FS_BAD_WD_TIMING_BAD_WD_REFRESH
#define FS8X_FS_I_VMON2_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_I2C_FS_REQ_I2C_VIOLATION
#define FS8X_M_VMON_REGX_ADDR
#define FS8X_FS_I_RSTB_DUR_10MS
#define FS8X_FS_I_WD_RFR_LIMIT_SHIFT
#define FS8X_FS_I_VDDIO_ABIST2_VDDIO_BIST
#define FS8X_M_VSUPUVL_EVENT_OCCURRED
#define FS8X_FS_I_VMON4_ABIST2_VMON4_BIST
#define FS8X_FS_ERRMON_ERROR_DETECTED
#define FS8X_M_REG_CTRL1_ADDR
Definition: sbc_fs8x_map.h:432
#define FS8X_FS_I_VCOREMON_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_RSTB_SNS_PAD_SENSED_HIGH
#define FS8X_FS_VMON4_UV_UNDERVOLTAGE_REPORTED
#define FS8X_FS_I_VCOREMON_UV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_I_FLT_ERR_CNT_1
#define FS8X_M_FLAG_ADDR
Definition: sbc_fs8x_map.h:57
#define FS8X_FS_WD_SEED_ADDR
#define FS8X_FS_I_VMON3_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_I_WD_RFR_LIMIT_6
#define FS8X_M_MODE_ADDR
Definition: sbc_fs8x_map.h:304
#define FS8X_FS_VMON4_OV_OVERVOLTAGE_REPORTED
#define FS8X_FS_RSTB_DRV_COMMAND_SENSED_HIGH
#define FS8X_FS_I_WD_RFR_LIMIT_MASK
#define FS8X_FS_DBG_MODE_NO_DEBUG
#define FS8X_FS_I_VMON3_UV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_OTP_CORRUPT_MASK
#define FS8X_FS_I_FS0B_SC_HIGH_CFG_NO_ASSERTION
#define FS8X_FS_I_VMON1_ABIST2_VMON1_BIST
#define FS8X_FS_WD_WINDOW_128MS
#define FS8X_FS_I_SAFE_INPUTS_ADDR
#define FS8X_FS_INTB_MASK_ADDR
#define FS8X_FS_SAFE_IOS_ADDR
#define FS8X_M_CLOCK_ADDR
#define FS8X_FS_I_OVUV_SAFE_REACTION1_ADDR
#define FS8X_M_VSUPUVH_EVENT_OCCURRED
#define FS8X_FS_OVUVREG_STATUS_ADDR
#define FS8X_FS_I_FSSM_ADDR
#define FS8X_FS_FS_OSC_DRIFT_OSCILLATOR_DRIFT
#define FS8X_FS_I_WD_CFG_ADDR
#define FS8X_FS_VMON2_UV_UNDERVOLTAGE_REPORTED
#define FS8X_FS_FS_DIG_REF_OV_OVERVOLTAGE_REPORTED
#define FS8X_FS_FS_WD_G_MASK
#define FS8X_FS_DIAG_SAFETY_ADDR
#define FS8X_FS_I_VMON1_UV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_FCCU12_ERROR_DETECTED
#define FS8X_FS_VMON1_OV_OVERVOLTAGE_REPORTED
#define FS8X_FS_RSTB_DRV_MASK
#define FS8X_M_VPREUVH_EVENT_OCCURRED
#define FS8X_FS_VMON1_UV_UNDERVOLTAGE_REPORTED
#define FS8X_M_VSUPUV7_EVENT_OCCURRED
#define FS8X_M_INT_MASK1_ADDR
#define FS8X_FS_I_VMON1_OV_FS_IMPACT_NO_EFFECT
#define FS8X_FS_VMON3_OV_OVERVOLTAGE_REPORTED
#define FS8X_FS_WDW_RECOVERY_128MS
#define FS8X_FS_RSTB_SNS_MASK
#define FS8X_FS_I_SVS_ADDR
#define FS8X_FS_VDDIO_OV_OVERVOLTAGE_REPORTED
#define FS8X_M_LVB1_SVS_ADDR
#define FS8X_FS_I_FCCU1_FS_REACT_FS0B
#define FS8X_FS_SPI_FS_REQ_SPI_VIOLATION
#define FS8X_M_FLAG2_ADDR
#define FS8X_FS_I_WD_RFR_CNT_SHIFT
#define FS8X_FS_FS_WD_G_GOOD_WD_REFRESH
#define FS8X_FS_I_FLT_ERR_CNT_LIMIT_8
#define FS8X_FS_GO_TO_INITFS_GO_BACK_TO_INIT_FS
#define FS8X_FS_I_OVUV_SAFE_REACTION2_ADDR
#define FS8X_FS_I_VMON4_UV_FS_IMPACT_NO_EFFECT
#define FS8X_M_VPREUVL_EVENT_OCCURRED
#define FS8X_FS_OTP_CORRUPT_NO_ERROR
#define FS8X_FS_ABIST1_OK_MASK
#define FS8X_FS_LBIST_OK_PASS
#define FS8X_FS_BAD_WD_DATA_MASK
#define FS8X_FS_I_WD_RFR_LIMIT_4
#define FS8X_M_AMUX_ADDR
Definition: sbc_fs8x_map.h:882
#define FS8X_FS_STATES_ADDR
#define FS8X_M_MEMORY0_ADDR
#define FS8X_FS_I_VCOREMON_ABIST2_VCOREMON_BIST
#define FS8X_FS_GRL_FLAGS_ADDR
#define FS8X_FS_FCCU2_ERROR_DETECTED
STD_RETURN_TYPE_e SPI_TransmitReceiveData(SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16 *pTxBuff, uint16 *pRxBuff, uint32 frameLength)
Transmits and receives data on SPI without DMA.
Definition: spi.c:220
SPI_INTERFACE_CONFIG_s spi_sbcMcuInterface
Definition: spi_cfg.c:231
uint8_t phase
Definition: fram_cfg.h:131
STD_RETURN_TYPE_e finState
Definition: fram_cfg.h:132
volatile uint32_t * pGIOport
Definition: nxpfs85xx.h:121
STD_RETURN_TYPE_e finState
Definition: nxpfs85xx.h:120
uint16_t diag_safety
Definition: nxpfs85xx.h:87
uint16_t releaseFs0bPin
Definition: nxpfs85xx.h:85
uint16_t i_svs
Definition: nxpfs85xx.h:80
uint16_t iWatchdogConfiguration
Definition: nxpfs85xx.h:77
uint16_t watchdogAnswer
Definition: nxpfs85xx.h:83
uint16_t overvoltageUndervoltageRegisterStatus
Definition: nxpfs85xx.h:84
uint16_t i_safe_inputs
Definition: nxpfs85xx.h:78
uint16_t iOvervoltageUndervoltageSafeReaction2
Definition: nxpfs85xx.h:76
uint16_t safeIos
Definition: nxpfs85xx.h:86
uint16_t watchdogSeed
Definition: nxpfs85xx.h:82
uint16_t iFailSafeSateMachine
Definition: nxpfs85xx.h:79
uint16_t grl_flags
Definition: nxpfs85xx.h:74
uint16_t watchdogWindow
Definition: nxpfs85xx.h:81
uint16_t states
Definition: nxpfs85xx.h:89
uint16_t intb_mask
Definition: nxpfs85xx.h:88
uint16_t iOvervoltageUndervoltageSafeReaction1
Definition: nxpfs85xx.h:75
uint16_t registerControl1
Definition: nxpfs85xx.h:97
uint16_t registerControl2
Definition: nxpfs85xx.h:98
uint16_t analogMultiplexer
Definition: nxpfs85xx.h:99
FRAM_BLOCK_ID_e entry
Definition: nxpfs85xx.h:127
FRAM_SBC_INIT_s * data
Definition: nxpfs85xx.h:128
FS85_MAIN_REGISTERS_s mainRegister
Definition: nxpfs85xx.h:136
FS85_OPERATION_MODE_e mode
Definition: nxpfs85xx.h:139
FS85_FS_REGISTER_s fsRegister
Definition: nxpfs85xx.h:137
FS85_NVRAM_INFO_s nvram
Definition: nxpfs85xx.h:138
FS85_FIN_CONFIGURATION_s fin
Definition: nxpfs85xx.h:135
fs8x_drv_data_t configValues
Definition: nxpfs85xx.h:134
SPI_INTERFACE_CONFIG_s * pSpiInterface
Definition: nxpfs85xx.h:133
Structure representing received data frame.
uint16_t readData
Content of a read register.