Other Parts Discussed in Thread: C2000WARE
Dear All,
I tested to enter standby mode and wake up test using TMS320F28377D.
I referenced the source code lpm_standbywake_cpu01.c from the C2000 example.
When I tested the LPM mode, the current consumption changed from 350mA to 180mA.
If you look at the datasheet, it says that idle mode is 105mA from 350mA, and standby mode is 30mA.
1. Is the mode I entered standby mode rather than idle mode?
How do I check which mode it is?
Confirmed changing CpuSysRegs.LPMCR.bit.LPM = 1 in CCS Expressions.
2. I set the wakeup pin to GPIO18.
When pin 18 is high, it enters LPM mode and the current consumption is reduced to 180mA.
Changing pin 18 from high->low changes the GPIODataRegs value from 1->0 in the CCS expression and the current draw is back to 350mA.
But the mcu doesn't work normally.
(In normal operation, the LED on the board is toggled, but in my test, the LED does not work.)
I don't know what's wrong in the source code.
3. There is a function related to flash in the example. If this function is added, the mcu does not work.
Is it irrelevant to omit?
//
// Ensure there are no subsequent flash accesses to wake up the pump and
// bank Power down the flash bank and pump
//
//SeizeFlashPump();
//FlashOff();
//ReleaseFlashPump();
I attach LPM-related sources among the sources I have written.
thank you for your help.
main source
#include "F28x_Project.h" // Function Prototypes // void Gpio_setup(void); void PwmTimerIsrSetUp(void); __interrupt void local_WAKE_ISR(void); void main(void) { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2837xD_SysCtrl.c file. // InitSysCtrl(); InitGpio(); // Step 2. Initialize GPIO: // This example function is found in the F2837xD_Gpio.c file and // illustrates how to set the GPIO to it's default state. Gpio_setup(); // enable PWM1, PWM2 and PWM3 CpuSysRegs.PCLKCR2.bit.EPWM1=1; //CpuSysRegs.PCLKCR2.bit.EPWM2=1; //CpuSysRegs.PCLKCR2.bit.EPWM3=1; // Step 3. Clear all __interrupts and initialize PIE vector table: // Disable CPU __interrupts DINT; // global interrupt switch off // Initialize PIE control registers to their default state. // The default state is all PIE __interrupts disabled and flags // are cleared. // This function is found in the F2837xD_PieCtrl.c file. //PIE(Peripheral Interrupt Expansion) initializing //PIE disable and PIEIER, PIEIER register clear InitPieCtrl(); // Disable CPU __interrupts and clear all CPU __interrupt flags: IER = 0x0000; //Core Interrupts Enable Resister initializing IFR = 0x0000; //Core Interrupts Flag Resister initializing // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the __interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F2837xD_DefaultIsr.c. // This function is found in F2837xD_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.WAKE_INT = &local_WAKE_ISR; EDIS; // Enable CPU INT1 which is connected to WakeInt: IER |= M_INT1; // Enable WAKEINT in the PIE: Group 1 interrupt 8 PieCtrlRegs.PIEIER1.bit.INTx8 = 1; PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; PieCtrlRegs.PIEACK.bit.ACK1 = 1; // Enable global Interrupts: EINT; PwmTimerIsrSetUp(); // Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM // Step 4. User specific code: // // Ensure there are no subsequent flash accesses to wake up the pump and // bank Power down the flash bank and pump // // SeizeFlashPump(); // FlashOff(); // ReleaseFlashPump(); // enter STANDBY mode STANDBY(); for(;;) { } } /* ----------------------------------------------- */ /* ISR for WAKEINT - Will be executed when */ /* low pulse triggered on GPIO pin */ /* ------------------------------------------------*/ interrupt void local_WAKE_ISR(void) { PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; PieCtrlRegs.PIEACK.bit.ACK1 = 1; }
GPIO Set
#include "F28x_Project.h" void Gpio_setup(void); void InitSciaGpio(void); void Gpio_setup(void) { EALLOW; GpioCtrlRegs.GPAMUX1.all = 0x00000000; // All GPIO GpioCtrlRegs.GPAMUX2.all = 0x00000000; // All GPIO GpioCtrlRegs.GPBMUX1.all = 0x00000000; // All GPIO GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF; // All outputs GpioCtrlRegs.GPBDIR.all = 0x00001FFF; // All outputs // HeartBit LED // 20191107 SHD GpioCtrlRegs.GPDMUX1.bit.GPIO99 = 0; GpioCtrlRegs.GPDDIR.bit.GPIO99 = 1; //20230630 the external wake-up source //GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pullup on GPIO25 GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 0; // 0=GPIO GpioCtrlRegs.GPADIR.bit.GPIO18 = 0; // 1=OUTput, 0=INput CpuSysRegs.GPIOLPMSEL0.bit.GPIO18 = 1; // GPIO24 will wake the device CpuSysRegs.LPMCR.bit.QUALSTDBY = 2; // Qualify GPIO24 by 2 OSCCLK EDIS; GPIO_SetupPinMux(16, GPIO_MUX_CPU1, 0); // PWM InitEPwmGpio(); }