I started to play with MCUXpresso earlier today and was trying to get two demos working on the FRDM-K64F. I got them working, but I needed to make changes. In doing so, I came up with a couple of questions.
Why is that there if the demo is using UART3?SIM->SOPT5 = ((SIM->SOPT5 &
(~(SIM_SOPT5_UART0TXSRC_MASK))) // Mask bits to zero which are setting
| SIM_SOPT5_UART0TXSRC(SOPT5_UART0TXSRC_UART_TX) // UART 0 transmit data source select: UART0_TX pin
);
Hi Dave:
This demo configured UART0, could you please let me know where do you see UART3?
void BOARD_InitPins(void) {
CLOCK_EnableClock(kCLOCK_PortB); /* Port B Clock Gate Control: Clock enabled */
PORT_SetPinMux(PORTB, PIN16_IDX, kPORT_MuxAlt3); /* PORTB16 (pin 62) is configured as UART0_RX */
PORT_SetPinMux(PORTB, PIN17_IDX, kPORT_MuxAlt3); /* PORTB17 (pin 63) is configured as UART0_TX */
SIM->SOPT5 = ((SIM->SOPT5 &
(~(SIM_SOPT5_UART0TXSRC_MASK))) /* Mask bits to zero which are setting */
| SIM_SOPT5_UART0TXSRC(SOPT5_UART0TXSRC_UART_TX) /* UART 0 transmit data source select: UART0_TX pin */
);
}
Regards
Daniel
I'd better double-check things to make sure it wasn't something I had done! In hindsight, maybe that's what happened. This does highlight my main question, which is, why is the demo using PTB16 and PTB17 instead of something like PTC16 and PTC17 that are clearly marked on the arduino headers?
You are probably right that the demo was UART0 and I misidentified things in my original post, and I apologize for that.
I believe I did get the UART interrupt demo working with PTC16 and PTC17 using UART3, but am I correct that UART3 doesn't have a TX/RX pin selection register? (i.e. like SOPT5 for UART0/1)
I'll answer my last question - doesn't look like UART3 has the same sort of selection, so I should be able to delete that code from the demo and still have a working UART. I need to read up on UART0 to understand what SOPT5 is doing.
Hi Dave
UART0 is connected to the OpenSDA's VCOM interface pins on PTB16 and PTB17 so that is why these are used as default.
The SIM_SOPT5 controls special connections to UARTs 0 and 1 pins but these are not relevant for normal UART operation (they allow the output to be modulated with a timers - eg. for driving infra red diodes, and the input to be from a comparator - eg. when special switching levels are desired).
For UART3 the differences are that it is clocked from the bus clock and not the system clock (as UARTs 0 and 1 are) and for connections on PTC16 and PTC17 the connections are made in the PORTC_PCRx registers (ALT3).
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
[including full DMA driven (free-running) rx and tx for FreeRTOS based developments]
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html