J21 is wired for serial console (it would take effort to change to something else because even U-Boot is by default using this for serial console). There are of course many functions to different pins on J21 which are unrelated to the serial UART. This is “/dev/ttyS0”.
J17 also connects to the camera module, though I don’t think it is used by default…it tends to work fine without much effort. You could remove the camera module if you want to guarantee it isn’t touching J17 (it just uses two phillips screws…make sure power is off and you’ve drained any caps, e.g., by holding the power button down for several seconds after the power connector is removed). This is “/dev/ttyTHS2”.
The “ttyS#” are standard serial UART drivers, the “ttyTHS#” entries actually have a DMA-capable driver behind the scenes. Both work mostly the same way although there will be some IOCTL calls which differ if you are programming at a low level.
As an example you could wire J17’s RX and TX pins together, and then use a serial terminal running at 115200 8N1 with software (no) flow control and the terminal would echo to itself.