Has anyone been able to use the UART 2 of the demo board?
Everything i see shows easy going from uart0 to uart1 but uart2 seem to be the odd man out.
Any demo code would be appreciated.
Hi Peter Hedlund,
Please modify the codes shown below:
#define DEMO_UART UART2
#define DEMO_UART_CLKSRC kCLOCK_BusClk
#define DEMO_UART_CLK_FREQ CLOCK_GetFreq(kCLOCK_BusClk)
#define DEMO_UART_IRQn UART2_RX_TX_IRQn
#define DEMO_UART_IRQHandler UART2_RX_TX_IRQHandler
void BOARD_InitPins(void)
{
/* Port E Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortE);/* PORTE16 (pin 10) is configured as UART2_TX */
PORT_SetPinMux(PORTE, 16U, kPORT_MuxAlt3);/* PORTE17 (pin 11) is configured as UART2_RX */
PORT_SetPinMux(PORTE, 17U, kPORT_MuxAlt3);
}
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I thank you much for your assistance. I apologise for the delay in the reply as I was working on getting our board up and running with the same processor.
This issue is only half fixed however.
I took the project from bsp\sdk\2.5.0\boards\frdmkv31f\driver_examples\uart\interrupt\uart_interrupt.c
I built the program and ran it on the KV31F board, with the build in usb port No issues, I get a wake up message on my terminal and what i type out to the control is sent back to me from the control.
I then applied your changes.
I connected a usb to 232 adapter to the KV31F board
J1-15 (porte16 TX) to RX of my adapter board
J2-12 (porte17 RX) to TX of my adapter board
J2-14 (gnd) to gnd of my adapter board.
When the board first powers up I get the sign on message prompting for user input.
The board does not respond to input from my pc to the board. I can see the tx led on my board sending out
to the KV31F, but it does not respond to the serial input.
I am sure there is just another setting that needs to be tweaked to get UART2 working, but for not I cant find it and i have other parts of the board to get up and running for now.
It would appear the only way to send data out the serial port is with the function UART_WriteBlocking. I have tried to use the UART_WriteByte function which works with UART0 but not UART2
Is there any other changes i need to make?
Thanks in advance
Peter Hedlund
Sorry for my late reply!
I think you should use USB-TTL instead of use USB-232.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
The 232 adapter i used was a 3.3v ttl to usb adapter.
The adapter i had however was subject to lockup without notice. So an apparent non-response from the board was false.
Rebooting the target board did not fix the problem, unplugging usb didn't solve the problem, resetting terminal program didn't solve problem.
I had to unplug the 232 device completely both usb and target, reload terminal program then re-connect 232 device.
It would work through several flashing of the target board then wink out.
I have since replaced my serial adapter with one from home with a FDTI chip in it and had no issues since.
I was able to trouble shoot and get UART2 working once the adapter issue was resolved.
Thank you for the assistance.
Pete Hedlund
Actually what i was hoping for in the way of help is a simple interrupt based demo like found in the BSP directory. The code show there is not able to be converted from LPUART0 to UART2
Hi Peter
You can get complete code for all LPUART and UARTs on the KV31 from the open source uTasker project on GitHub which allows you to use interrupt or DMA driven modes (configurable on any LPUART or UART and in interrupt/DMA mode at run time or on-the-fly) and simulate it in Visual Studio.
If you are only allowed to work with demo code supplied in the BSPs you can take code from any other K part where you can find something since it is also compatible with the KV31.
Regards
Mark
Hi Peter
UART2 (Tx + Rx) can be located on either PTD 2/3 or PTE16/17, and the difference between UARTs 0 and 1 is that it is clocked from the bus clock rather than the system clock.
Regards
Mark
Complete KV31 solutions, training and support:http://www.utasker.com/kinetis.html
Kinetis KV31:
- http://www.utasker.com/kinetis/TWR-KV31F120M.html
- http://www.utasker.com/kinetis/FRDM-KV31F.html
FreeMaster: http://www.utasker.com/kinetis/FreeMASTER.html