Garbled Output from Uart0

Hi there,

In a custom developed board based off of MDBT53-1M, I am struggling with the serial communication using UART0 pins. Using the default settings, I have been successful in receiving the output in an MDBT dev kit but I am not able to replicate that on the custom board.

Here are the source code, and config files:

`main.c`

/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(HelloWorld, LOG_LEVEL_INF);
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000


/*
 * A build error on this line means your board is unsupported.
 * See the sample documentation for information on how to fix this.
 */


int main(void)
{
	int ret;
	bool led_state = true;
	printk("strat of the application \n");
	LOG_INF("strat of the application \n");
	
	while (1) {
	
		led_state = !led_state;
		printk("LED state: %s\n", led_state ? "ON" : "OFF");
		LOG_INF("LED state: %s\n", led_state ? "ON" : "OFF");
		k_msleep(SLEEP_TIME_MS);
	}
	return 0;
}

`prj.conf`

CONFIG_GPIO=y
CONFIG_LOG=y

Not using any overlay file as I am not using any peripherals. I have access to uart0 pins: RX, TX, CTS, RTS through a dedicated pin header. Despite there being print statements in every iteration of the loop, I dont see anything on the serial monitor. The same application, however, gives the desired serial messages on MDBT dev kit. 

Some other relevant details:

- MDBT53 is a device based on nRF5340

- SDK v 3.0.0 and Toolchain v 3.1.1

I have followed a similar forum post where the OP recognized a wrongly cleared configuration statement (`CONFIG_UART_CONSOLE=n`) but I dont have that issue in my generated .config file. 

Kindly advise how to debug the issue. 

Parents
  • I got it to work!

    It turns out that MDBT modules have an internal oscillator and if there is no external oscillator provided in your PCB, you must use the following configuration options in prj.conf so that the device does not look for an external oscillator:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    

    This and make sure that uart0 is enabled explicitly according to your specific pinout. 

Reply
  • I got it to work!

    It turns out that MDBT modules have an internal oscillator and if there is no external oscillator provided in your PCB, you must use the following configuration options in prj.conf so that the device does not look for an external oscillator:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    

    This and make sure that uart0 is enabled explicitly according to your specific pinout. 

Children
Related