Communicating with UART through J21 pins

Hi,

I’m quite new to the Jetson series. Normally for embedded type devices there is a specified address I write to for pins. I’ve done a fair bit of research on my own but I honestly have no idea how to figure out what files people are talking about when they say things like “compare the values in the header files to what’s in the pinmux”. Can someone either help me understand everything I need to look at to map out J21 pins in order to communicate with them? Or is there a tutorial that exists?

Just FYI, some pins can take on different functions depending on device tree settings. It is a case of having more functions available than pins…but only needing some functions, so you name which function goes to which pin. The device tree does this, and changing is known as the pinmux. There is a spreadsheet macro which can create the device tree files for any custom setup (to some extent the procedure depends on which L4T version you are using…see “head -n 1 /etc/nv_tegra_release”).

The default use of J21 serial port is as serial console. You probably don’t want to use those pins since serial console is important and disabling this first takes significant effort (not only does the Linux kernel configure for this, so does U-Boot).

J17 next to J21 routes to the camera port. If you do not use the serial communications to the camera, then this is probably what you want. It’s a standard 3.3V TTL level UART. It’s default settings is 115200 8N1. On the Linux side you point your communications to file “/dev/ttyTHS2”.

NOTE: Regular UART devices are named something like “ttyS0”, but the ttyTHS notation is used when the NVIDIA driver provides DMA transfer. Mostly “ttyTHS2” use would be exactly the same as if you had used “ttyS2” without DMA. It won’t change how you talk to the port.

That’s good to know. Is there a way to modify the device tree without re-flashing the image on the TX1?

In R28.1 you need to use flash.sh to update the device tree. Previous releases could use just a file in “/boot”. You can flash the device tree without flashing the root partition itself. There is information on the procedure specific to each release, e.g., if R28.1, see:
https://developer.nvidia.com/embedded/linux-tegra

Where can I find what I need to do in order to edit the device tree correctly? I decompiled it and see “/serial@7000XXXX” for the several serial devices. But how do I know which one is to J21 and other header areas? And how do I know the values things need to be set to in order to be configured correctly?

The format is “serial@”, so although this does not necessarily tell you which pin, it does tell you which controller. You can cross-reference in the Parker Series Technical Reference Mnaual. You may need to log in, but you can go here, click on the TX1 product, and type “technical reference” into the search to see the document (there is also a pin and function guide doc you might be interested in…pins can be cross-referenced to the schematic of the carrier board):
https://developer.nvidia.com/embedded/downloads

See Table 1, Section 2.1, “Address Map” (starts on page 18). So for example, UART1 is listed as starting address “7000:6000”, thus this is “serial@70006000”. Each controller shares/mirrors “offset” from base address for function, so the same exact register information works for all of the UARTs so long as the base address is the one you are interested in (you’ll find the chapter on serial UARTs only mentions offsets…it doesn’t talk about base address).

Just beware you may find different naming between references to the module versus references to the carrier board…the TRM naming refers to the module, and the schematic (see the “hardware” filter of the download URL above) may need to be consulted to verify naming between the two.

Prior to R28.1 you could just save the dtb file and create a separate extlinux.conf boot entry to test changes via serial console selecting the alternate entry at boot via serial console. As of R28.1 you cannot do this as only part of the changes to the R28.1 extlinux.conf entries would be used…many values related to files named in extlinux.conf are ignored as of R28.1. You probably should clone the rootfs first before testing if you have anything valuable, and then see the docs on how to install a device tree (this is with the Documentation download of the R28.1 L4T downloads page). It basically uses the flash.sh app of the driver package to name the partition to be flashed after adding the argument “-r” to re-use the rootfs…in this case it would mean the rootfs does not get changed and only that other partition is flashed…but the clone is valuable if something goes wrong and you need to just flash again.

R28.1 downloads are here:
https://developer.nvidia.com/embedded/linux-tegra