Testing RXD and TXD Connections

Is there a way to test that the RXD and TXD pins are sending and receiving data on the nrf5340? I am trying to connect these pins to the u-blox ANT-B10-00C using male to female jumper cables but when I try this setup, my serial terminal is not outputting any data.

Parents
  • Hi

    I would recommend using a logic analyzer to monitor the traffic on the pins. You can also use an oscilloscope if you want to see the analog shape of the signals.  

    Regards

    Runar

  • Thank you. Should I use pins P0.20 and P0.22 for RXD and TXD? Would I need any other connections to communicate between my nrf5340 and ANT-B10-00C?

  • I believe I have set everything up correctly. Below is part of my overlay file for uart2. I have the RX pin of the nrf5340 connected to the TX pin of the ANT-B10-00C and the TX pin of the nrf5340 connected to the RX pin of the ANT-B10-00C. However, when I set the communication up, nothing is being outputted to my serial terminal.

     

    This is the code I am trying to run: 

    #include <zephyr/kernel.h>
    #include <zephyr/device.h>
    #include <zephyr/drivers/uart.h>
    #include <zephyr/sys/printk.h>
    #include <string.h>
    
    #define UART_DEVICE_NODE DT_NODELABEL(uart2)  // Use UART2
    
    const struct device *uart_dev;
    
    int main(void) {
        uart_dev = DEVICE_DT_GET(UART_DEVICE_NODE);
    
        if (!device_is_ready(uart_dev)) {
            printk("ERROR: UART2 not ready!\n");
            return -1;  // Indicate error
        }
    
        printk("UART2 communication test started...\n");
    
        const char *test_msg = "Hello ANT-B10!\r\n";
    
        while (1) {
            // Send message to ANT-B10
            uart_fifo_fill(uart_dev, (const uint8_t *)test_msg, strlen(test_msg));
            printk("Sent: %s", test_msg);
    
            k_sleep(K_MSEC(100));  // Short delay
    
            // Check for response
            uint8_t buffer[32];
            int recv_len = uart_fifo_read(uart_dev, buffer, sizeof(buffer) - 1);
    
            if (recv_len > 0) {
                buffer[recv_len] = '\0';  // Null-terminate received data
                printk("Received from ANT-B10: %s", buffer);
            } else {
                printk("No response yet...\n");
            }
    
            k_sleep(K_SECONDS(2));  // Repeat every 2 seconds
        }
    
        return 0;  // Indicate success
    }
    
    

    Would you happen to know why nothing is happening in my terminal?

  • I am also just trying to connect the TX and RX pins together that I have configured, but it seems that the RX pin may be floating. Should the pins be able to send and receive data on the nrf5340?

  • Hi

    Could you upload the overlay? I think I would also recommend to change the pins. If you look at the backside of the DK you can see the pins that is being used to the IMCU, LEDs, GPIO and crystals. I would suggest to not use the pins to the IMCU. It is possible to use them but then you need to disconnect the IMCU. I'm also wondering if you had any equipment to see if there is anything on the pins. If you don't have it no worries, its just easier while debugging to see if there is something there. 

    Just to verify, have you tried to connect to the ANT-B10-OOC with the use over a usb-serial converter? 

    Regards

    Runar

  • &uart2 {
        compatible = "nordic,nrf-uarte";
        current-speed = <115200>;
        status = "okay";
        pinctrl-0 = <&uart2_pins>;
        pinctrl-names = "default";
    };
    
    &pinctrl {
        uart2_pins: uart2_pins {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 5)>,
                        <NRF_PSEL(UART_RX, 0, 6)>;
            };
        };
    };

    Here is the overlay. And I have changed it to pins 5 and 6 instead of 10 and 11. I have not tried to connect to the ANT-B10-00C using a usb-serial converter; I have been using a dual-row, 1.27 mm pitch, 20-pin, female adapter and male-female jumper wires. And this is what my terminal is currently outputting:

    uart:~$ *** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    UART2 communication test started...
    Sent: Hello ANT-B10!
    
    uart:~$ Received from ANReceived from ANT-B10: Huart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10: euart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10: luart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10: luart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10: ouart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10:  uart:~$ Sent: Hello ANT-B10!
    Received from ANSent: Hello ANT-B10!
    Received from ANT-B10: Auart:~$ Sent: Hello ANT-B10!
    No response yet...
    Sent: Hello ANT-B10!
    No response yet...
    uart:~$ Sent: Hello ANT-B10!
    No response yet...
    Sent: Hello ANT-B10!
    No response yet...
    uart:~$ Sent: Hello ANT-B10!
    No response yet...
    Sent: Hello ANT-B10!
    No response yet...

    Do i need to set up RTS and CTS as well or just the RX and TX pins?

  • The overlay looks fine, 

    If you need RTS and CTS should be defined the documentation form Ublox.

    If flow control is not used, the UART_CTS pin is internally pulled down. However, it is good practice to connect UART_CTS to GND. Configure the UART connection not to use flow control using the command AT+UMRS=,0. Other necessary pins: • GND ground connection (pin 15 or 17) • +3V3 power supply (pin 2) • SWITCH_2 forces the board into the software update (boot loader) mode when driven low during board reset. • SWITCH_1 resets the board to its default settings when driven and then held low for at least 5 seconds – or until the +STARTUP event is received over the UART.

    From the AT command manual it looks like the module expect messages as defined here

    Regards

    Runar

Reply
  • The overlay looks fine, 

    If you need RTS and CTS should be defined the documentation form Ublox.

    If flow control is not used, the UART_CTS pin is internally pulled down. However, it is good practice to connect UART_CTS to GND. Configure the UART connection not to use flow control using the command AT+UMRS=,0. Other necessary pins: • GND ground connection (pin 15 or 17) • +3V3 power supply (pin 2) • SWITCH_2 forces the board into the software update (boot loader) mode when driven low during board reset. • SWITCH_1 resets the board to its default settings when driven and then held low for at least 5 seconds – or until the +STARTUP event is received over the UART.

    From the AT command manual it looks like the module expect messages as defined here

    Regards

    Runar

Children
No Data
Related