Attached is the minimum code to show the spurious NULL character. Screen capture of terminal program is also attached.
I am using FRDM-KE15Z. The same problem can also be reproduced in FRDM-KE16Z, or an KL27 target.
To build the program, import KE15Z helloworld example. Remove all folders except CMSIS, device, startup. Also remove all files in Source folder. Copy attached file into Source folder. Then it should build.
FRDM is already connected with microUSB cable since you are building and downloading the project. To test the program, open a Terminal program. Set to 115200-8-1.
Note: P&E Micro Probe appears to have the same problem.
Hello Jei,
Hope you are doing well. Are you able to reproduce the same results using the examples we provide for the UART interface?
This is interesting, since we do not define the PCR -PE or PS mask in our examples either. Could you please describe what you are connecting to your UART. Are the voltage levels on the TX and RX line low or high when starting the for(;;) loop?
Best Regards,
Sabina
Further dig using scope. The spurious NULL received is caused by the floating Rx line.
Guess the correct way of initializing UART is to pull-up the port. Add these two instructions seem to resolve the problem:
PORTC->PCR[ 6 ] |= PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
PORTC->PCR[ 7 ] |= PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
Note: Further test seems to show, not the probe, but the LPUART module in KE15 self-generated a NULL ~87uSec after power-up.