Part Number: TMS320F28034
Other Parts Discussed in Thread: CONTROLSUITE
Dear C2000 expert,
Currently I'm trying to wake up F28034 from halt mode via pulling low the GPIO25, but sometimes it's failed, and somtimes it's OK.
My code is referenced with demo code in controlsuite: (C:\ti\controlSUITE\device_support\f2803x\v130\DSP2803x_examples_ccsv5\lpm_haltwake), please see attached for more details.
/*
* f2803x_lpm.c
*
* Created on: 2018-4-16
* Author: Administrator
*/
#include "global.h"
#include "Driver.h"
#include "General.h"
#include "f2803x_lpm.h"
__interrupt void f2803x_lpm_wake_isr(void);
void init_f2803x_lpm(void)
{
EALLOW;
//GpioCtrlRegs.GPAPUD.bit.GPIO25 = 1;
//GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 0; //GPIO
GpioCtrlRegs.GPADIR.bit.GPIO25 = 0; // 0 - input mode; 1 - output mode
GpioIntRegs.GPIOLPMSEL.bit.GPIO25 = 1; // Choose GPIO8 pin for wakeup
EDIS;
// 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.WAKEINT = &f2803x_lpm_wake_isr;
EDIS;
}
void f2803x_lpm_handler(void)
{
static TIMER_T tTime; //3Sʱ���ʱ
App_TimeBase(MS_BASE, &tTime);
if(GpioDataRegs.GPADAT.bit.GPIO25 == 1)
{
if(tTime.DelayTime >= 1000)
{
// 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.bit.ACK1 = 1;
// Enable global Interrupts:
EINT; // Enable Global interrupt INTM
// Write the LPM code value
EALLOW;
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1) // Only enter low power mode when PLL is not in limp mode.
{
SysCtrlRegs.LPMCR0.bit.LPM = 0x0002; // LPM mode = Halt
}
EDIS;
// Force device into HALT
__asm(" IDLE"); // Device waits in IDLE until falling edge on GPIO0/XNMI pin
}
}
else
{
tTime.DelayTime = 0;
}
}
__interrupt void f2803x_lpm_wake_isr(void)
{
//GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1; // Toggle GPIO1 in the ISR - monitored with oscilloscope
PieCtrlRegs.PIEIER1.bit.INTx8 = 1;
PieCtrlRegs.PIEACK.bit.ACK1 = 1;
}
- init_f2803x_lpm is initialization function
- f2803x_lpm_handler is executed in background loop
- f2803x_lpm_wake_isr is interrupt service routine
In my solution, when does GPIO25 goes to high level, then device enter into halt mode(I see the current decreased), but when the GPIO25 goes to low level state, sometimes device won't wake up.
Can you please help on this?