<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>S32K中的主题 Re: Query Regarding VLPS Mode Entry ins S32K146</title>
    <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2018534#M44532</link>
    <description>&lt;P&gt;Thank you, I understand the VLPS is not aborted, there is not wakeup (interrupt masked/disabled), and peripherals that are not used in VLPS are disabled before WFI.&lt;/P&gt;
&lt;P&gt;Can you disconnect the debugger, power cycle the MCU and check the state of the MCU by measuing the power consumption of VDD and the BUS_CLK at CLKOUT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Mon, 23 Dec 2024 10:20:51 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2024-12-23T10:20:51Z</dc:date>
    <item>
      <title>Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2016273#M44388</link>
      <description>&lt;P&gt;I am facing a problem here regarding the entry to VLPS mode in S32K146 MCU. The Code goes into VLPS Mode if i use&amp;nbsp;POWER_SYS_SetMode() API before isl_init() function which uses LPSPI Master Transfer Blocking function to initialize my AFE and comes back to RUN Mode on GPIO Interrupt but if i use the&amp;nbsp;POWER_SYS_SetMode()&amp;nbsp; after isl_init(), the API returns with STATUS_SUCCESS immediately on that instance without any interrupt triggered&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* ###################################################################
 **     Filename    : main.c
 **     Processor   : S32K1xx
 **     Abstract    :
 **         Main module.
 **         This module contains user's application code.
 **     Settings    :
 **     Contents    :
 **         No public methods
 **
 ** ###################################################################*/
/*!
 ** @file main.c
 ** &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/222922"&gt;@version&lt;/a&gt; 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 */

	/*** 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(&amp;amp;EMO_param);
	LL_mDelay(100);
	// State is idle and event1
	bms_sm_T = sleep;
	bms_event_T = event1;

	// Initialize the AFE
	ISL78714_status_T = isl_init();
	if (ISL78714_status_T == E_OK) {
		for (uint8_t i = 0; i &amp;lt; 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 &amp;gt;&amp;gt; 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);
	}
	
	/* Set power mode to VLPS */
	status_t retV = POWER_SYS_SetMode(VLPS_Mode, 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;
			break;
		} 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 &amp;lt;&amp;lt; 10U);
		PINS_DRV_TogglePins(PTD, 1 &amp;lt;&amp;lt; 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.
 **
 ** ###################################################################
 */&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 18:33:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2016273#M44388</guid>
      <dc:creator>KKB</dc:creator>
      <dc:date>2024-12-18T18:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017182#M44425</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/230396"&gt;@KKB&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Once the WFI instruction is executed, there must be an interrupt that brings it back. You can try masking the interrupt just before WFI (PRIMASK = 1), it will then not wakeup.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1734605544853.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/316711iE608E1DF23240A3E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielmartynek_0-1734605544853.png" alt="danielmartynek_0-1734605544853.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Check the NVIC for any pending interrupts right before it goes to VLPS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 10:56:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017182#M44425</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-12-19T10:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017217#M44427</link>
      <description>&lt;P&gt;I have used INT_SYS_DisableIRQGlobal() before going to VLPS mode, still it comes out of VLPS even no Interrupt is triggered. I de-initialized all the peripherals before going to sleep and used the&amp;nbsp;INT_SYS_GetPending to get pending interrupt and there is no pending interrupt as the API returns 0.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:30:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017217#M44427</guid>
      <dc:creator>KKB</dc:creator>
      <dc:date>2024-12-19T12:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017219#M44428</link>
      <description>&lt;P&gt;Is SMC_PMCTRL[VLPSA] set after WFI?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:40:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017219#M44428</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-12-19T12:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017226#M44429</link>
      <description>I didn't get your question, All i am doing is in debug mode before isl_init(), my MCU is going to VLPS and comes out of VLPS when pin interrupt is provided, but if i use the VLPS API after isl_init() which uses LPSPI and there is no ISR assigned to it, it immediately without any interrupt with STATUS_SUCCESS</description>
      <pubDate>Thu, 19 Dec 2024 12:48:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017226#M44429</guid>
      <dc:creator>KKB</dc:creator>
      <dc:date>2024-12-19T12:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017236#M44432</link>
      <description>&lt;P&gt;Can you place breakpoint after STANDBY() and read SMC_PMCTRL[VLPSA] in register view.&lt;/P&gt;
&lt;P&gt;If the bit is set, the VLPS entry gets aborted.&lt;/P&gt;
&lt;P&gt;It might be because of the LPSPI module.&lt;/P&gt;
&lt;P&gt;Can you disable the LPSPI before POWER_SYS_SetMode(VLPS_Mode, ...) is called?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 13:14:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017236#M44432</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-12-19T13:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017655#M44460</link>
      <description>&lt;P&gt;I have put the break point after STANDBY(), and it bypassed the breakpoint, and have read the register values&amp;nbsp;and also de-initialized the LPSPI and disabled the Global IRQ.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* ###################################################################
 **     Filename    : main.c
 **     Processor   : S32K1xx
 **     Abstract    :
 **         Main module.
 **         This module contains user's application code.
 **     Settings    :
 **     Contents    :
 **         No public methods
 **
 ** ###################################################################*/
/*!
 ** @file main.c
 ** &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/222922"&gt;@version&lt;/a&gt; 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(&amp;amp;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 &amp;lt; 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 &amp;gt;&amp;gt; 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 &amp;lt;&amp;lt; 10U);
		PINS_DRV_TogglePins(PTD, 1 &amp;lt;&amp;lt; 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.
 **
 ** ###################################################################
 */&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Dec 2024 06:10:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2017655#M44460</guid>
      <dc:creator>KKB</dc:creator>
      <dc:date>2024-12-20T06:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Query Regarding VLPS Mode Entry ins S32K146</title>
      <link>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2018534#M44532</link>
      <description>&lt;P&gt;Thank you, I understand the VLPS is not aborted, there is not wakeup (interrupt masked/disabled), and peripherals that are not used in VLPS are disabled before WFI.&lt;/P&gt;
&lt;P&gt;Can you disconnect the debugger, power cycle the MCU and check the state of the MCU by measuing the power consumption of VDD and the BUS_CLK at CLKOUT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 10:20:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Query-Regarding-VLPS-Mode-Entry-ins-S32K146/m-p/2018534#M44532</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-12-23T10:20:51Z</dc:date>
    </item>
  </channel>
</rss>

