nrf52840 Dongle - Uart communication fails

Hi,

I am using the nrf52840 dongle board just to startup a project. I connected to the dongle a UART-USB converter to the dongle... but when I enable the UART into the firmware, nothing works (I don't have the debugger, so I don't know exactly what is not working.

The prj file is:

CONFIG_GPIO=y
CONFIG_I2C=y

# Just for debug!
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y

CONFIG_BT=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV=y
CONFIG_LOG=y
CONFIG_BT_DEVICE_NAME="Test Periodic Advertising"

The Overlay:

&pinctrl {

    uart1_default: uart1_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 2)>;
        };
        group2 {
            psels = <NRF_PSEL(UART_RX, 0, 29)>;
            bias-pull-up;
        };
    };

    uart1_sleep: uart1_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 2)>,
                    <NRF_PSEL(UART_RX, 0, 29)>;
            low-power-enable;
        };
    };

    i2c0_default: i2c0_default {
        group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 11)>,
                    <NRF_PSEL(TWIM_SCL, 0, 12)>;
        };
    };

    i2c0_sleep: i2c0_sleep {
        group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 11)>,
                    <NRF_PSEL(TWIM_SCL, 0, 12)>;
            low-power-enable;
        };
    };
};

&i2c0 {
	compatible = "nordic,nrf-twi";
	/* Cannot be used together with spi1. */
	status = "okay";
	pinctrl-0 = <&i2c0_default>;
	pinctrl-1 = <&i2c0_sleep>;
	pinctrl-names = "default", "sleep";
};

&systick {
    status = "disabled";
};

&spi1 {
    status = "disabled";
};

&uart1 {
    status = "okay";
    //compatible = "nordic,nrf-uarte";
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-names = "default", "sleep";
};

&uart0 {
    status = "disabled";
};

And the initialization is:

const struct device* Board_uartDevice = DEVICE_DT_GET(DT_NODELABEL(uart1));

static void initUart (void)
{
    if (Board_uartDevice == NULL) 
    {
        return;
    }

    if (!device_is_ready(Board_uartDevice)) 
    {
        return;
    }
}

Where is it the problem?!

Thanks

Marco

  • Hello Marco,

    I am not sure what the issue is, but it could be that you are trying to use the CONFIG_SERIAL, which uses the UART0 backend, which is probably not connected to anything in your case. So you could try to either set CONFIG_SERIAL=n, (this is the UART terminal used by zephyr to print logs etc), or you can try to use UART0 instead of UART1 in your application. 

    Either way, you will probably run into other issues while developing, and doing so without a debugger can be extremely time consuming. I suggest that you get hold of a proper development kit sooner rather than later. When you are done with your application, you can port it over to the dongle. 

    Best regards,

    Edvin

  • Hello  

    thanks for your reply. If I remove CONFIG_SERIAL the CONFIG_UART_ASYNC_API told me that serial support is missing. Now, on my application there is only a led that blink... it is very simple and when I enable the uart the LED stops blinking.

    I also try to use uart0, but the result is the same.

    Yesterday I bought a DK board for the next tests, but I realy don't understand why a simple thing like sending some chars on uart doesn't work!

    Best,

    Marco

  • Hello Marco,

    warcomeb-am said:
    but I realy don't understand why a simple thing like sending some chars on uart doesn't work!

    Setting up a peripheral and getting it to work without a debugger can be a struggle. There are lot's of things that can happen, and without a debugger it is difficult to say what the issue is. I could ask for a copy of your application and run it on a DK, but you will probably run into many similar issues along the way, so it will be a lot quicker when you have the possibility to see the debug output yourself, instead of waiting for me to replicate all the issues that you encounter along the way.

    For example all the fault handlers will use UART0, and these will not be posted properly without a debugger. This means that as long as your application is working as intended, you will be able to see "logs" that you print from your application, but once something crashes, the application will not be able to handle printing that without a debugger. 

    Best regards,

    Edvin

  • Hello Edvin,

    Yesterday I received the nrf52-dk board and I flash into the same code... and it works as I want without any change! Thinking

    I don't understand why, but  it doesn't matter... I'll continue with the dk!

    Best

    Marco

Related