Hi,
i am using FRDMk64f120, kds 3.0 and KSDk 1.2.0 example.i tried UART non blocking example project. its working fine with none parity but if i change to ODD or EVEN parity its not working why..?
i changed following method:
uart_user_config_t uartConfig = {
.bitCountPerChar = kUart8BitsPerChar,
.parityMode = kUartParityOdd, //kUartParityDisabled, //this one commented and changed
.stopBitCount = kUartOneStopBit,
.baudRate = BOARD_DEBUG_UART_BAUD
};
other remaining code same. in example code only i changed "kUartParityDisabled -to-kUartParityOdd".
why this problem coming? is any thing i want to add or change?
regards,
sudhakar p
Hello Sudhakar,
UART Driver used in example uses the 8-bit mode and according to k64's Reference Manual, parity bit is saved in UART_D register:
Example uses UART_HAL_Putchar function that does not consider parity bit, so, you will need to modify this example in order to consider parity bit. You can look at fsl_uart_hal.c file and there are sending and receiving functions that use either 8th-bit and 9th-bit.
So you can modify this example or create a new one that uses these 9th-bit functions in order to add parity support. Please refer to fsl_uart.h and fsl_uart.c files.
uart_bit_count_per_char_t bitCountPerChar)
I hope this can help you
Best Regards,
Isaac
----------------------------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------------------------
hi,
thanks for your information. i tried Even parity, 8-bit and 2-stop bit. but am getting junk value. some character not display correctly. i tried following method,
UART_HAL_SetParityMode ( UART1_BASE,kUartParityEven);
UART_HAL_SetStopBitCount(UART1_BASE, kUartTwoStopBit);
UART_HAL_SetBitCountPerChar (UART1_BASE,kUart8BitsPerChar);
i am using UART1_RX_TX_IRQHandler(). for receiving character. can you give simple example then i can easily understand. give some idea i tried but i am not get output.
regards,
sudhakar
Hi Sudhakar,
Please, see this post: Re: how to set EVEN-7BIT-1 STOP BIT SETTING FOR FRDMK64 , here you can find detailed information in order to configure your UART module correctly.
Best Regards,
Isaac