ADC to PWM with Proccesor Expert on HCS08AW60 DEMO board difficulty

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

ADC to PWM with Proccesor Expert on HCS08AW60 DEMO board difficulty

4,182 次查看
bdavy
Contributor I
Comrades,
 
I am having luck with the QG8 but not the AW chip ( HCS08 family ), using Processor Expert.
 
The app simply changes the intensity of a LED based on a value off of the respective DEMO
boards pot, at least for the DEMO9S08QG8 board (but not the DEMO9S08AW60 ).
 
The heart of the logic, outside of PE's skeleton code, is:
 
void PWM1_OnEnd(void)
{
 err=AD1_GetValue16(&ADCValue);
 err=PWM1_SetRatio16(ADCValue);
}
 
This project compiles without errors or warnings, but the visualization tool always shows
variables ADCValue and err to be 0 and the debugger gets stuck at: BRA  *+0 .
(On the QG8 this is not the case as it works great)
 
The AW's LED does light up, but the intensity stays constant - despite wiggling the potentiometer,
as the PWM1_OnEnd event handler seems to be gone through once.   However, this
intensity is always the same, regardless of the pot position at startup; so it seems the analog
voltage is never correctly retrieved.
 
I've included the project, which reflects my pin choices of the ATD (pot) on PTD0 and
the LED on PTF0, in the bean inspector.
 
My searches on the forum suggest that others are having issues with PE and the AW chip,
but I'm not clear if the vector and .prm workarounds would address this scenario as these
areas I am a newbie at.
 
Any suggestions, thoughts or advice is of interest.   Thank you for your time.
 
Best,
Davy
标签 (1)
标记 (1)
0 项奖励
回复
7 回复数

1,250 次查看
ProcessorExpert
Senior Contributor III
Dear Customer,
We checked your attached project and found out possible problem.  The "ADC clock source in high speed mode" property from ADC bean in Bean inspector is set to "AlternativeClock" value (see third column). You should set it to "BusClock" value or set "External Clock Source" property from CPU bean in CPU inspector to "External crystal" value. If you have external clock source as external oscilator, the alternative clock for ADC is zero (according schematics of demo board for AW).
I hope this help you.
 
Best Regards,
Jan Pospisilik, Processor Expert Support
0 项奖励
回复

1,250 次查看
bdavy
Contributor I
This worked like a champ Jan (setting ADC clock source to BusClock in the Bean Inspector ).
 
Thank you all for your help and time.
 
Best,
Davy
0 项奖励
回复

1,250 次查看
rocco
Senior Contributor II
Hi, Davy:

. . . The AW's LED does light up, but the intensity stays constant - despite wiggling the potentiometer, as the PWM1_OnEnd event handler seems to be gone through once.
I'm not sure that this is a safe assumption. I suspect that the LED brightness you are seeing is what is set by the initialization code of the PWM, and that you are not ever getting to PWM1_OnEnd.

I'm sorry that I can't offer more help than that.
0 项奖励
回复

1,250 次查看
bdavy
Contributor I
Great point rocco !   Single stepping through the code reveals that indeed you are correct
(LED comes on during initialization, and event logic is never gotten to).   Thank you for your
insight...
 
Also, I failed to mention that the simulator (for both boards/chips) doesn't like this logic*, even
though the real QG8 DEMO board works great including with the debugger and the visualization tool
spying on the variables.   I wonder what change would be necessary for simulator to work ?
Perhaps this same trick would get the AW series working in the intended way.
 
Best,
Davy
 
* = When I try and single step, on the zillionth click I get: Error: Attempt to use uninitialized (uu)
Accumulator.  This is right after the dummy read of the TPMSC register in PWM1.c.  
0 项奖励
回复

1,250 次查看
J2MEJediMaster
Specialist I
If that bug is reproducible, you may want to submit a Service Request to report it. You may need to submit your code at some point to help in the process.

---Tom
0 项奖励
回复

1,250 次查看
bdavy
Contributor I
Thanks Tom...  
 
I brought it to their attention Friday via the web form.  When they respond,
I'll be sure and followup in the forum with their insight so that others can
enjoy the fruit of this level of abstration, especially since the compelling/intuitive code is in
the initial posting for all to learn from and take advantage of in their rapid prototyping.
 
Lastly, one new nugget of info has surfaced that may be meaningful in troubleshooting for you
fellow headscratchers.  When using this code, the simulator for the QG8 gets stuck** at a little 
different spot than the AW does.  Namely in PWM1.c at:
 
clrSetReg8Bits(TPMSC, 0x80, 0x40);   /* Clear Overflow interrupt flag and enable Overflow interrupt */ 
which breaks down into assembly as:
 
E23D AND   #0x7F
 
To paraphrase, one or more of these symtoms occurs in both CW 5.0 and 5.1, for the real AW and the
simulator for the AW and QG8; whereas the real QG8, in contrast, works as expected.
 
Thank you for your time and efforts.
 
Best,
Davy
 
** = when running or trying to step out of, it halts, and when single stepping into or over it gives error
message mentioned before of:
Error: Attempt to use uninitialized (uu) Accumulator
0 项奖励
回复

1,250 次查看
bigmac
Specialist III
Hello Davy,
 
I vaguely recall that the uninitialised accumulator error has previously happened to me.  The circumstances that come to mind were that it was within the initialisation code, written in assembler, and I attempted to reset the COP timer using the value in the accumulator, which did not yet contain a defined value.  Of course, this would not be a problem for the silicon, but the simulator objected.
 
However, if your problem is occurring within a C function, it would seem quite unlikely that the accumulator would not have been used up until that point.  As an experiment, you could try specifically initialising the accumulator value early in the code, perhaps using an in-line assembly instruction, and before the function was called, to see if the particular error persists.  Perhaps another possibility is that you are attempting to read a register that has one or more bits that are undefined after reset.
 
Regards,
Mac
 

Message Edited by bigmac on 2006-10-0311:07 AM

0 项奖励
回复