Hello NXP community,
So I was trying to set up UART communication on my FRDM-KL25 development board and came across two difficulties in the process (fixed the first difficulty and needing advice on the second but mentioning both).
Because of having SBR value as 11 (truncating the decimals), the actual baudrate exceeded the 3% margin (see red box). Is this okay or an expected behavior?
Me reducing the System Clock to 24MHz - hence reducing bus clock for UART0 to 12MHz - apparently resolved the issue? Thoughts?
Basically the assert failed since it couldn't find the UART0 memory address from the array of supported UART memory addresses named as s_uartBases. And here's the culprit:
UART0 isn't a part of this list! Any thoughts on this?
I know UART0 is different from UART1 and UART2 in that for UART0 you need to do some additional configurations in the MCU (enable the UART0 clock, specify what clock should be driving this peripheral, etc) that are not needed for UART1 and UART2. So is there another special function to initialize this UART0?
I know I can do away with this problem by configuring UART1/2 instead and forget about it. But I'm curious to know if there's something to know here for UART0? Maybe it's something I missed in the Reference Manual?
Hope someone could help, thanks again
I'll be reviewing your post and I'll let you know when I have an answer.
Could you please help me by clarifying some of my own questions please?
1. Are you using MCUXpresso IDE? Which version?
2. Which version of the SDK are you using? And your project is based on an example or are you using only the drivers?
3. Do you want to use the UART to send and recieve data from a serial terminal with your PC?
I'll be waiting for the response.
Best Regards, Miguel.
Hi @Miguel04 ,
Thanks for taking the time to look into this!
1. Yes I am using MCUXpresso IDE.version 11.4.1
2. For the SDK version I see that I'm using 2.1.4 for UART driver. Hope this is what you are asking.
Yes, I've looked up the driver examples for UART, specifically the interrupt option, and then implemented the APIs in my code.
3. And yes, my current application is to use the terminal to communicate to the board.
Also, FYI, I had set up UART2 yesterday and it works! I could send a character 'I' from the board to the terminal and the system could read any single byte character sent from the terminal
I'm using AWAVO as my terminal monitor and Semihosting Console to Debug the FW.
If it helps, I've also attached a zip that contains the test code. There's a macro in the main file MKL25Z4_Project.c called TESTUARTBASE where you can try out the working UART2 operation and toggle to UART0 that isn't able to be initialized.
Sorry for the late reply.
I'm currently working on your case and I would like to review the project you share with me, however, I'm not able to see through:
UART_WriteByte(); and DB_PRINT();
I want to review the uart write byte function specially.
Regarding your questions:
The UART0 is defined aside the other uart instances on the MKL25Z4.h file.
Also, according to the schematic of the FRDM-KL25Z, using the UART2 to print on the terminal should not be possible since the UART0 instance is the one connected to the K20 OpenSDA interface on the FRDM-KL25Z, I would like to review completely the project and try out my self your configuration to verify my understanding.
I would like to recommend you to update the MCUXpresso IDE version, right now the newer version is the 11.8 and the FRDM-KL25Z's SDK currently is on the 2.2 version, we recommend to use the newer versions since they come with some bug fixes.
Best Regards, Miguel.