完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个项目的CYBLY-02200 - 00在自定义板。(附)
它有WDT和一个按钮冲突 当低功耗模式被禁用时,两者都工作良好。 当它被启用时(在主C中调用函数EnterLowPowerMode)计数器MaunyLoopLyStCyt和O.ISryCalt永远不会递增。 EntLoopPotoMead函数是从E.Prutt的帖子中复制的,类似的问题,所以我毫不怀疑它的工作原理。 有什么想法吗? 谢谢 安迪 LPM-WDT1.ZIP 850.6 K 以上来自于百度翻译 以下为原文 I have a project for a CYBLE-022001-00 on a custom board.(attached) It has WDT and a button interrrupt Both work fine when low power mode is disabled When it is enabled ( function EnterLowPowerMode is called in main.c) the counters main_loop_count and _isr_count never increment. The EnterLowPowerMode function was copied from e.pratt's post for the similar issue so I have no doubts that it works Any ideas ? Thanks Andy
|
|
相关推荐
21个回答
|
|
我相信您的按钮ISR可能会被错误地声明为格式(C++语法很好,只是CyPress语法)
用途: CysISR(BTN-ISR){ /ISR代码 检查程序BTNYSTATE = TRUE; ButoNo.ISW.CultSt除除器(); } 如果没有声明为CyPress中断,编译器的行为可能会有所不同?我知道有中断处理程序的硬件,但我不记得需要做什么来配置,如果有的话。 在我看来,TopDead中的组件声明看起来不错。 以上来自于百度翻译 以下为原文 I believe your button ISR might be declared incorrectly for the format (c++ syntax is fine, just the cypress syntax ) Use: CY_ISR(Btn_Isr) { //Code for ISR here _check_btn_state = TRUE; Button_Isw_ClearInterrupt(); } Potentially, the compiler is behaving differently if it is not declared as a Cypress Interrupt? I know there is the interrupt handler hardware, but I don't remember what needs to be done to configure that if any. The component declarations in the TopDesign look okay to me. |
|
|
|
WDT和Butt在低功耗模式代码被禁用时中断火灾。 WDT ISR使用CyPress语法声明,而按钮不是 当启用电源模式时,两者都不会发生火灾。我将尝试更改按钮声明,并让您知道这是否有帮助。 我怀疑这里还有别的事情发生。 谢谢你 安迪 以上来自于百度翻译 以下为原文 Both WDT and Button interrupts fire just fine when low power mode code is disabled WDT ISR is declared using Cypress syntax and the button is not Both do not fire when power mode is enabled.I'll try changing the button declaration and will let you know if that helped. I suspect something else is going on here. Thank you Andy |
|
|
|
在按钮ISR中使用CyPrS语法没有帮助 我注意到的3件事: 1。不管我让程序运行多长时间,当我暂停它时,它就停在同一个地方。(下图) 2。该设备在CyScript中可见,RSSI值变化,表明至少BLE堆栈正在运行。 但是,没有到达我的断点,主循环和WDT ISR计数器没有增加。 三。WDT ISR点火4次,然后停止。有时它根本不着火,有时火灾2-3次。它应该每800毫秒发射一次 我不明白。这个问题很奇怪地让我想起了我在ISR中的一个外部问题。ISR也在零星地发射。我放弃了一种WDT的方法,它工作得很好,直到我启用低功耗模式。 不知道这些问题是否相关,只是指出它。 以上来自于百度翻译 以下为原文 Using the Cypres syntax in the button ISR did not help 3 things I'm noticing: 1. No matter how long I let the program run it stops at the same place when I pause it.(image below) 2. The device is visible in CySmart and the RSSI values change which indicates that at least the BLE stack is running However none of my breakpoints are reached and the main loop and the WDT ISR counters do not increment 3. The WDT ISR did fire 4 times and then stopped. Sometimes it does not fire at all, sometimes fires 2-3 times. It should fire every 800 ms and I don't see that. The issue is strangely reminiscent of the problem I had with ISR from an external part. There too the ISR was firing sporadically. I abandoned that method in favor of a WDT which worked great until I enabled low power mode. Don't know if these issues are related,just pointing it out. |
|
|
|
1。停止位置就像是与RTC有关,你是否有RTC运行和正常工作而没有低功耗模式?总是跑步吗?还是大部分? 2。你能用CyScript连接到BLE吗?你能读/写/通知值等吗? 三。奇怪的是,它发射了一些次数,然后失败……如果RTC系统棒需要每100毫秒点火才能正常工作,但是该单元进入睡眠,并且不及时启动RTC系统。这可能会引起一些问题,比如失控的程序或扰乱计时器/ WDT。 以上来自于百度翻译 以下为原文 1. The stop location likes like it is something to do with the RTC; Do you have the RTC running and working properly without low power mode? Is it always running? Or just mostly? 2. Are you able to connect to the BLE with CySmart? Can you read/write/notify values etc.? 3. Odd that it fires some number of times then fails...If the RTC systick needs to fire each 100 ms to work properly, but then the unit goes to sleep and doesn't fire the RTC systick in time... That could be causing issues, like a runaway program or messing up timers/WDT. |
|
|
|
在组件声明中确实有RTC,但它没有在这个项目中运行 是的,我可以连接到CySMART和宽带工作的设备,因为RSSI改变了 对于堆栈跟踪总是相同的,第一个函数是yy-SysStAcKy极限,你怎么理解? 看来应用程序崩溃了,但是BLE正在运行。 代码实际上并没有太多,所以我开始怀疑这是否与我的硬件有关。 安迪 以上来自于百度翻译 以下为原文 I do have the RTC in the component declaration but it is not running in this project Yes I can connect to the device with CySmart and broadcasing works because the RSSI changes What do you make of the fact that the stack trace is always the same and the first function is __sy_stack_limit? It appears that the app crashed but BLE is running The code does not really do much so I'm beginning to wonder if this is related to my hardware Andy |
|
|
|
挖掘更深。 我评论了CyBLY启动和CyBLY进程。 所以所有的代码都在主循环中增加计数器,重置WDT并进入低功耗模式。 找到堆栈跟踪中出现的IntultHulthDunter代码。它在CM0Stask.a中有一个注释 我们不能到这儿来。如果我们这样做,就会出现严重的问题,所以进入无限循环。 罪魁祸首似乎是从Enable PrimeMod()调用的函数CysSyCulkFrutHfCKDead(CythySysCLKHfCKKY-ECO)。 此函数中的注释描述了如下所示的CKSELSET参数 CythySyCulkHfCkkimiMo IMO。 CysSysLCKYHFCKKEXCRCK外部时钟引脚。 CythySyCLKYHFCKKY-ECO外部晶体振荡器。适用于 PSoC 4100 BLU/PSOC 4200 BL/PSoC 4200 L。 CysSysLCKYHFCKKLPLL0 PLLα0。适用于PSoC 4200 L。 CysSysLCKYHFCKKLPLL1 PLLα1。适用于PSoC 4200 L。 因此,在我看来,CysSysLCKYHFCKKY-ECO CKSELSET参数导致代码进入无限循环,并最终进入IntDebug。 有什么想法我应该使用时钟选择和可能的原因? 谢谢 安迪 以上来自于百度翻译 以下为原文 Digging deeper. I commented out CyBle_Start and CyBle_ProcessEvents So all the code is doing in the main loop is incrementing the counter, resetting the WDT and entering the low power mode. Found the IntDefaultHandler code that appears in the stack trace. It is in Cm0Start.a and there is a comment We must not get here. If we do, a serious problem occurs, so go into an infinite loop. The culprit seems to be the function CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO) that gets called from EnablePowerMode() The comment in this function describes the clkSelect parameter as follows CY_SYS_CLK_HFCLK_IMO IMO. CY_SYS_CLK_HFCLK_EXTCLK External clock pin. CY_SYS_CLK_HFCLK_ECO External crystal oscillator. Applicable for PSoC 4100 BLE / PSoC 4200 BLE / PSoC 4200L. CY_SYS_CLK_HFCLK_PLL0 PLL#0. Applicable for PSoC 4200L. CY_SYS_CLK_HFCLK_PLL1 PLL#1. Applicable for PSoC 4200L. So it appears that in my case CY_SYS_CLK_HFCLK_ECO clkSelect parameter causes the code to get into an infinite loop and end up in the IntDefaultHandler Any ideas what clock select should I use and possible cause? Thanks Andy |
|
|
|
取决于你想节省多少电量,你会想要关掉尽可能多的时钟,这样你就不需要在睡眠模式下运行。我相信在我的项目中,我使用了ECO,这是蓝牙所需要的,因此我也设置了HFCLK来使用它,并关闭了IMO以节省电力。您选择的时钟必须运行,以使其不崩溃;否则,它归结为时钟速度,以及时钟的使用。我的猜测是,除非你真的需要一点点额外的省电,它可能更容易评论时钟设置功能,让单位离开IMO时钟运行。 以上来自于百度翻译 以下为原文 Depending on how much power you are trying to save, you will want to turn off as many clocks as you can that you don't need running while in sleep mode. I believe in my project I used ECO, as that was required for bluetooth; Thus I set the HFCLK to use it as well, and turned off the IMO to save power. The clock you select has to be running for it to not crash; Otherwise, it comes down to clock speed, and usage of the clock. My guess would be that unless you really need that little bit of extra power saving, it might be easier to just comment out the clock setting functions and let the unit leave IMO clock running. |
|
|
|
PLL0,PLL1,ExtCK是用于特定的情况,生态只有运行,如果你有生态的奔跑,我想,否则就让它在IMO左跑将是我的建议。很高兴你知道这是时钟设置功能 埃普拉特 以上来自于百度翻译 以下为原文 PLL0, PLL1, EXTCLK are used for specific cases, and the ECO only runs if you have the ECO for the BLE running I think, otherwise just leave it on the IMO left running would be my advice. Glad you figured out it was the clock setting function Epratt |
|
|
|
我是否正确理解了,如果时钟不运行,试图给它写,它会崩溃吗?这就是我想要的,但我想确认一下。这就带来了一个问题:我如何知道我在运行什么时钟?我需要节省所有的电能 我评论了CysSLCKLIDHFCKDENT(CythySysCKLYHFLKKY-ECO)并试图执行以下操作 CysSycLimoCo(); CysSpMySeLeP(); SysCLKIMOSTART(); 但是调试程序在CysSycKimoStor()调用之后丢失连接 它在我的系统上工作的唯一方法是当我同时有SYsClokcIMOStop和CysSyCLKWETCHFLKDENT调用注释时。 以上来自于百度翻译 以下为原文 Did I understand you correctly, if the clock is not running, trying to write to it it causes a crash? This is what it looks like to me but I wanted to confirm. That brings a question how do I find out what clocks do I have running? I need all power savings I can get I commented out the CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO) and tried to execute the following CySysClkImoStop(); CySysPmSleep(); SysClkImoStart(); But debugger lost connection after CySysClkImoStop() call The only way it works on my system is when I have both SYsClokcIMOStop and CySysClkWriteHfclkDirect calls commented out. |
|
|
|
更深挖掘 LPM代码如下: CysLyEnLyLPM(CybulyBelssiDeSt入睡) 内部状态= CyTalm临界段(); BelsSt= = CyByLyGETBLISSTATE(); 如果(BelsSt==CyByLyBelsStisteEcOvion on) BelsSt==CyByLyBelsStayeSoeSt入睡) { CysSpMyDeSLeLeP(); } 否则(祝福)!= CyBysBLISStAtEngEnvithCype { //CysSysCKLIDFLCKTEND(CythySyl CKYH-FFLKKY-ECO); //CysSysCykimoCo(); CysSpMySeLeP(); //CysSLCKIMOOSTART(); //CysSysCyrWrdFCKDead(CythySyl CKYH-FFLKKY-IMO); } 细胞分裂切片(内状态); CyBLY-ExITLPM:() -当所有调用时钟的ARRE被称赞并且只有CySysPmSleep被称为WDT计数器时,所有的时间都在递增,但是主循环计数器不增加。当我暂停执行时,堆栈跟踪总是相同的,所以代码似乎停留在CysLyEXITLPME()中,调用CysSpMyS睡觉。这种情况下的堆栈跟踪总是这样的: 0 CysSpMySeLeP()生成的源:pSOC4CyPM.C 44 0x000(02C02)(全部) 1 LLWaWITIOTOEXITIDSDSM()?????????????????0x000 2?????????????????0x000?5dB4(所有) 3?????????????????0x000?5888(所有) 4 CysLyExeLp()?????????????????0x000? 5 EnWorkPosiPoMoDE().Mc.C 94 0x00 000 02DC(全部) 6主()主。C 117 0x00 000 0314(全部) 当我删除CyByLyEXITLPM主循环计数器时,程序会陷入CyByl进程中。 堆栈跟踪在执行暂停时看起来总是这样。 0 CysSpMySeLeP()生成的源:pSOC4CyPM.C 44 0x000(2BFE)(全部) 1 LLWaWITIOTOEXITIDSDSM()?????????????????0x000? 2?????????????????0x000?5DAC(全部) 3 LythTaskHoall()?????????????????0x000?AD54(所有) 4 LLFTTI Service EQueReo()?????????????????0x000?B8A6(所有) 5 LLFFTaskStaskScript程序()?????????????????0x000?b7Fe(全部) 6 CyByth-StastaskHand()?????????????????0x000?43C8(全部) 7 OSO调度程序()?????????????????0x000?538 e(全部) 8 CyByStAcGrMyPrimuleEvestor()?????????????????0x000?3e5a(全部) 9 CyByl进程?????????????????0x000? 10主()主。C 108 0x00 000 02F4(全部) -用CysLyEndoPLM和CybLyEXITLPM注释,BelsStEs总是CybLyBelsStisteA事件关闭,既不叫作CysSpM眠或CysSpMySt入睡。 有什么想法,怎么处理? 谢谢 安迪 以上来自于百度翻译 以下为原文 Digging even deeper The LPM code is as follows: CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) intrStatus = CyEnterCriticalSection(); blessState = CyBle_GetBleSsState(); if((blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)) { CySysPmDeepSleep(); } else if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE) { //CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); // CySysClkImoStop(); CySysPmSleep(); // CySysClkImoStart(); // CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); } CyExitCriticalSection(intrStatus); CyBle_ExitLPM() -. When all calls that manupulate clocks arre commendted out and only CySysPmSleep is called the WDT counter increments all the time but the main loop counter does not.. When I pause execution the stack trace is always the same, so it appears that the code is stuck in Cyble_ExitLPM() which calls CySysPmSleep. The stack trace in this case is always like this: 0 CySysPmSleep() Generated_SourcePSoC4cyPm.c 44 0x00002C02 (All) 1 ll_wait_to_exit_dsm() ?????? ?????? 0x0000661C (All) 2 ll_exit_low_power_mode() ?????? ?????? 0x00005DB4 (All) 3 CyBleController_ExitLowPowerMode() ?????? ?????? 0x0000588E (All) 4 CyBle_ExitLPM() ?????? ?????? 0x000039A2 (All) 5 EnterLowPowerMode() main.c 94 0x000002DC (All) 6 main() main.c 117 0x00000314 (All) - When I remove the CyBle_ExitLPM the main loop counter the program gets stuck in CyBle_ProcessEvents. The stack trace always looks like this on execution pause 0 CySysPmSleep() Generated_SourcePSoC4cyPm.c 44 0x00002BFE (All) 1 ll_wait_to_exit_dsm() ?????? ?????? 0x00006614 (All) 2 ll_exit_low_power_mode() ?????? ?????? 0x00005DAC (All) 3 ll_task_handler() ?????? ?????? 0x0000AD54 (All) 4 llft_service_queue() ?????? ?????? 0x0000B8A6 (All) 5 llf_task_start_routine() ?????? ?????? 0x0000B7FE (All) 6 CyBle_StackTaskHandler() ?????? ?????? 0x000043C8 (All) 7 OS_scheduler() ?????? ?????? 0x0000538E (All) 8 CyBleStackMgr_ProcessBleEvents() ?????? ?????? 0x00003E5A (All) 9 CyBle_ProcessEvents() ?????? ?????? 0x000039A2 (All) 10 main() main.c 108 0x000002F4 (All) -. With both CyBle_EnterPLM and CyBle_ExitLPM commented out the blessState is always CYBLE_BLESS_STATE_EVENT_CLOSE and neither CySysPmSleep or CySysPmDeepSleep are called. Any ideas what's going on and how to fix this? Thanks Andy |
|
|
|
好的,一些进步(我猜)
这在我的板上工作(意味着主回路计数器和ISR计数器增量) CylulyEnLLPM(CyBlyBless睡眠);而不是CyBlyBless深度睡眠 内部状态= CyTalm临界段(); BelsSt= = CyByLyGETBLISSTATE(); 如果((BelsSt==CyBythBelsStisteEcOxon on’BelsStest==CyByLyBelsStayeSosieLoad)) { CysSpMyDeSLeLeP();决不执行 } 否则(祝福)!= CyBysBLISStAtEngEnvithCype { CysSpMySeLeP(); } 细胞分裂切片(内状态); } CyBLY-ExtLp(); 所以我不能停止任何时钟。会欣赏一些见解和想法。正如我提到的,我需要节省所有的电能。 另一个怪癖 不管我在WDT中设置了多少睡眠间隔,它总是每秒钟发射一次。 我的预期是,睡眠间隔设置为5秒后,ISR计数器在执行20秒后将为4。但是它大约是20 +,这表明WDT大约每秒钟发射一次。 我不知道为什么。 看门狗定时器代码来自另一个示例,它在调用定时器间隔的调用中使用ILOOFRIFQ定义集为32000: CySysWdtWriteMatch(CythySyWdtayAd0,(UIT32)(SLIPEPH间隔*IOLY-FRIQ)/ 1000); 也许这个ILO频率对我来说是不正确的。我在哪里寻找正确的一部分? 谢谢 安迪 以上来自于百度翻译 以下为原文 OK, some progress (I guess) This works on my board (meaning that both the main loop counter and the ISR counter increment) CyBle_EnterLPM(CYBLE_BLESS_SLEEP); <--- instead of CYBLE_BLESS_DEEPSLEEP intrStatus = CyEnterCriticalSection(); blessState = CyBle_GetBleSsState(); if((blessState == CYBLE_BLESS_STATE_ECO_ON || blessState == CYBLE_BLESS_STATE_DEEPSLEEP)) { CySysPmDeepSleep(); <--- never executes } else if(blessState != CYBLE_BLESS_STATE_EVENT_CLOSE) { CySysPmSleep(); } CyExitCriticalSection(intrStatus); } CyBle_ExitLPM(); So I cannot stop any clocks it seems. Would appreciate some insights and ideas.. As I mentioned I need all the power savings I can get. Another weirdness -No matter what sleep interval I set in the WDT it always fires about every second My expectation was that with the sleep interval set to 5 seconds the ISR counter would be 4 after 20 seconds of exectuion. But it was about 20+ which indicates that the WDT fires about every second. I wonder why. The watchdog timer code is from another sample and it uses the ILO_FREQ define set to 32000 in the call that sets the timer interval: CySysWdtWriteMatch(CY_SYS_WDT_COUNTER0, ((uint32)(sleep_interval * ILO_FREQ) / 1000)); Perhaps this ILO frequency is not correct for my part. Where do I look to find the correct one for my part? Thanks Andy |
|
|
|
阅读完你的三条评论: //CysSysCKLIDFLCKTEND(CythySyl CKYH-FFLKKY-ECO); 上面的功能将改变高频时钟到时钟作为参数传递:在这种情况下,我将芯片CPU时钟从IMO到ECO以节省电力;我留给ECO运行和看门狗定时器使用,但关掉IMO以节省电力。 //CysSysCykimoCo(); 上述功能将停止IMO时钟。注意,如果你不改变CPU时钟(HFCLK)到一个即将运行的时钟,那么关闭CPU运行的时钟将基本上停止CPU。 谢天谢地,你已经能够用试验和错误来确定这一点了。 看看你的代码来设置WDT,看起来你可能误解了CysSwitdWrimeTATCHE()正在做什么? WDT0的最大值为65536(UIT16)。如果您正在使用的WDT0时钟在32千赫,那么设置32000的匹配值将导致每秒中断。然后,调整你的睡眠时间到不同的时间间隔,只用WDT0,你就能得到一个从31.2秒到2秒的间隔。因此,试图输入一个5秒的值是UIT32到1秒的滚动,这解释了为什么每秒钟都会中断一次。 为了获得更长的WDT睡眠时间,您将需要使用WDTs级联在一起;TRM HTTP://www. CyPress .com /文档/技术参考手册/PSoC-400家庭PoSO-4-架构-技术-参考……的第12章将向您展示如何将两个看门狗定时器级联在一起。这将允许比WDT0的2秒更长的周期。 (如果你仍然无法使计时器正确工作,那么设置一个RAM变量来保存计时器计数以在回调之前乘以“睡眠”周期的数量也将起作用。例如,每当我们醒来时,增加睡眠计数直到睡眠计数=20,然后我们知道我们已经睡了1×20秒或20秒。 至于为什么你不能关闭时钟,尝试配置时钟只有你想要打开的深度睡眠模式;如果IDE让你这样做,那么它是绝对可能的代码。但是,如果你不能用IDE来完成它,那么你仍然可以用代码配置时钟;至少有一个时钟需要运行并设置为运行HFCLK,并且需要一个时钟运行,并为LLE芯片运行LFCLK。对我来说,我能让ECO和WCO为此工作。 以上来自于百度翻译 以下为原文 After catching up on reading your three comments : //CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); The above function will change the high frequency clock to the clock passed as the parameter: In this case, I was setting chip CPU clock from the IMO to the ECO to save power; I leave the ECO running for BLE and watchdog timer usage, but turn off the IMO to save power. // CySysClkImoStop(); The above function will stop the IMO clock. Note, if you don't change the CPU clock (HFCLK) to a clock that is going to be running, then turning off the clock that the CPU is running off of will essentially halt the CPU. Thankfully, you were able to determine this with trial and error already Looking at your code to set the WDT, it looks like you might be misunderstanding what the CySysWdtWriteMatch() is doing? The WDT0 has a maximum value of 65536 (uint16). If the clock you are using for WDT0 runs at say 32 kHz, then setting a match value of 32000 will cause an interrupt every second. Then, adjusting your sleep time to different intervals, using only WDT0 you will be able to get an interval from 31.2 us to 2 seconds. So, trying to input a value of 5 seconds is rolling over for the uint32 to 1 second, which explains why you are getting an interrupt every one second. In order to get a longer WDT sleep time, you will need to use the WDTs cascaded together; Chapter 12 of the TRM http://www.cypress.com/documentation/technical-reference-manuals/psoc-4000-family-psoc-4-architecture-technical-referenc… will show you how to cascade the two watch dog timers together. This will allow a longer period than the 2 seconds of the WDT0. (If you still can't get the timers working correctly, setting up a RAM variable to hold the timer counts to multiply the number of "sleep" cycles before turning back on will also work. E.G. Every time we wake up increment sleepCount until sleepCount = 20, then we know we have been asleep for 1*20 seconds or 20 seconds total.) As far as why you can't turn off the clocks, try configuring the clocks with only the ones you want turned on in deep sleep mode; If the IDE lets you do it, then it is definitely possible with code. However, if you are unable to do it with the IDE, then you still might be able to configure the clocks with code; At least one clock needs to be on and set to run the HFCLK, and one clock needs to be on and running the LFCLK for the BLE chip. For me, I was able to get the ECO and WCO working for this. |
|
|
|
非常感谢你为我澄清了CysSwitdWTrimeTimeCH,这非常有帮助。 至于钟表—— 看时钟页,我看到有高和低频时钟配置。因为我没有改变页面上的任何东西,所以我假设这些是默认值。 你能看一下(你有这个项目)并建议如何改变配置吗? 谢谢 安迪 以上来自于百度翻译 以下为原文 Thank you so much for clarifying the CySysWdtWriteMatch for me - that was very helpful As for the clocks- Looking at the clocks page I see that there are high and low frequency clocks configured. SInce I didn't change anything on that page I assume these are the defaults. Could you take a look ( you have the project ) and suggest how the configuration can be changed? Thanks Andy |
|
|
|
既然你在使用BLE,我会把WCO时钟设置在任何LFCLK操作上。 然后使用ECO来进行任何HFCLK操作。 这就是它们的样子: 那么,你不必修改时钟,我想 以上来自于百度翻译 以下为原文 Well, since you are using the BLE, I would set the WCO clock on and use that for any LFCLK operations. And then use the ECO for any HFCLK operations. Here's what they would look like: Then, you shouldn't need to modify the clocks I think |
|
|
|
令人惊叹的! 当我根据你的图像配置时钟时,我现在可以调用这个序列而不崩溃。 CysScLyCuffelfCKDead(CythySyl CKYH-FFLKKY-ECO); CysSycLimoCo(); CysSpMySeLeP(); CysSLCKIMOSTART(); CysScLyCuffelfCKDead(CythySyl CkkHfCKKYMIO); 因为我现在没有IMO配置,所以我认为CysSyCKimoStor函数将禁用WCO时钟——至少函数中的注释暗示了这一点。 我唯一不明白的是,最后一个调用(CySysClkWriteHfclkDirect(CythySyCulkHfCLKYMIO))是否有任何效果,因为我没有使用IMO。 现在有一些进步…另一个问题…这是主要的项目,而不是我给你的精简版。 WDT计时器不着火。如果我启动程序并在WDT定时器中设置断点,它就永远不会停止。 但是,如果我停止执行,然后继续,断点就到达了。每100毫秒发射的RTC定时器仍然工作 有趣的是,如果我把CyByLyEnLyPM(CyByLyBelsIsDeLoS入睡)代替CyByBysLyS入睡,WDT每次都会发生火灾,但主回路被卡住。 有什么想法吗? 非常感谢你的帮助! 以上来自于百度翻译 以下为原文 Awesome! When I configured the clocks per your images I can now call this sequence without crashing CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); CySysClkImoStop(); CySysPmSleep(); CySysClkImoStart(); CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); Since I don't have IMO configured now I think the CySysClkImoStop function will just disable the WCO clock - at least the comment in the function suggest that. The only thing I still don't understand is whether the last call ( CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO)) has any effect since I'm not using IMO And now that there is some progress.. another problem..This is in the main project, not in the stripped down version that I gave you. -The WDT timer does not fire. If I start the program and set the breakpoint in the WDT timer it never stops there. Howeever if I halt the execution and then continue the breakpoint is reached. The RTC timer that fires every 100 ms still works Intersetingly, if I call CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) instead of CYBLE_BLESS_SLEEP, the WDT fires every time but the main loop is stuck.. Any ideas? Thank you so much for your help! |
|
|
|
嗯,在我的项目中,实际上我可以同时启用ECO和IMO,这样我就可以得到IMO时钟的48兆赫(ECO是固定在24兆赫)。然后,当我睡觉时,我将HFCLK切换到ECO,关闭IMO时钟,然后睡眠/深度睡眠。一旦单元从中断中醒来,我打开IMO并将其设置为主HFCLK以运行CPU。(SysCLK是从HFCLK运行的) 如果单位为4200米,或其他列出的设备之一(根据评论),则…IOMSTOP()函数将仅禁用WCO。因此,如果你使用的是4200或4200 L,我就不认为它是适用的。(我的单元显示它对于常数声明是禁用的,所以我假设CyBLY-022001—00不是4200米)。检查的一种方法是查看函数本身并查看是否: If(Cythi-IpimiMiTrimababyByWi-WCO) CysScLimoDeababelWCOCK(); YeNEnff/*(Cythi-IpIimoTimeMabeLyByWiCo)*/ 启用,如果是,那么它将关闭WCO。 如果你根本不使用IMO时钟,那么CysSyCulkWrfFCKDead(CythySysCKLYHFLKKY-ECO);行不会改变任何东西,并且CysSLCKLeWHECFLKDION(CythySysCLKHFCLKYMIO)行;应该崩溃该单元,因为它设置了SysCK来关闭IMO,这是关闭的。 对于WDT,您需要确保您执行WDT初始化(…StistOxEx()),并处理和检查WDT ISR函数。 当WDT ISR被调用时,请确保清除相关联的看门狗定时器中断的中断: WDTYISRSARTTEX(WdtIn IntHualter);//WSDT中断ISR CysISR(WdtIn整型处理程序){ UIT32 WDTIIF = CysSydDtGeTraceToSube(); 如果(WdtIIF和CythySythWdtAd00ItIn){ //处理WDT0中断 CySysWdtClearInterrupt(CythySythWdtAd00It); } 如果(WdtIIF和CythySysWdt1Ad1In){ //处理WDT1中断 CySysWdtClearInterrupt(CythySythWdtA1); } 如果(WdtIIF和CythySysWdt2反2In){ //WTD2处理中断 CySysWdtClearInterrupt(CythySysWdt2反2In); } } CyBulyBelsIsDebug和CyByBysLyS入睡之间的差异是LLE堆栈的行为和它使用的功率。但我不认为这会对项目产生直接的影响。需要注意的是,当您将单元设置为低功耗模式时,调试器通常不能正常工作(如果CPU处于睡眠状态,它就不能与CPU通信),因此,当您进入休眠模式时,我怀疑调试器的行为不正确。 如果你能让你的项目没有睡眠模式(WDT中断等),然后得到一个带有睡眠部分的项目,那么它就变成了两者结合的问题。此外,在电源模式上有视觉反馈有助于调试省电模式;例如:一个LED是祝福处于休眠/深度睡眠模式,另一个是CPU处于睡眠还是深度睡眠模式,另一个是在RTC计数时切换。 以上来自于百度翻译 以下为原文 Well, in my project I actually have both ECO and IMO enabled to start with, so that I can get the 48 MHz for the IMO clock (ECO is fixed at 24 MHz). Then, when I go to sleep I switch the HFCLK to the ECO, turn off the IMO clock, then sleep/deepsleep. Once the unit wakes up from an interrupt, I then turn on the IMO and set it back as the main HFCLK for running the CPU. (The SYSCLK is run from the HFCLK) The ...IMOStop() function will only disable the WCO if the unit is a 4200M or one of the other devices listed (according to the comment). Thus, if you are using say a 4200S or 4200L I wouldn't think that it applies. (My unit shows it disabled for the constant declaration, so I would assume the CYBLE-022001-00 is not a 4200M). One way to check is to look at the function itself and see if: #if (CY_IP_IMO_TRIMMABLE_BY_WCO) CySysClkImoDisableWcoLock(); #endif /* (CY_IP_IMO_TRIMMABLE_BY_WCO) */ is enabled, and if so then it will turn off the WCO. If you are not using the IMO clock at all, then the CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); line won't change anything, and the line CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); should be crashing the unit, since it is setting the SYSCLK to run off of the IMO, which is turned off. For the WDT, you will need to make sure you do the WDT initialization (...start_ex(), and have the wdt isr function being handled and checked) When the WDT ISR is called, make sure to handle the interrupts with clearing the interrupts for the associated watchdog timers: WDT_ISR_StartEx(WDT_Int_Handler);//setup WDT interrupt ISR CY_ISR(WDT_Int_Handler) { uint32 WDT_IF = CySysWdtGetInterruptSource(); if(WDT_IF & CY_SYS_WDT_COUNTER0_INT) { //Handle WDT0 interrupt CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT); } if(WDT_IF & CY_SYS_WDT_COUNTER1_INT) { //Handle WDT1 interrupt CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER1_INT); } if(WDT_IF & CY_SYS_WDT_COUNTER2_INT) { //Handle WDT2 interrupt CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER2_INT); } } The difference between CYBLE_BLESS_DEEPSLEEP and CYBLE_BLESS_SLEEP is how the BLE stack behaves and how much power it uses. But I wouldn't expect it to be having a direct result/difference on the project. One thing to note, when you are setting the unit into low power modes, the debugger normally doesn't function properly (it can't talk to the CPU if the CPU is asleep...) So, I would suspect that the debugger isn't behaving correctly once you throw in the sleep modes If you can get your project working without sleep mode (WDT interrupts, etc), and then get a project with the sleep portion working, then it just becomes a matter of combining the two. Also, having visual feedback on the power modes helps for debugging the power saving modes; E.g: One LED is whether the BLESS is in sleep/deepsleep mode, another is whether the CPU is in sleep or deep sleep mode, and another is toggled when the RTC counts, etc. |
|
|
|
非常感谢您的深入解释! 看起来像在我的项目中,(如果是CysiIPIimiMiTrimababyByWiWCO)块被注释掉了。 如果你根本不使用IMO时钟,那么CysSyCulkWrfFCKDead(CythySysCKLYHFLKKY-ECO);行不会改变任何东西,并且CysSLCKLeWHECFLKDION(CythySysCLKHFCLKYMIO)行;应该崩溃该单元,因为它设置了SysCK来关闭IMO,这是关闭的。 我不再看到崩溃了,因为我配置了每个图像的时钟你发送,似乎IMO没有启用在我的当前配置。然而,我没有看到一个崩溃的呼叫CysSysCKLIDHFCKDIN(CythySyl CkkHfCKKYMIO); 在WDT上,我有WDT配置和运行,没有睡眠模式。我不只是依赖调试器来验证,每次调用ISR时都有一个计数器递增。我让程序运行,然后在主循环中停下来查看计数器。当启用休眠模式时,它不递增,当不启用时则不增加。 我再深入研究一下。 以上来自于百度翻译 以下为原文 Thank you so much for the in-depth explanation! Looks like in my project the #if (CY_IP_IMO_TRIMMABLE_BY_WCO) block is commented out If you are not using the IMO clock at all, then the CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); line won't change anything, and the line CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); should be crashing the unit, since it is setting the SYSCLK to run off of the IMO, which is turned off. I don' see crashing any more since I configured the clocks per images you sent, It appears that IMO is not enabled in my current configuration. However I don't see a crash calling CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); On WDT, I have the WDT configured and running properly without the sleep mode. I don't only rely on the debugger to verify - there is a counter that increments every time the ISR is called. I let the program run and then stop in the main loop and look at the counter. It does not increment when sleep mode is enabled and does when it is not. I'll dig into it some more |
|
|
|
不客气! 奇怪的是,我本来希望把时钟变为一个无效的来源,把事情搞得一团糟… 试图找出你错过了从睡眠/深度睡眠中醒来的WDT:HTTP://wwwyCyp.com /DooptTys/CODE-ExpLeSe/CE954.WATDOG-TIME REST和BPS-41XX42XXX设备 应该对WDT的使用有一些有用的信息。项目2是你想要的,因为唤醒是造成问题的。 我不再看到崩溃了,因为我配置了每个图像的时钟你发送,似乎IMO没有启用在我的当前配置。然而,我没有看到一个崩溃呼叫CysSysCKLIDHFCKDION(CythySyl CkkHfCKKYMIO) 这可能是WDT从睡眠/深度睡眠唤醒单位的失败是通过设置CysSysCKLIDFLCKTEND(CythySysCLKHfCKKYMIO)引起的“崩溃”。 我会尝试注解那些改变HFCLK的线路,除非你计划让IMO在你的项目中运行(听起来你可以不这样做)。 此外,创建一个简单的项目,只测试唤醒和中断(基本上是WDT功能)将有助于调试出错的内容。 埃普拉特 以上来自于百度翻译 以下为原文 You're welcome! Odd; I would have expected changing the clock to an invalid source to mess things up... For trying to figure out what you are missing for the WDT waking up from sleep/deep sleep: http://www.cypress.com/documentation/code-examples/ce95400-watchdog-timer-reset-and-interrupt-psoc-41xx42xx-devices Should have some useful information on the WDT usage. Project #2 is the one you want, as it is the wakeup that is causing problems. I don' see crashing any more since I configured the clocks per images you sent, It appears that IMO is not enabled in my current configuration. However I don't see a crash calling CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO)It could be that the failure for the WDT to wakeup the unit from sleep/deep sleep is the "crash" caused by setting the CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO) I would try commenting out the lines that change the HFCLK unless you are planning on having the IMO running in your project (which it sounds like you can get away without doing so) Also, creating a simple project that tests just the wakeup and interrupts together (WDT functionality essentially) would be helpful for debugging what is going wrong Epratt |
|
|
|
耶,终于有了突破! WDT在主项目中没有发生火灾的原因是初始化看门狗没有调用CysSydTcLoT()来防止对WDT的更改。 一旦我添加了呼叫,WDT开始按预期工作。 所以现在一切都在运转(手指交叉) 还有一些挥之不去的问题。 1。显然有些东西正在修改WDT,我想知道是什么。我已经看了很多LPM样本,其中一些调用了锁函数,有些则不调用。出现硬件保密,但可能是一个很好的做法,总是呼吁? 2 LPM代码如下: CysScLyCuffelfCKDead(CythySyl CKYH-FFLKKY-ECO); CysSycLimoCo(); CysSpMySeLeP(); CysSLCKIMOSTART(); CysScLyCuffelfCKDead(CythySyl CkkHfCKKYMIO); 我不理解的是为什么CysSyCulkFrutHfCKDead(CythySysCLKHfCLKYMIO)没有不良影响。程序运行良好,有或没有调用,根据时钟配置,我没有IMO配置。 3我有每100毫秒运行的RTC。它似乎受到LPM的影响。 我做了以下测试 每次调用RTC处理程序时递增计数器。 -运行程序30秒 -暂停程序 LPM离柜台大约是300,这正是我所期望的:(30000/300=100毫秒)。 其中LPM约为250。 这是可以理解的,因为RTC处理程序只在程序不处于休眠模式时发生火灾。 问题是该怎么办?是否有一些API调用使RTC与系统时钟同步?还是我必须在代码中处理它?诀窍是我不知道睡眠需要多长时间。 有没有一种系统滴答声,我可以在睡前和睡前使用,来确定睡眠到底需要多少MS? 再次感谢你! 你的帮助是无价之宝 当做 安迪 - 以上来自于百度翻译 以下为原文 Yay, finally a breakthrough! The reason the WDT did not fire in the main project was because the function that initialized the watchdog did not call CySysWdtLock() to prevent changes to the WDT. Once I added that call the WDT started to work as expected. So now everything is working (fingers crossed) There are some lingering questions 1. Apparently something was modifying the WDT I wonder what it was. I've looked at a lot of LPM samples - some of them do call the lock function and some do not. Appears hardware secific, but probably a good practice to always call ? 2 The LPM code is as follows:; CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO); CySysClkImoStop(); CySysPmSleep(); CySysClkImoStart(); CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); What I don't understand is why the CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_IMO); has no ill effect - the program runs just fine with or without that call,According to the clock configuration I do not have the IMO configured. 3 I have the RTC that runs every 100 ms . It appears that it is affected by the LPM I ran the following test -Increment a counter every time the RTC handler is called. -Run the program for 30 seconds -Pause the program With LPM off the counter was around 300 which is what I expected: (30000/300 = 100 ms) With LPM on it was about 250. This is understandable as the RTC handler only fires when the program is not in the sleep mode. The question is what to do about it? Is there some API call to synchronize the RTC with the system clock? Or will I have to handle it in the code? The trick is that I don't know how long the sleep took. Is there some sort of a System tick call that I can use before and after the sleep to determine how many ms the sleep really took? Thank you so much again! Your help is invaluable Regards Andy - |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2110 浏览 1 评论
1858 浏览 1 评论
3673 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1791 浏览 6 评论
1540 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
575浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
428浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
440浏览 2评论
390浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
922浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 04:26 , Processed in 1.605665 second(s), Total 114, Slave 98 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号