I have put the break point after STANDBY(), and it bypassed the breakpoint, and have read the register values and also de-initialized the LPSPI and disabled the Global IRQ.
/* ###################################################################
** Filename : main.c
** Processor : S32K1xx
** Abstract :
** Main module.
** This module contains user's application code.
** Settings :
** Contents :
** No public methods
**
** ###################################################################*/
/*!
** @file main.c
** @version 01.00
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
/* Including necessary module. Cpu.h contains other modules needed for compiling.*/
#include "Cpu.h"
#include "main.h"
volatile int exit_code = 0;
/* User includes (#include below this line is not maintained by Processor Expert) */
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void) {
/* Write your local variable definition here */
uint32_t pend = 0;
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
// Battery Parameters
EMO_param.pack_over_voltage_limit = 58.8;
EMO_param.pack_under_voltage_limit = 35.0;
EMO_param.cell_over_voltage_limit = 4.200;
EMO_param.cell_under_voltage_limit = 2.500;
EMO_param.charger_request_voltage = 58.1;
EMO_param.charger_request_current = 45.0;
EMO_param.charging_float_voltage = 57.5;
EMO_param.voltage_overshoot_threshold = 60;
EMO_param.discharging_float_voltage = 37.0;
EMO_param.over_current_limit_discharging = 144.0;
EMO_param.mosfet_gain_test = 0x78;
EMO_param.current_offset_test = 4;
EMO_param.over_tempurature_limit = 58;
EMO_param.tempurature_fan_on = 45;
EMO_param.tempurature_fan_off = 40;
EMO_param.dod_max_voltage = 42;
EMO_param.dod_min_voltage = 25;
EMO_param.charger_end_current = 4;
// Initialize the peripherals and it's applications
peripheral_init();
peripheral_initialize();
// Initialize the battery configurations and it's parameters
battery_config(&EMO_param);
LL_mDelay(100);
// State is idle and event1
bms_sm_T = sleep;
bms_event_T = event1;
//
// status_t retV = POWER_SYS_SetMode(1U, POWER_MANAGER_POLICY_AGREEMENT);
// if (retV == STATUS_SUCCESS) {
// if (POWER_SYS_GetCurrentMode() == POWER_MANAGER_RUN) {
// PINS_DRV_WritePin(PTD, 10U, 0);
// PINS_DRV_WritePin(PTD, 11U, 1);
// bms_sm_T = init;
// bms_event_T = event1;
// } else {
// PINS_DRV_WritePin(PTD, 10U, 1);
// PINS_DRV_WritePin(PTD, 11U, 0);
// }
// }
// Initialize the AFE
ISL78714_status_T = isl_init();
if (ISL78714_status_T == E_OK) {
for (uint8_t i = 0; i < no_of_devices; i++) {
ISL78714_status_T = measurment_fault_detect(ADDRESS_OFFSET + i);
module_param_T[i] = module_param();
ISL78714_status_T = fault_read(ADDRESS_OFFSET + i);
module_param_T[i] = module_fault();
battery_param[0] = 0U;
battery_param[1] = 0U;
battery_param[2] = 0U;
battery_param[3] = 0U;
battery_param[4] = module_param_T[0].modV >> 8;
battery_param[5] = module_param_T[0].modV;
battery_param[6] = module_error[0];
battery_param[7] = 0U;
}
}
else {
SET(module_error[0], AFE_COM_ERROR);
}
//peripheral_deinit();
LPSPI_DRV_MasterDeinit(LPSPICOM1);
INT_SYS_DisableIRQGlobal();
/* Set power mode to VLPS */
status_t retV = POWER_SYS_SetMode(1U, POWER_MANAGER_POLICY_AGREEMENT);
if (retV == STATUS_SUCCESS) {
if (POWER_SYS_GetCurrentMode() == POWER_MANAGER_RUN) {
PINS_DRV_WritePin(PTD, 10U, 0);
PINS_DRV_WritePin(PTD, 11U, 1);
bms_sm_T = init;
bms_event_T = event1;
} else {
PINS_DRV_WritePin(PTD, 10U, 1);
PINS_DRV_WritePin(PTD, 11U, 0);
}
}
LL_mDelay(10);
while (1) {
#if V4
// Toggle the LED
PINS_DRV_TogglePins(PTD, 1 << 10U);
PINS_DRV_TogglePins(PTD, 1 << 11U);
#endif
bms_sm();
}
/* For example: for(;;) { } */
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.1 [05.21]
** for the NXP S32K series of microcontrollers.
**
** ###################################################################
*/