I’m trying to use the clocks tool on the MCUXpresso page and the generated code isn’t working for me. I’m looking to generate
Clock_config.c
Clock_config.h
I started with an example project for the K64 Freedom board using a 50MHz crystal. Now I would like the same code to run on a K24 with a 16MHz oscillator. I have attached the generated files.
I get stuck on line 1503 of fsl_clock.c
/* Wait for CLKST clock status bits to show clock source is ext ref clk */
On a bit of a side note here, I removed the clock configuration all together in an attempt to move forward on some other things but when I try to write to the PORTA->PSOR register I get a JLINK error
"Could not start CPU core (error code: -1)"
I'm hoping this has something to do with not configuring the clocks but I'm not sure. Any idea what this might be? I have ungated the PORTA clock in the system integration module.
解決済! 解決策の投稿を見る。
Hi Ryan
I couldn't find the referenced code in the attached files but it may be that you are specifying a 16MHz "oscillator" instead of a 16MHz "crystal" in which case the oscillator enable will be missing and switching to an external source would hang.
The generation tools may or may not work - I have seen them fail in some cases so it makes sense to understand the operation you need so you can patch when necessary.
I have written an overview at http://www.utasker.com/kinetis/MCG.html which explains the switch controls, modes and sequences that should be respected, including some register switch positions that make it more logical than the Kinetis user's manual (as well as some hidden switches that are not really described in their context).
Your port issue will not be related to the clock if you just run at the chips default rate (about 21MHz). The JTAG signals are on PORTA so beware that you don't have code switching them to different functions and losing JTAG connection.
You still have 20 minutes free remote desktop consultancy left in case you need a quick fix ;-)
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K21/K22/K24:
- http://www.utasker.com/kinetis/TWR-K21D50M.html
- http://www.utasker.com/kinetis/TWR-K21F120M.html
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/TWR-K24F120M.html
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html
Hi Ryan
I couldn't find the referenced code in the attached files but it may be that you are specifying a 16MHz "oscillator" instead of a 16MHz "crystal" in which case the oscillator enable will be missing and switching to an external source would hang.
The generation tools may or may not work - I have seen them fail in some cases so it makes sense to understand the operation you need so you can patch when necessary.
I have written an overview at http://www.utasker.com/kinetis/MCG.html which explains the switch controls, modes and sequences that should be respected, including some register switch positions that make it more logical than the Kinetis user's manual (as well as some hidden switches that are not really described in their context).
Your port issue will not be related to the clock if you just run at the chips default rate (about 21MHz). The JTAG signals are on PORTA so beware that you don't have code switching them to different functions and losing JTAG connection.
You still have 20 minutes free remote desktop consultancy left in case you need a quick fix ;-)
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K21/K22/K24:
- http://www.utasker.com/kinetis/TWR-K21D50M.html
- http://www.utasker.com/kinetis/TWR-K21F120M.html
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/TWR-K24F120M.html
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html
I had it configured for an external clock rather than a crystal. Thanks so
much!
Mark,
I am using a DSX321G crystal resonator
http://www.scanti.com/images/products/kds/DSX321G.pdf
It does appear that the clock tool thinks I'm using an oscillator. I'll try
to figure out how to change that. I have hand cranked all of the clock
configuration in GCC just using the reference manual but I would really
like to get the KSDK functions to work.
As for the port issue I was having trouble with the GPIO_PinInit function
which configures a pin as an input/output and sets the value (I know you
don't use KSDK). PA4 (also the NMI/EzPort CS) was causing an issue so then
I tried PA6 which still caused me to lose communication. I don't have any
trouble with PORTB
I'm saving those 20 minutes! You have been my most valuable Kinetis
resource.
On Mon, Feb 5, 2018 at 11:27 AM, mjbcswitzerland <admin@community.nxp.com>