Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).
|
Hi all, does anybody know how to set up the timer if i want the timer to run until compare. The ISR changes the Comparevalue1 and some GPIO-Pins and restarts the Timer. What has the qt_sState to be? How can I set the CompareValue? i tried ioctl(..,QT_Write_CompareValue1,..) but that didnt work in the Callbackfunction. How can I Restart the Timer? Why are the SDK-settings so far away from what you do when working without SDK (e.g. Outputdisabled (sdk) <-> Outputenabled (DSP-Regs))? What is the Advantage of using the SDK? (ok the PC-Master is a big one) Regards Yves |
|
|
|
Hi Yves, I had the same problem of callback on compare interrupt but after I added #define INCLUDE_USER_TIMER_A_0 0 in the appconfig.h it is now working. My application is controlling valve to be turned on and off in msec by GPIO pin with Timer A. Best Regards Kris --- drexlmeier <> wrote: > Hi all, > > does anybody know how to set up the timer if i want > the timer to run > until compare. The ISR changes the Comparevalue1 and > some GPIO-Pins > and restarts the Timer. > > What has the qt_sState to be? > How can I set the CompareValue? > i tried ioctl(..,QT_Write_CompareValue1,..) but that > didnt work in > the Callbackfunction. > > How can I Restart the Timer? > > Why are the SDK-settings so far away from what you > do when working > without SDK (e.g. Outputdisabled (sdk) <-> > Outputenabled (DSP-Regs))? > > What is the Advantage of using the SDK? (ok the > PC-Master is a big > one) > > Regards Yves |
|
|
|
Hi, seems my yesterday´s posting got lost. so here it is again i already had the Include problem is to find a (fast) way to restart the timer from inside the Callbackfunction with a changed comparevalue. Mean while i found a slow solution (changing the qt_state structure and using QT_ENABLE) but that is a very slow way Somehow using QT_WRITE_COMPAREVALUE1 did not what i expected Does anybody know how to make it faster? Is there a mre detailed description as the Targeting Manual? (I´m using DSP56F805 SDK 2.5, CW. 5.05 Here is what i´m doing at the Moment qt_sState TB1Param1 = { /* Mode = */ qtCountBothEdges, /* InputSource = */ qtCounter0Output, /* InputPolarity = */ qtInverted, /* SecondaryInputSource = */ 0, /* CountFrequency = */ qtOnce, /* CountLength = */ qtUntilCompare, /* CountDirection = */ qtUp, /* OutputMode = */ qtAssertWhileActive, /* OutputPolarity = */ qtNormal, /* OutputDisabled = */ 1, //disabled /* Master = */ 0, /* OutputOnMaster = */ 0, /* CoChannelInitialize = */ 0, /* AssertWhenForced = */ 0, /* CaptureMode = */ qtDisabled, /* CompareValue1 = */ 20, /* CompareValue2 = */ 40, /* InitialLoadValue = */ 0x0000, /* CallbackOnCompare = */ {CallBackTB1, 0}, /* CallbackOnOverflow = */ {0, 0}, /* CallbackOnInputEdge = */ {0, 0} }; void Init() { TB1Param1 .CompareValue2=TFrame+TDelay; TB1Timer = qtOpen(BSP_DEVICE_NAME_QUAD_TIMER_B_1, 0, (void*)&TB1Param1 ); ioctl(TB1Timer , QT_ENABLE, NULL); return; } void CallBackTB1(qt_eCallbackType CallbackType, void* pParam) { if (State==0) { TB1Param1 .CompareValue1=TINT; TB1Param1 .CompareValue2=TINT; } else { TB1Param1 .CompareValue1=TFrame+TDelay; TB1Param1 .CompareValue2=TFrame+TDelay; } qtIoctl(TB1Timer , QT_ENABLE, (void*)&TB1Param1 , BSP_DEVICE_NAME_QUAD_TIMER_B_1); } Regards Yves --- In , Kris J <kj831ca@y...> wrote: > Hi Yves, > I had the same problem of callback on compare > interrupt but after I added > #define INCLUDE_USER_TIMER_A_0 0 > in the appconfig.h it is now working. > > My application is controlling valve to be turned on > and off in msec by GPIO pin with Timer A. > > Best Regards > Kris > --- drexlmeier <y.drexlmeier@p...> wrote: > > Hi all, > > > > does anybody know how to set up the timer if i want > > the timer to run > > until compare. The ISR changes the Comparevalue1 and > > some GPIO-Pins > > and restarts the Timer. > > > > What has the qt_sState to be? > > How can I set the CompareValue? > > i tried ioctl(..,QT_Write_CompareValue1,..) but that > > didnt work in > > the Callbackfunction. > > > > How can I Restart the Timer? > > > > Why are the SDK-settings so far away from what you > > do when working > > without SDK (e.g. Outputdisabled (sdk) <-> > > Outputenabled (DSP-Regs))? > > > > What is the Advantage of using the SDK? (ok the > > PC-Master is a big > > one) > > > > Regards Yves > > > > > > > |
|
|
|
Dear Yves I'm using SDK3.0 and it has function qtIoctl with command QT_FAST_RESTART. By calling qtIoctl with command QT_ENABLE in your interrupt add alot of overhead code since you change only compare value. Here is the code that you might want to try. void CallBackTB1(qt_eCallbackType CallbackType, void* pParam) { if (State==0) { TB1Param1 .CompareValue1=TINT; TB1Param1 .CompareValue2=TINT; } else { TB1Param1 .CompareValue1=TFrame+TDelay; TB1Param1 .CompareValue2=TFrame+TDelay; } qtIoctl(TB1Timer ,QT_WRITE_COMPARE_VALUE1,TB1Param1.CompareValue1, BSP_DEVICE_NAME_QUAD_TIMER_B_1); qtIoctl(TB1Timer ,QT_WRITE_COMPARE_VALUE2,TB1Param1.CompareValue2, BSP_DEVICE_NAME_QUAD_TIMER_B_1); qtIoctl(TB1Timer ,QT_FAST_RESTART, qtCountBothEdges,BSP_DEVICE_NAME_QUAD_TIMER_B_1); } Hope this help. Best Regards Kris --- drexlmeier <> wrote: > Hi, > > seems my yesterday´s posting got lost. so here it is > again > i already had the Include > > problem is to find a (fast) way to restart the timer > from inside the > Callbackfunction with a changed comparevalue. > > Mean while i found a slow solution (changing the > qt_state structure > and using QT_ENABLE) but that is a very slow way > > Somehow using QT_WRITE_COMPAREVALUE1 did not what i > expected > > Does anybody know how to make it faster? > Is there a mre detailed description as the Targeting > Manual? > (I´m using DSP56F805 SDK 2.5, CW. 5.05 > Here is what i´m doing at the Moment > qt_sState TB1Param1 = { > /* Mode = */ qtCountBothEdges, > /* InputSource = */ qtCounter0Output, > /* InputPolarity = */ qtInverted, > /* SecondaryInputSource = */ 0, > /* CountFrequency = */ qtOnce, > /* CountLength = */ qtUntilCompare, > /* CountDirection = */ qtUp, > /* OutputMode = */ qtAssertWhileActive, > /* OutputPolarity = */ qtNormal, > /* OutputDisabled = */ 1, //disabled > /* Master = */ 0, > /* OutputOnMaster = */ 0, > /* CoChannelInitialize = */ 0, > /* AssertWhenForced = */ 0, > /* CaptureMode = */ qtDisabled, > /* CompareValue1 = */ 20, > /* CompareValue2 = */ 40, > /* InitialLoadValue = */ 0x0000, > /* CallbackOnCompare = */ {CallBackTB1, 0}, > /* CallbackOnOverflow = */ {0, 0}, > /* CallbackOnInputEdge = */ {0, 0} > }; > void Init() > { > > TB1Param1 .CompareValue2=TFrame+TDelay; > TB1Timer = qtOpen(BSP_DEVICE_NAME_QUAD_TIMER_B_1, > 0, > (void*)&TB1Param1 ); > ioctl(TB1Timer , QT_ENABLE, NULL); > return; > } > > void CallBackTB1(qt_eCallbackType CallbackType, > void* pParam) > { > > if (State==0) > { > TB1Param1 .CompareValue1=TINT; > TB1Param1 .CompareValue2=TINT; > } > else > { > TB1Param1 .CompareValue1=TFrame+TDelay; > TB1Param1 .CompareValue2=TFrame+TDelay; > } > qtIoctl(TB1Timer , QT_ENABLE, (void*)&TB1Param1 , > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > } > Regards Yves > > --- In , Kris J > <kj831ca@y...> wrote: > > Hi Yves, > > I had the same problem of callback on compare > > interrupt but after I added > > #define INCLUDE_USER_TIMER_A_0 0 > > in the appconfig.h it is now working. > > > > My application is controlling valve to be turned > on > > and off in msec by GPIO pin with Timer A. > > > > Best Regards > > Kris > > --- drexlmeier <y.drexlmeier@p...> wrote: > > > Hi all, > > > > > > does anybody know how to set up the timer if i > want > > > the timer to run > > > until compare. The ISR changes the Comparevalue1 > and > > > some GPIO-Pins > > > and restarts the Timer. > > > > > > What has the qt_sState to be? > > > How can I set the CompareValue? > > > i tried ioctl(..,QT_Write_CompareValue1,..) but > that > > > didnt work in > > > the Callbackfunction. > > > > > > How can I Restart the Timer? > > > > > > Why are the SDK-settings so far away from what > you > > > do when working > > > without SDK (e.g. Outputdisabled (sdk) <-> > > > Outputenabled (DSP-Regs))? > > > > > > What is the Advantage of using the SDK? (ok the > > > PC-Master is a big > > > one) > > > > > > Regards Yves > > > > > > > > > > > |
|
|
|
Hi Kris thanks this made it faster. Not that fast i would have liked it, but fast enough to make my tests, later i will do what i´ve been doing by now: working without SDK. For completeness: In adition i had to set the Counter_reg to zero. Otherwise the Counter restart obove compvalue and therefor has to rollover first. Greetings Yves --- In , Kris J <kj831ca@y...> wrote: > Dear Yves > > I'm using SDK3.0 and it has function qtIoctl with > command QT_FAST_RESTART. > > By calling qtIoctl with command QT_ENABLE in your > interrupt add alot of overhead code since you change > only compare value. Here is the code that you might > want to try. > > void CallBackTB1(qt_eCallbackType CallbackType, > void* pParam) > { > > if (State==0) > { > TB1Param1 .CompareValue1=TINT; > TB1Param1 .CompareValue2=TINT; > } > else > { > TB1Param1 .CompareValue1=TFrame+TDelay; > TB1Param1 .CompareValue2=TFrame+TDelay; > } > > qtIoctl(TB1Timer > ,QT_WRITE_COMPARE_VALUE1,TB1Param1.CompareValue1, > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > qtIoctl(TB1Timer > ,QT_WRITE_COMPARE_VALUE2,TB1Param1.CompareValue2, > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > qtIoctl(TB1Timer ,QT_FAST_RESTART, > qtCountBothEdges,BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > } > > Hope this help. > > Best Regards > Kris > --- drexlmeier <y.drexlmeier@p...> wrote: > > Hi, > > > > seems my yesterday´s posting got lost. so here it is > > again > > i already had the Include > > > > problem is to find a (fast) way to restart the timer > > from inside the > > Callbackfunction with a changed comparevalue. > > > > Mean while i found a slow solution (changing the > > qt_state structure > > and using QT_ENABLE) but that is a very slow way > > > > Somehow using QT_WRITE_COMPAREVALUE1 did not what i > > expected > > > > Does anybody know how to make it faster? > > Is there a mre detailed description as the Targeting > > Manual? > > (I´m using DSP56F805 SDK 2.5, CW. 5.05 > > > > > > Here is what i´m doing at the Moment > > qt_sState TB1Param1 = { > > /* Mode = */ qtCountBothEdges, > > /* InputSource = */ qtCounter0Output, > > /* InputPolarity = */ qtInverted, > > /* SecondaryInputSource = */ 0, > > /* CountFrequency = */ qtOnce, > > /* CountLength = */ qtUntilCompare, > > /* CountDirection = */ qtUp, > > /* OutputMode = */ qtAssertWhileActive, > > /* OutputPolarity = */ qtNormal, > > /* OutputDisabled = */ 1, //disabled > > /* Master = */ 0, > > /* OutputOnMaster = */ 0, > > /* CoChannelInitialize = */ 0, > > /* AssertWhenForced = */ 0, > > /* CaptureMode = */ qtDisabled, > > /* CompareValue1 = */ 20, > > /* CompareValue2 = */ 40, > > /* InitialLoadValue = */ 0x0000, > > /* CallbackOnCompare = */ {CallBackTB1, 0}, > > /* CallbackOnOverflow = */ {0, 0}, > > /* CallbackOnInputEdge = */ {0, 0} > > }; > > > > > > void Init() > > { > > > > TB1Param1 .CompareValue2=TFrame+TDelay; > > TB1Timer = qtOpen(BSP_DEVICE_NAME_QUAD_TIMER_B_1, > > 0, > > (void*)&TB1Param1 ); > > ioctl(TB1Timer , QT_ENABLE, NULL); > > return; > > } > > > > void CallBackTB1(qt_eCallbackType CallbackType, > > void* pParam) > > { > > > > if (State==0) > > { > > TB1Param1 .CompareValue1=TINT; > > TB1Param1 .CompareValue2=TINT; > > } > > else > > { > > TB1Param1 .CompareValue1=TFrame+TDelay; > > TB1Param1 .CompareValue2=TFrame+TDelay; > > } > > qtIoctl(TB1Timer , QT_ENABLE, (void*)&TB1Param1 , > > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > > > } > > > > > > Regards Yves > > > > --- In , Kris J > > <kj831ca@y...> wrote: > > > Hi Yves, > > > I had the same problem of callback on compare > > > interrupt but after I added > > > #define INCLUDE_USER_TIMER_A_0 0 > > > in the appconfig.h it is now working. > > > > > > My application is controlling valve to be turned > > on > > > and off in msec by GPIO pin with Timer A. > > > > > > Best Regards > > > Kris > > > --- drexlmeier <y.drexlmeier@p...> wrote: > > > > Hi all, > > > > > > > > does anybody know how to set up the timer if i > > want > > > > the timer to run > > > > until compare. The ISR changes the Comparevalue1 > > and > > > > some GPIO-Pins > > > > and restarts the Timer. > > > > > > > > What has the qt_sState to be? > > > > How can I set the CompareValue? > > > > i tried ioctl(..,QT_Write_CompareValue1,..) but > > that > > > > didnt work in > > > > the Callbackfunction. > > > > > > > > How can I Restart the Timer? > > > > > > > > Why are the SDK-settings so far away from what > > you > > > > do when working > > > > without SDK (e.g. Outputdisabled (sdk) <-> > > > > Outputenabled (DSP-Regs))? > > > > > > > > What is the Advantage of using the SDK? (ok the > > > > PC-Master is a big > > > > one) > > > > > > > > Regards Yves > > > > > > > > > > > > > > > > > > > |
|
|
|
Hi Kris and Yves, I have a question regarding the use of QT_FAST_RESTART. At what value the counter of the timer restarts? Is it at 0x0000 or at CompareValuex (1 or 2)? Depending on the count up or down direction, I want to know if a callback on compare will occur when a command QT_FAST_RESTART is call. --- In , "drexlmeier" <y.drexlmeier@p...> wrote: > > Hi Kris > > thanks this made it faster. Not that fast i would have liked it, but > fast enough to make my tests, later i will do what i´ve been doing by > now: working without SDK. > For completeness: > In adition i had to set the Counter_reg to zero. Otherwise the > Counter restart obove compvalue and therefor has to rollover first. > > Greetings Yves > > --- In , Kris J <kj831ca@y...> wrote: > > Dear Yves > > > > I'm using SDK3.0 and it has function qtIoctl with > > command QT_FAST_RESTART. > > > > By calling qtIoctl with command QT_ENABLE in your > > interrupt add alot of overhead code since you change > > only compare value. Here is the code that you might > > want to try. > > > > void CallBackTB1(qt_eCallbackType CallbackType, > > void* pParam) > > { > > > > if (State==0) > > { > > TB1Param1 .CompareValue1=TINT; > > TB1Param1 .CompareValue2=TINT; > > } > > else > > { > > TB1Param1 .CompareValue1=TFrame+TDelay; > > TB1Param1 .CompareValue2=TFrame+TDelay; > > } > > > > qtIoctl(TB1Timer > > ,QT_WRITE_COMPARE_VALUE1,TB1Param1.CompareValue1, > > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > qtIoctl(TB1Timer > > ,QT_WRITE_COMPARE_VALUE2,TB1Param1.CompareValue2, > > BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > > > qtIoctl(TB1Timer ,QT_FAST_RESTART, > > qtCountBothEdges,BSP_DEVICE_NAME_QUAD_TIMER_B_1); > > > > } > > > > Hope this help. > > > > Best Regards > > Kris |