FRDM-K32L2B3 and hello_world, led_blinky

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

FRDM-K32L2B3 and hello_world, led_blinky

1,155 次查看
3ric
Contributor I

SDK samples work on their own but:

just copying from hello_world.c to led_blinky.c:

...
SysTick_DelayTicks(1000U);
PRINTF("blinking");
GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN);
...

will not print anything in the terminal window, what else needs to be initialized? 

i have examined the build options, the code already has:
BOARD_InitDebugConsole();

0 项奖励
4 回复数

1,116 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hello @3ric,

It seems the initialization function for the debug console is correct, but you may be missing a few steps. You will need to initialize the UART pins by copying the initialization from the hello_world sdk, add the necessary drivers from the example and include the PRINTF function.

Also, please note that the baud rate for this example is 115200, so be sure to check that as well.

Best regards, Julian 

0 项奖励

1,106 次查看
3ric
Contributor I

when i set a breakpoint in the UART init function and "debug" through the IDE, it loads the board and then complains that breakpoints could not be set. 

if i disable the breakpoints, it continues to load. i can trace INTO the UART init code but it seems to do this only in the IDE, it's as if the components are not loaded to the board.

please direct me to the break between the auto-detection in the IDE that is not packaging the necessary drivers/components where I need to manually list them. where are the tabs? what configuration file must I edit?

thanks =E

frdmk32l2b_led_blinky/board/board.c
void BOARD_InitDebugConsole(void)
...
   DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);

frdmk32l2b_led_blinky/utilities/fsl_debug_console.c
status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq)
...
  (void)HAL_UartInit((hal_uart_handle_t)&s_debugConsole.uartHandleBuffer[0], &usrtConfig);

frdmk32l2b_led_blinky/component/uart/fsl_adapter_lpuart.c
hal_uart_status_t HAL_UartInit(hal_uart_handle_t handle, const hal_uart_config_t *config)

 

0 项奖励

1,094 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @3ric,

Yes, of course. This process is simpler with MCU ConfigTools. Firstly, import a new SDK of the led_blinky example, then refer to MCUXpresso configuration at the top right of the project explorer tab.

tempsnip.png

 Go to pins, and enable pins 23 and 24 (PTA 1 & PTA 2) as LPUART0_RX and LPUART0_TX.

tempsnip1.png

After that, click on the "update code" button at the top. Next, in led_blinky.c, include at the top "fsl_debug_console.h" and simply add the "PRINTF" function where you want the text displayed. 

Best regards, Julian

0 项奖励

1,129 次查看
3ric
Contributor I

anyone else? this is a 60-second repro...

0 项奖励