I am working on TRK-KEA64 trying to initialize oscillator to generate 40 MHz as core (system) clock and 20 MHz as Bus clock.
/* FLL Enabled with External clock */
/* High range & gain; select osc */
/* OSCEN =1 ; OSC module enabled */
/* OSCSTEN = 0; OSC clock disabled in stop mode */
/* OSCOS = 1; OSC clock source is selected */
/* RANGE = 1; High freq range of 4-24 MHz */
/* HGO = 1; High-gain mode */
OSC_CR = 0x96;
/* Wait until oscillator is ready*/
while ((OSC_CR & OSC_CR_OSCINIT_MASK) == 0);
Code does not come out from the while loop due to the non-initialization of the oscillator.
Could you help please ?
Hello Kerry,
I put a similar crystal (Y1) which is specific to OpenSDA and now the crystal oscillator is working very good.
Thank you for your support
Hello Mohammed Aboelnasr,
Thank you for your feedback.
That's very good to hear you make it working.
Your original problem should still caused by the unmatched crystal.
If your problem is solved, please help me to mark the correct answer to close this question.
Thank you and have a nice day!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I did a prompt test on the external oscillator as follows;
I monitored the crystal pins themselves using oscilloscope to make sure that the crystal is not working.
I doubt that there should be a specific type of crystals that could work with TRK-KEA 64.
I do not know do you agree with me ?
I am not pretty worried. the point is blocking so that i am a little bit worried !! :smileyhappy:
I find in the TRK-KEA128, it doesn't solder C42 and C41, maybe you also can remove your C42 and C41, then try again.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello,
Before you test the crystal, you need to download my code at first, because it need to enable the internal OSC, then the external crystal can oscillate.
Besides, I find some version in our TRK-KEA128 is using the external crystal, it is the same crystal in Y1, it is
XTAL 8.00MHZ RSN CERAMIC -- SMT
MURATA
CSTCE8M00G55-R0
I think you can find this crystal, and solder to your board.
Or you can take off one Y1 in another board to one board, then test it again.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Yes, I added the 1 M resistor
By the way, i have two boards and i tried both of them and both are not working !!
Hello Mohammed AboeInasr,
What the crystal you are using?
The crystal can use the same crystal as on board(TRK-KEA64) Y1.
The information is:
154 | 1 | Y1 | 8.00MHZ | XTAL 8.00MHZ RSN CERAMIC -- SMT | MURATA | CSTCE8M00G55-R0 |
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
What kind of power you used , USB cable or a normal power supply ?
Hello Mohammed,
The board I am using is the TRK-KEA64, the power is the USB cable which is connect to J16.
But my board also don't have the external crystal.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I noticed that the I2C communication is also on these two pins and i doubt that the two pins are still allocated for I2C communication instead of external oscillator because i have no oscillations when i monitored these two signals.
Hello Mohammed Aboelnasr,
Please don't worry, PTB7,PTB6 pin is the EXTAL and XTAL in default, you can find the crystal pin is the highest priority.
Do you add the 1M feedback resistor? This is very important.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Kerry Zhou,
I'd like to know some points about the oscillator.
What should be the peak to peak value .. Could you attach your obtained image due to spying on PTB6 and PTB7 please ?
Thank you really , Kerry Zhou
I've seen a lot of your comments in different posts and i really made use of them.
Now, I have soldiered the crystal (8 Mhz) with the resistors (zero ohm) and capacitors (22 pF).
I do not know if there is a special crystal for KEA 64. From where could i get it ?!
But for now , it is not working and the behavior obtained is like the follows;
1- OSC initialization is not working (Flag has not been set to '1')
2- Also, IREFS bit that should be changed to '0' which reflects external oscillator is always '0' (Working with the internal oscillator) .. this bit is in register ICS_S.
Do you have any ideas ? .. Thanks for your support in advance.
Hello Mohammed Aboelnasr,
1. let's talk the hardware about hte OSC
From the TRK-KEA64 board schematic, you can find this circuit:
You need to solder R74, R75 =0, r86=1M, Y2 8Mhz crystal, C41 and C42.
2. Software
You need to enable the OSC, then the external OSC circuit can oscillating.
I already help you create a CW PE project, which is already configured with 8M external crystal, you can download the code to your TRK-KEA64 board.
Then reset the board, and use the oscilloscope to check the PTB6_XTAL and PTB7_EXTAL, whether it is oscillating?
If yes, it means your hardware is working, otherwise, you still need to check your osc external circuit.
Please use my attached project and test it on your side.
After you test it, if you still have problem, please tell me the detail test result on your side.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Mohammed Aboeinasr,
In my memory, there has some TRK-KEA64 board version don't have the external oscillator.
So, please check you board at first, do you have the external oscillator for your KEA64?
You can check the according schematic.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------