Cypress技术论坛
直播中

古克满

8年用户 240经验值
私信 关注
[问答]

DEBUG用ICE CUBE睡眠ISR

大家好,
我正在调试睡眠ISR代码,我知道它是否运行得很好!我在用冰块…我想这样做,PSoC 1在X时间(例如20秒)睡觉,并在这个时间醒来后,做一个中断Rutin(1赫兹,CouSun)从ADC获得数据,并将其保存在EEPROM中。中断之后,再睡一次…正如我可以看到的调试器是当程序启动到MC8睡觉时,当我按下F5,进入中断,当它已经完成,返回到睡眠MC8。在这一刻,冰块看起来断开,但电路板CY32 15DK(微型板)正以随机方式转动4个LED。我不知道是否有可能做我想做的事情,如果可能的话,也可以调试器。我使用函数“SypTimeReStimeTime[ BTiKs””,其中BTiKS=20。是否可以实时调试睡眠ISR?我怎么知道一切都好,做我想做的事?谢谢你的反馈!

以上来自于百度翻译


     以下为原文
   Hi everyone,
   
I'm debugging the Sleep ISR code I implement for knowing if it runs well!I'm using a ICE cube...
I would like to do that the PSoC 1 sleeps during X time (20 seconds for example) and wakes up after this time to do an interruption rutine (1 Hz, choosen) to get data from ADC and save it in the eeprom. After the interruption, sleep another time...

As I could see with the debugger is when the program starts goes to MC8 to sleep, when I pressed f5, goes to the interruption and when its has done, return to sleep MC8. In this moment, the ICE cube appears disconnect, but the board CY3215-DK (miniboard) was turning up the 4 leds like a random way.

I don't know if is possible to do what I want and if is possible to debugger too. I use the function "SleepTimer_SetTimer(bticks)" where bticks=20.

Is it possible to debug a Sleep ISR in real time? How can I know that all runs well and do what I want?


Thanks for your feedbacks!

回帖(10)

李富贵

2019-5-13 07:07:00
不幸的是,当执行M8CYSLID时,调试器断开连接。这是因为当处理器进入休眠状态时,IMO停止,调试器需要IMO来维护与POD的连接。为了调试,您可以用下面的指令替换M8CYSLAY指令。而(!)(IntCLR0&AM.MsK00Sead);M8CyCultIngFrand(IntCLR0,IntSK00Sead);该代码所做的是循环,直到产生休眠中断并清除在IntCLR0寄存器中的中断标志。完成调试后,返回M8CYSLAY指令。最好的问候,GSONH PSoC黑客

以上来自于百度翻译


     以下为原文
  Unfortunately, the debugger disconnects when M8C_Sleep is executed.  This is because the IMO stops when the processor goes to sleep and the debugger needs the IMO to maintain the connection with the pod.

For debugging you can replace the M8C_Sleep instruction with the below instructions.

while(!(INT_CLR0 & INT_MSK0_SLEEP));
M8C_ClearIntFlag(INT_CLR0, INT_MSK0_SLEEP);

What this code does is it loops till a sleep interrupt is generated and clears the interrupt flag in the INT_CLR0 register.  When you are done debugging, put back the M8C_Sleep instruction.

Best Regards,
Ganesh
The PSoC Hacker
举报

古克满

2019-5-13 07:26:57
你好,
所以对你的快速反应很有帮助…
因此,正如现在配置的,IFIPWORDEBYA5VBooSpSoC会每隔20秒中断一次?我很喜欢这个函数:SaleTimeReStimeTime[BTiKs ]。如果函数产生它,或者使用SimeTimeReWaTimeTime[ BTiKs ],它对我来说并不清楚。BTICK=20,睡眠计时器=1Hz。我想要什么功能?我实现了第一个,因为我每天都花了8个小时,每一秒钟都要醒来,这是最大的价值。非常感谢你的反馈!

以上来自于百度翻译


     以下为原文
  Hello,
     
     
     
     So helpful has been your fast response ...
Therefore, as it is configured now, if I powered by a 5V battery the PSoC would be an interruption every 20 seconds? I am using the function: SleepTimer_SetTimer (bticks). It is not clear to me if this function produces it or is better to use     SleepTimer_WaitTimer (bticks). With bticks=20 and SleepTimer= 1Hz.   
Which function does what I want? I implemented the first one because I wanted the M8C sleep all the time and only every 20 seconds to wake up it to make a routine ... In addition, there is a maximum value of bticks?

Thank you very much for your feedbacks!
举报

李富贵

2019-5-13 07:34:49
睡眠定时器用户模块不将处理器置于低功耗模式。它只使用睡眠定时器中断产生各种定时功能。不要混淆睡眠计时器的名称。睡眠计时器是一个时钟,可以运行在1Hz,8Hz,16Hz或64赫兹。睡眠计时器用户模块只是使用这个时钟并实现各种计时功能。为了让处理器睡眠20秒,这是一种方法,你可以采取。1。将全局资源中的睡眠间隔配置为1Hz。2。启用睡眠中断3。用一个可变的睡眠计来计算睡眠中断。您可以将此初始化为希望处理器处于低功耗4的休眠中断数。while循环使用如下代码:(1){BSLePeTek=20;同时(BSLEPTEK)!= 0){M8CySale:BSeLeTICK-;} //在这里编写代码,希望在上述代码中执行20秒},每1秒,处理器将唤醒并减少BSLePiTK变量。如果不是零,处理器就会回到睡眠状态。当变量变为零时,它将执行低于时间的代码(BSeLeTICK)!= 0)循环。希望这有帮助。最好的问候,GSONH PSoC黑客

以上来自于百度翻译


     以下为原文
  The SleepTimer user module does not put the processor to low power mode.  It just uses the Sleep Timer interrupt to generate various timing functions.  Do not get confused with the name SleepTimer.  The sleep timer is just a clock that can be run at 1Hz, 8Hz, 16Hz or 64Hz.  The SleepTimer user module just uses this clock and implements various timing functions.

For letting the processor to sleep 20 seconds, this is one approach you could take.

1. Configure the Sleep interval in the Global Resources to 1Hz.
2. Enable the Sleep interrupt
3. Use a variable bSleepTick to count Sleep interrupts.  You would initialize this to the number of Sleep interrupts that you want the processor to be in low power
4. Inside the while loop use a code like below:

while(1)
{
   bSleepTick = 20;
   while (bSleepTick != 0)
   {
      M8C_Sleep;
      bSleepTick--;
   }
  
   // Write code here that you would like to execute once 20 seconds
}

In the above code, every 1 second, processor will wake up and decrement the bSleepTick variable.  If it is not zero, processor will go back to sleep.  When the variable becomes zero, it will execute the code that is below the while(bSleepTick !=0) loop.

Hope this helps.

Best Regards,
Ganesh
The PSoc Hacker
举报

古克满

2019-5-13 07:43:53
嗨,Graa,
再次感谢您的快速响应!
我跟你说的一样,但是我实现了一个ISR睡眠计时器。
我的代码类似于:
语用中断
空隙率(空隙)
{
//这里我输入了我想在SurrUp产生时做PSoC的代码。
睡眠;
返回;
}
空隙主(空隙)
{
It BITKS=20;
M8CyEnabeLeTimeMe掩码(IntMsK0,In MsK00Sead);
M8CB;
睡眠时间;
睡眠时间启动;
睡眠时间定时器(BICKS);
韦勒(1)
{
M8Cl睡眠;
}
}
这个代码和你告诉我的一样吗?使用ISR睡眠计时器有什么不同?
谢谢你的帮助!

以上来自于百度翻译


     以下为原文
   Hi Graa,
    Thanks for your fast response, again!
    I did similar as you told me, but I implemented an ISR SleepTimer.
    My code is similar as:
    #pragma interrupt_handler SleepISR
    void SleepISR(void)
    {
    //here I putted the code I would like to do the PSoC when the interrup is produced
    M8C_ClearWDTAndSleep;
    return;
    }
    void main(void)
    {
    int bticks=20;
    M8C_EnableIntMask(INT_MSK0, INT_MSK0_SLEEP);
    M8C_EnableGInt;
    SleepTimer_EnableInt;
    SleepTimer_Start;
    SleepTimer_SetTimer(bticks); 
     
    wile(1)
    {
     
    M8C_Sleep;
    }
    }
    Does this code do the same as you told me? What's the difference in using the ISR Sleep Timer?
     
    Thanks for your help!
举报

更多回帖

发帖
×
20
完善资料,
赚取积分