Not applicable
Aug 28, 2014
04:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 28, 2014
04:23 AM
Hi All,
It seems the "PWMSP002_GetTimerRegsVal" App returns an incorrect TimerReg value if 2 timers are concatenated.
For example, the code below sets the timer to 0x1FFFF and reads the TimerReg value back incorrectly as 0xFFFF, the high 16 bits are missing.
Any comments or suggestions would be welcome.
Best regards
Aaron
It seems the "PWMSP002_GetTimerRegsVal" App returns an incorrect TimerReg value if 2 timers are concatenated.
For example, the code below sets the timer to 0x1FFFF and reads the TimerReg value back incorrectly as 0xFFFF, the high 16 bits are missing.
Status = PWMSP002_SetTimerVal(&PWMSP002_Handle2, 0x1FFFF);
Status = PWMSP002_GetTimerRegsVal((PWMSP002_HandleType*)&PWMSP002_Handle2, &TimerVal);
Any comments or suggestions would be welcome.
Best regards
Aaron
- Tags:
- IFX
3 Replies
Not applicable
Sep 01, 2014
01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 01, 2014
01:50 AM
Hi Aaron,
CCU8PWMLIB_SetTimerVal() function sets the timer value by writing to TIMER register 16bit TVAL field (CC8yTIMER.TVAL[15:0]). Whereas, CCU8PWMLIB_GetTimerRegsVal() function reads the period (CC8yPRS) & compare (CC8yCR1/2S) register values.
BR,
Zain
CCU8PWMLIB_SetTimerVal() function sets the timer value by writing to TIMER register 16bit TVAL field (CC8yTIMER.TVAL[15:0]). Whereas, CCU8PWMLIB_GetTimerRegsVal() function reads the period (CC8yPRS) & compare (CC8yCR1/2S) register values.
BR,
Zain
Not applicable
Sep 01, 2014
02:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 01, 2014
02:29 AM
Hi Zain,
Thanks for the info. According to the help the "PWMSP002_GetTimerRegsVal()" function returns a pointer to the "PWMSP002_TimerRegsType" structure which contains the following...
uint32_t CompReg1
uint32_t CompReg2
uint32_t PeriodReg
uint32_t TimerReg
When I have 2 concatenated timer slices the "TimerReg" only contains bits 15:0 which doesn't seem right.
BR
Aaron
Thanks for the info. According to the help the "PWMSP002_GetTimerRegsVal()" function returns a pointer to the "PWMSP002_TimerRegsType" structure which contains the following...
uint32_t CompReg1
uint32_t CompReg2
uint32_t PeriodReg
uint32_t TimerReg
When I have 2 concatenated timer slices the "TimerReg" only contains bits 15:0 which doesn't seem right.
BR
Aaron
Attachments are accessible only for community members.
Not applicable
Sep 01, 2014
09:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 01, 2014
09:04 AM
The attached zip file contains a PMWSP002 project which demonstrates the problem.
The CCU80 period value is 0x3B71F in concatenated registers CCU80_CC81.PR and CCU80_CC80.PR.
You can run the project in debug and set different values for the 'Preset' variable which is loaded into CCU80_CC81.TIMER and CCU80_CC80.TIMER by the function "PWMSP002_SetTimerVal(&PWMSP002_Handle0, Preset)".
After starting the timer the 'While' loop incremets the 'Iterations' variable until the CCU80_CC81.TIMER register is >= 0x2. In other words until CCU80 reaches a count of 0x20000.
If 'Preset' is loaded with a value <= to the CCU80_CC80.PR register value (0xB71F) then the CCU80 timer works OK and the number of iterations seems correct.
If 'Preset' is loaded with a value > the the CCU80_CC80.PR register value (0xB71F) then the CCU80 timer is not OK and the number of iterations seems wrong.
e.g.
Preset = 0x00000, Iterations == 400036. OK
Preset = 0x20000, Iterations == 0. OK
Preset = 0xB71F, Iterations == 200021. OK
Preset = 0xB720, Iterations == 479636. Not OK
Preset = 0x1FFFF, Iterations == 200021. Not OK. You would definitely expect the While loop to finish immediately.
Any suggestions would be appreciated.
Best regards
Aaron