QY4A vs. QB8 internal oscillator timing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QY4A vs. QB8 internal oscillator timing

3,395 Views
RobG
Contributor II
When I use a QB8 in place of QY4A the result is a lower internal oscillator speed. A sequence of code that takes 8 seconds to perform in QY4A takes 10.6 seconds if a QB8 is programmed with the same s19 file.
 
Both QY4A and QB8 devices are programmed with Mon08 Cyclone. Appropriate algorithms used for each device. Proper oscillator trimming is done.
 
I know that the code in the QY4A is running at the correct speed. I have measured the actual speed at 3.8 MHz. So for whatever reason, the QB8 has a speed of about 2.86 MHz. running the same code.
 
I went through the memory maps to make sure the QY4A code would "drop straight in" which it looks to me it does. The oscillator sections of both devices data sheets look to be identical and all QY4A registers have the same addresses as QB8.
 
The bulk of the development of this application was done using mmevs with QBLTY daughter board emulating QB8. In mmevs the timing is the same as in actual QY4A device.
 
So what am I missing folks? It's got to be something simple.
 
Rob
Labels (1)
0 Kudos
Reply
10 Replies

982 Views
bigmac
Specialist III
Hello Rob,
 
I might suggest that you check tha actual programmed trim value, to see whether programming has occurred properly.  I would be suspicious if the value was at or near to an extremity.  If, for some reason, the value remained unprogrammed at a value of 0xFF,  this would give minimum available clock frequency.
 
I assume that your code transfers the calibration value from 0xFFC0 address, to the OSCTRIM register (0x0038).  A further test could be to not alter the OSCTRIM value from its reset default of 0x80, the mid-point of the adjustment range, and conduct the bus rate test under this condition.
 
A final observation, the QY4A defaults to an internal oscillator frequency of 12.8 MHz (3.2 MHz bus frequency), whereas the QB8 defaults to 4 MHz (1 MHz bus) after power-up.  Perhaps check that the code explicitly sets the ICFS0 and ICFS1 bits within OSCSC, rather than using the default setting.
 
Regards,
Mac
 
0 Kudos
Reply

982 Views
RobG
Contributor II
Hi Mac,
Thanks for your time.
 
Even though default is 12.8 in QY4A, the code does set ICSF1:ICSF0 to 1:0 for 12.8 so QB8 is being asked to run at that speed as well.
 
Yes code does transfer trim calibration.
.
Since the actual speed in QB8 is about right for minimum untrimmed speed then I suspect you are right about it being a trim problem. The Mon08 Cyclone automatically does the calibration when using it as stand alone programmer. Maybe it's not working correctly for QB8.
 
More on this later when I make some time to experiment further.
I also have the Cyclone Pro. I'll try programming (and calibration) using this programmer as well.
 
Cheers
Rob
 
 
 
 
 
 
0 Kudos
Reply

982 Views
peg
Senior Contributor IV
Hello Rob,

The tools will, if asked too, calculate the appropriate trim value and burn it into flash.
However, it is up to YOU to transfer this value to the working register at startup.
Good programming practice is to perform a sanity check on this and reject $FF and $00.
This will catch when the trim has not been done at programming.
In fact anything outside of perhaps $60 to $C0 probably indicates something is wrong or very extreme operating conditions.

0 Kudos
Reply

982 Views
RobG
Contributor II
Hi Peg,
My code does transfer the trim value (first checks for $FF). But that's an interesting thought about checking for $00 as well. Thanks for that. However it's not been an issue as thousands of QY4A's have been programmed with the Mon08 Cyclone and all trim as expected.
 
The issue here was simply why wasn't the same s19 file programed into QB8 using the same Mon08 Cyclone giving the same clock speed as the QY4A.
 
And I think I have the answer now. The Mon08 Cyclone does not calibrate the QB8 successfully. I setup my Cyclone Pro to program the QB8 using the same s19 file and hey presto! correct calibration.
 
I wonder if it is to do with the fact that the Mon08 Cyclone does not have an option to select the QB as the target type? Perhaps the Cyclone firmware is too old. Whatever, it don't matter as I have the Pro anyway.
 
 
Cheers All
 
Rob
 
 
 
0 Kudos
Reply

982 Views
Zahar
Contributor IV
Rob,

You can download the latest prog08sz software from P&E website:

http://www.pemicro.com/support/download_processor.cfm?family=1.

It should support all current HC08 Freescale processors. Please attach the actual FLASH algorithms that you are using to program QY4 and QB8 microprocessor for our analysis.

Best Regards,
Zahar
P&E
0 Kudos
Reply

982 Views
RobG
Contributor II
Hi Zahar,
Thanks for your thoughts. I'm not sure if you understand my thread or I am not getting the gist of your suggestion. But let me explain again.
 
The question was;
Why should not the QB8 give the same clock speed as the QY4A when using the same s19 file programmed into it via the same Mon08 Cyclone?
 
Ok sure I could re-assemble the code with QB8 selected as target. But I am just curious as to why there was a difference when I could not find a signficant difference in the registers between QY4A and QB8.
 
It's not a problem for me because I can use the Cyclone Pro to program QB8. And as I said previously, the Pro does trim the QB8 correctly using the same s19 file that the Mon08 Cyclone does not trim the QB8 correctly (where it does trim the QY4A correctly).
 
If I had time I would do more experimenting and investigation on this but I don't and I have a solution with the Pro anyway. Besides, I'm changing to 9S08SH8 for this product shortly so the whole issue is redundant. But never the less, it would have been nice to know exactly what was going on.
 
At the end of the day, it is most likely something I am missing and not a software or hardware issue. As a manufacturer myself I know only too well that most user queries are not the result of manufacturer faults but the user not abiding by the golden rule of "If all else fails, read the instructions". But again, being a manufacturer I also know only too well that according to Guyatt's Theorum; "the number of users that read instructions is inversely proportional to the number of pages". :smileywink:
 
Rob
0 Kudos
Reply

982 Views
Zahar
Contributor IV
Rob,

What software are you using to program your 908QY4/QB8 targets? What is the version number of this software?

Whether you are using P&E software or Codewarrior, specifying the correct microprocessor and choosing the right programming algorithm is the key. In Codewarrior the programming algorithm is choosen for you by default. It always corresponds to the target that your project is configured for.

In P&E software such as prog08sz FLASH programmer and Cyclone Pro image creation utility you actually get to choose the algorithm which should always correspond to the processor that you are working with.

I took a closer look at 908QY4A and 908QB8 and it turns out that QY4A can only be trimmed to the internal frequency of 8Mhz. On the other hand QB8 processor allows one to trim the device to 4,8 and 12.8Mhz depending on the programming algorithm that the customer is using. I believe if you try to use a QY4A algorithm to program a QB8 target it will trim device to a default value of 4Mhz as the timing OSCSC register does not properly get handled.

Best Regards,
Zahar
P&E
0 Kudos
Reply

982 Views
RobG
Contributor II
Zahar,
Thanks for your continued interest.
 
Going back to my original post, I note a few mistakes I made. First is the measured speed should have read 3.2 MHz not 3.8. Second, clearly proper trimming was not being done in QB8. Lastly, only QY4A programming algorithm was being used in the Mon08 Cyclone.
 
The s19 file used was assembled from within WinIDE. The assembler is CASM08Z.EXE.
The Mon08 Cyclone config utility is V1.92 (QBx is not a target option).
 
What makes you conclude only 8 MHz ICF can be trimmed in QY4A? I run QY4A at 12.8 and it trims correctly via Mon08 Cyclone.
 
It's clear to me now that the answer to my puzzle is programming algorithm choice as you suggest. I'm sure the Mon08 Cyclone would trim the QB8 correctly if QB was a target option. But as I've said before, it's not an issue as I am using the Pro for the QB8.
 
Rob
 
 
0 Kudos
Reply

982 Views
bigmac
Specialist III
Hello Rob,
 
I checked the programming algorithm files within an earlier CW package, and also those supplied by P&E with the PROG08SZ program.  For the QY4A device, both seem to indicate a trim bus frequency of 3.2 MHz (an oscillator frequency of 12.8 MHz), contrary to what Zahar indicated.  The file I refer to is 908_qy4a.08p.
 
For the QB8 device, there are three separate programming algorithm files, one for each operating frequency - 908_qb8_12p8mhz.08p, 908_qb8_8mhz.08p and 908_qb8_4mhz.08p.
The differences between these files amount to two lines (ignoring comment line differences).
 
I wonder if CW is selecting the correct file? Have you already tried using PROG08SZ program?
 
Regards,
Mac
 


Message Edited by bigmac on 2008-03-23 06:07 AM
0 Kudos
Reply

982 Views
RobG
Contributor II
Hi Mac,
I wondered why the different .08p files. So it's all about the right trimming algorithm hey? Regardless, I always choose the file according to the ICF I'm running anyway.
 
I'm not using CW. I've always used assembly language and P&E IDE. I generally don't use PROG08SZ. I have used it occasionally when debugging. Most developement is done with MMEVS and then production programming via Mon08 Cyclone (and Pro) in stand alone mode. Usless I'm missing something, PROG08SZ is a right pain in the ^%$ for repetitive programming.
 
The issue is solved now anyway. The solution is simply to use the Cyclone Pro if I want to program QB8 devices.
 
Thanks
 
 
Rob
0 Kudos
Reply