AnsweredAssumed Answered

How to make bootloader on another UART than UART0? (K64f)

Question asked by Bony X on Jan 16, 2019
Latest reply on Jan 24, 2019 by Bony X

Hello!

I'm using the frdm k64f and i'm testing the bootloader with examples. I'm using the freedom_bootloader example from bootloader_examples (SDK 2.5.0) and the KinetisFlashTool for updating programs.

For me both examples - led_demo_freedom_0000 (without bootloader) and led_demo_freedom_a000 (with BL) works!

 

Now I try to use another UART for updating my program, e.g UART2 (RX - PTD2 TX - PTD3).

 

I found this note inside ""pinmux_utility_common.c":

 

//! this is to store the function pointer for calling back to the function that wants
//! the UART RX instance pin that triggered the interrupt. This only supports 1 pin
//! for UART0 because UART1 is on PORTC which does not support interrupts

 

Soo, is it possible to run my bootloader by using UART2 on PTD2/3?

Where can I check which uart is usable?

 

I found sth like this for MKV31F51212:

Hi,

Sorry for reply you so late.

I tested UART2, it can work. There are some key point you should pay attention to.

1. In peripherals_pinmux.c,

#define BL_ENABLE_PINMUX_UART2 (BL_CONFIG_SCUART)

//! UART pinmux configurations
#define UART2_RX_PORT_BASE PORTE
#define UART2_RX_GPIO_BASE PTE
#define UART2_RX_GPIO_PIN_NUM 17 // PIN 16 in the PTB group
#define UART2_RX_FUNC_ALT_MODE kPORT_MuxAlt3 // ALT mode for UART0 RX
#define UART2_RX_GPIO_ALT_MODE kPORT_MuxAsGpio // ALT mdoe for GPIO functionality
#define UART2_RX_GPIO_IRQn PORTE_IRQn
#define UART2_RX_GPIO_IRQHandler PORTE_IRQHandler
#define UART2_TX_PORT_BASE PORTE
#define UART2_TX_GPIO_PIN_NUM 16 // PIN 17 in the PTB group
#define UART2_TX_FUNC_ALT_MODE kPORT_MuxAlt3 // ALT mode for UART0 TX



2. In peripherals_KV31F512.c

#if BL_CONFIG_SCUART
// UART0
{.typeMask = kPeripheralType_UART,
.instance = 2, //must set to 2
.pinmuxConfig = uart_pinmux_config,
.controlInterface = &g_scuartControlInterface,
.byteInterface = &g_scuartByteInterface,
.packetInterface = &g_framingPacketInterface },
#endif // BL_CONFIG_SCUART



3. DSPI pin is conflict with UART2, please take care.



4. In the function get_uart_clock(), you should add

case 2:
return get_bus_clock();



Regards,

Jing

Quotation from: MCUBOOT v.2 on FRDM-KV31 board with UART1/UART2/LPUART0 

I did all what Jing suggested and I still cant connect with KinetisFlashTool.

Jing Pan maybe u have any other suggestions?

 

 

Regards!

Outcomes