We have a board where we use PTA18 as gpi pin, we muxed it correctly and signal is read correctly from that pin. But after couple of changing pin input logic levels, the baudrate in uarts is changed (we are using two uarts and both of them show wrong baudrate on scope).
System clock was FLL from internal 32kHz.
Now we setup system to use external 32kHz crystal, and this works.
But this issue is not addressed to as far as we can see in forum or in errate.
Muxing on pin seamed to be correct:
PORTA_PCR18 = 0x110, before and after freq. changed.
Hi guys,
This was our configuration:
// Select 48 MHz FLL from internal 32 kHz
MCG_C4 |= (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(1));
MCG_C1 = MCG_C1_IREFS_MASK; // Ensure FLL comes from 32 kHz ref
So basically it should be FEI, Freq engaged internally.
When we setup PTA18 as gpio and ground it, the system clock doesnt change.
When we leave it open, system clock doesnt change.
When we remove muxing of this pin, and any reference in code of this pin, and apply 4 pulses (we put simple switch on this pin), both faster and slower, it also changes system frequency.
We can see status led changed its blinking period (from 1 to 1,4s, we used scope, not arm watch:-) ).
Uart baudrate was setup to 115200, and it changed to 120k, after 4 "pulse" from switch, and after some more it droped to around 83300.
We have much more inputs and outputs, and its all setup the same, it all seamed to be working.
We can see this input pin change value (we have pc app that reads status of all inputs and outputs).
Thank you for helping us!
Hi Zoran,
Thank you for your more details.
Could you please tell me your chip's part number, the full name of your K12 chip, and the mask-set number.
I don't have the board for this chip on my side, but I test it on my TWR-K21D50M chip, after configure the PTA18 to GPIO, my uart baud rate still correct even I put high or low level to PTA18.
So, please give me the full name of your chip and it's mask set number.
Besides, I suggest you use the CW10.6 PE to create one project, based on FEI, and just add the uart and configure PTA18 to GPIO and test it again, don't add any other code.
After you tell me you chip's part number, I also would like to help you to create the project. But you need to tell me the UART pin you are using. Then you can test it again on your side.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Zoran,
1. Please give us your chip's full name.
2. Try to use the internal 32Khz, MCG mode is FEI, and connect EXTAL to ground, then test your two uarts, whether it shows the correct baudrate or not? test it for a long time, just make sure the internal osc can work stable on your side.
3. If item2 is completed, and the two uarts work ok, then change the PTA18 mux, and configure it as GPIO, test it again, whether uart baudrate is changed.
After change the PTA1, debug and check the PORTA_PCR1 register, make sure the MUX is correctly changed.
Please also give us the uart baud rate test picture from your oscilloscope.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
What is your mask-set code?