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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,445 次查看
albertobeghetto
Contributor II

Hi,

i'm developing resident flash bootloader application to implement it in all our next projects. For now, only board side, host side will be kinetis flash tool (KFT) using usbtouart FT232 converter.

Starting from NXP_Kinetis_Bootloader_2_0_0 downloaded from MCU Bootloader|NXP , i import to KDS targets/MKV31F51212/kds/freedom_bootloader project.

If i program board with no change of this exmple, i can successfully connetct to it with KFT via usb connection already gived by board, so without using my usbtouart converter. I want to use external converter because our boards will not have usb to uart interface.

So, lets try to user my usbtouart external converter, first i change pin configuration in /MKV31F51212/peripherial_pinmux.h, changin defines of UART0_XX_ to use pin B0 and B1 for UART0.

Program board with this and try to connect with KFT, works !

Now, i have to know, which uarts works with bootloader functionality. Les't try with uart1. In /MKV31F51212/peripherial_pinmux.h ,

1. create BL_ENABLE_PINMUX_UART1 (BL_CONFIG_SCUART) define

2.create new group of UART1_XX_ configuration for E1 (rx) E0 (tx) pins for UART1

Now, connect usbtouart converter to E1 E0 pins, program board, try to connect with KFT, fail :smileysad: 

I also try to do same process to use UART2 on E17(rx) E16(tx) pins and still NOT works.

What am i doing wrong ?

An other question, in this project i search to lpuart0 interface but i do not find it. Is LPUART0 supported by MCUBOOT 2?

Thanks

Alberto

0 项奖励
回复
3 回复数

1,057 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi,

 \MKV31F51212\bootloader_config.h is the file which you should modify to config your own bootloader. At the bottom of the file you can find "#define TERM_PORT_NUM 0". Change it to the port you want to connect to FT232.

Details please find in Kinetis Bootloader v2.0.0 Reference Manual chapter 10 and 11.

Regards,

Jing

0 项奖励
回复

1,057 次查看
albertobeghetto
Contributor II

Hi Jing,

i try to do what you suggest, i try to set TERM_PORT_NUM in MKV31F51212/bootloader_config.h to 2 and also active uart2 pin mux defines as i explain in main post in MKV31F51212/peripherial_pinmux.h. ALSO, i try to edit instance attribute in g_peripherals array in MKV31F51212/peripherial_KV31F512.c setting it to 2. But it DONT works :smileysad:

Thanks

Alberto

0 项奖励
回复

1,057 次查看
jingpan
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复