KE06Z Incorrect Clock Rate when using USBDM

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

KE06Z Incorrect Clock Rate when using USBDM

Jump to solution
695 Views
izzni
Contributor I

So I'm switching from using the P&E OpenSDA support to using USBDM to program and debug a KE06Z target. I'm doing so since I need to start programming custom made target boards that use a different version of the KE06Z chip than the one on the FRDM board.

I was able to get this to run, but I've found that the clock is off. For example, I'm outputting data on a UART at 9600 baud. When using the P&E OpenSDA toolchain it correctly outputs the data at 9600 baud. When I switch to USBDM I found that I had to adjust the baud rate to 8700 in order to get the data to actually be output at 9600 baud.

I'm using Processor Expert extensively, so it is stetting up the target's clock, and I would have thought that the BDM tool being used wouldn't effect the clock rate. Processor Expert is configuring the target to run with a little over a 20MHz clock rate. When running with USBDM it seems to be running closer to 22Mhz.

I'm guessing that I've set it up in such a way that the BDM tool is driving the clock of the target, instead of the external 8MHz crystal.

Anyone have suggestions on how to configure Processor Expert so that the BDM isn't effecting the clock rate of the KE06Z target?

I can post some screenshots of what I believe are the applicable parts of the Processor Expert configuration, but if someone knows off hand what is up it would be great!

Thanks,

Stefan

0 Kudos
1 Solution
425 Views
pgo
Senior Contributor V

Hi Stefan,

I'm equally surprised.

I know of no obvious way that the BDM interface should affect the clock rate of the target if it is running from an external crystal.

The only thought I have is that it is using the internal oscillator and the P&E interface is trimming then clock whereas USBDM doesn't.  This doesn't agree with your description so its very unlikely.

Could you provide a minimal project in Codewarrior and I will test it with a FRM-KE06 board and see if I can find the reason.

Bye

View solution in original post

0 Kudos
2 Replies
426 Views
pgo
Senior Contributor V

Hi Stefan,

I'm equally surprised.

I know of no obvious way that the BDM interface should affect the clock rate of the target if it is running from an external crystal.

The only thought I have is that it is using the internal oscillator and the P&E interface is trimming then clock whereas USBDM doesn't.  This doesn't agree with your description so its very unlikely.

Could you provide a minimal project in Codewarrior and I will test it with a FRM-KE06 board and see if I can find the reason.

Bye

0 Kudos
425 Views
izzni
Contributor I

Hi Pgo,

I apologize for not posting my resolution to the problem up until now.

You are correct in that it was actually running off the internal oscillator, and that USBDM wasn't doing the trimming that the P&E OpenSDA interface was. Frankly I'm glad it wasn't performing the trimming since it forced me to deal with my clocking issue.

The root of my problem was that I had "enabled" the External Oscillator, but I had not changed the clock mode to "FEE", which would have actually made use of the external oscillator to drive the clock. So although the external oscillator was enabled, I still have the clock in "FEI" mode, which made use of the now untrimmed internal oscillator to drive the clock.

I should have spent more time reading the reference manual for the MCU instead of ham fisting my way through it using Processor Expert as a hammer.

Thanks again for your help!

Stefan

0 Kudos