Configuring a serial device (ttyS1) for UART? LS1021A-TWR Rev.2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring a serial device (ttyS1) for UART? LS1021A-TWR Rev.2

Jump to solution
11,064 Views
datho
Contributor III


I'm currently using an LS1021A-TWR rev 2.0 board, QorIQ SDK 1.9, and CodeWarrior for arm v7 10.0.7. I've enabled UART functionality on the RCW and programmed it into the board. However I'm having trouble getting anything transmitted across the UART pins (specifically UART2_TXD and RXD).

When I run "setserial -g /dev/ttyS*" there's 4 devices listed: ttyS[0-3]. For S0 and S1 the UART is undefined, port is 0, and IRQ is 118.

When I run "dmesg | grep tty", I get :

"ttyS0 at MMIO 0x21c0500 (irq = 118, base_baud = 9375000) is a  16550A_FSL64,"

"ttyS1 at MMIO 0x21c0600 (irq = 118, base_baud = 9375000) is a  16550A_FSL64,"

and "ttyLP0 at MMIO 0x2950000 (irq = 112, base_baud =6250000) is a FSL_LPUART."

A custom board based on the LS1021A-TWR, is currently being developed with an external device attached to UART2_TXD and UART2_RXD. I'm trying to get the UART2 TxD and RxD up and running so that I can read and write via UART on these pins. I tried to run setserial /dev/ttyS1 uart 16550 to get the uart to define itself, but that has no effect. Is there a way for me to use the UART pins via UART drivers (not as GPIO)? Do I need to configure the U-boot to get a serial device to connect to the UART pins?

Tags (2)
0 Kudos
1 Solution
6,835 Views
datho
Contributor III

I was able to get TxD signals to come out of UART1_RTS. I didn't realize that configuring location 0x21d0600 DUART would configure UART 1 RTS and CTS pins.

I did change the kernel config for Device drivers ->character devices -> serial drivers -> max number of 8250/16550 serial ports, number of 8250/16550 serial ports to register at runtime, and support more than 4 legacy serial ports. I'm pretty sure this had no impact though.

I still have no idea how to configure the QUICC engine block, but I've got the functionality I need out of the UART1_RTS and _CTS pins.

View solution in original post

0 Kudos
5 Replies
6,835 Views
Pavel
NXP Employee
NXP Employee

Check UART ports on your board using the following commands:

setserial -g /dev/ttyS*

stty 9600 -F /dev/ttyS1

stty -F /dev/ttyS1

echo "HELLO" > /dev/ttyS1

Test serial ports on your board using the following page:

http://www.armadeus.com/wiki/index.php?title=Serial_ports_usage_on_Linux


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

6,835 Views
datho
Contributor III

So as it turns out, the UART 2 TxD and RxD pins listed in the schematic for the ls1021a are not the same as the UART 2 listed in the reference manual for the ls1021a. The schematic for the board lists the UARTs as 0-3 and the reference manual lists the UARTS as 1-4. On top of that the UART 2 and 3 TxD and RxD pins (on the schematic) are not connected to DUART but to the QUICC Engine block.


I've tested out a lot of different serial device interfaces but none of them have the effect that I was looking for. I tried configure the DUART pins to get my desired result. For some reason, DUART 3 and 4 TxD and RxD (according to the RM) pins are not coming out of the DUART 1 and 2 RTS and CTS as the RM described. I could get DUART 2 to send out signals as expected, but DUART 3 and 4 never send anything out. All register were configured with the same values for the separate UARTS. I also configured the RCW UART_EXT to be 0b000, the UART_BASE to be 0b111. Configuring the DUART 1 TxD and RxD pins prevent my console from working (because the serial device for the user terminal is connected to those pins). I saw that in the RM, it says to configure the WIMG settings in the MMU, but I don't know where the WIMG setting can be changed.

I'm also lost on how to program the QUICC Engine block to run on UART mode. The address of the peripheral is given to me, but not there are no register locations or instructions on how to configure the QUICC engine to use UART 2 RxD and TxD (according to the schematic) pins.


I'm not sure if we can use the RTS and CTS pins instead of the UART 2 TxD and RxD pins yet, but I could really use some instructions on how to use DUART 3 and 4 and the QUICC Engine on the LS1021A-TWR rev 2 board.

0 Kudos
6,835 Views
datho
Contributor III

I read what QorIQ SDK said about the QUICC engine block. From what I understand, I need to enable the TDMs in kernel in order to use the UART on the QUICC. Is it possible just to use QUICC just for UART communication? or is there some fixed functionality that comes along with using the QUICC?

I keep running ann error with the menuconfig the for the kernel. I can't include the freescale quicc engine support, ucc tdm driver for freescale qe engine, slic maxim card support, or the ucc tdm test module without the make compile crashing on me. Here's what it prints out:

dho01@ubuntu:~/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr$ bitbake -c compile -f virtual/kernel

Loading cache: 100% |##################################################################################################################| ETA:  00:00:00

Loaded 3253 entries from dependency cache.

NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION        = "1.26.0"

BUILD_SYS         = "x86_64-linux"

NATIVELSBSTRING   = "Ubuntu-14.04"

TARGET_SYS        = "arm-fsl-linux-gnueabi"

MACHINE           = "ls1021atwr"

DISTRO            = "fsl-qoriq"

DISTRO_VERSION    = "1.9"

TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa7"

TARGET_FPU        = "vfp-neon"

meta             

meta-yocto       

meta-yocto-bsp    = "(detachedfromb74ea96):ddf114933ccfc6e3ce51a10e8e8f95e514b73578"

meta-oe          

meta-multimedia  

meta-gnome       

meta-networking  

meta-perl        

meta-python      

meta-ruby        

meta-filesystems 

meta-webserver   

toolchain-layer   = "(nobranch):214e1801d0efc38d3b6142bdc0d8e58ca593e34c"

meta-freescale    = "(detachedfrom7fb32a2):7fb32a20983a0ebd5503eb42e851550b0deb8679"

meta-freescale-internal = "(detachedfrom220bff8):220bff8b2030e5af7393b5870d74c6f0af0d76d1"

meta-freescale-extra = "(nobranch):ced26c806cb566b1400a2f4f26a94d8d44d13233"

meta-qt5          = "(nobranch):90919b9d86988e7da01fa2c0a07246b5b5600a5d"

meta-fsl-demos    = "(nobranch):17f9da65efb5c65c1d44b5cc18584034b29a742b"

meta-browser      = "(nobranch):6ae140b29f0201fe3bb470da8c96c9e142294ebf"

meta-virtualization = "(nobranch):0277cbcb47db4239d0a4aa3b37c5c6a705070951"

meta-java         = "(nobranch):d5a2a31aaad8f6bdf19860f7a858b10d7dba08b6"

meta-linaro-toolchain = "(nobranch):3f1933242062d1cf473d20b86fa4582963ff9441"

meta-openstack   

meta-openstack-aio-deploy

meta-openstack-compute-deploy

meta-openstack-compute-test-config

meta-openstack-controller-deploy

meta-openstack-controller-test-config

meta-openstack-qemu

meta-openstack-swift-deploy

meta-cloud-services = "(nobranch):0842ae59ce7f752aabb2459510739ec4fff8b33d"

meta-security     = "(nobranch):aac972c0b88ce67a7bc9fcd83ee8793b61d4fff7"

NOTE: Preparing RunQueue

NOTE: Tainting hash to force rebuild of task /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale/recipes-kernel/linux/linux-qoriq_3.12.bb, do_compile

WARNING: /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale/recipes-kernel/linux/linux-qoriq_3.12.bb.do_compile is tainted from a forced run

NOTE: Executing SetScene Tasks

NOTE: Executing RunQueue Tasks

ERROR: Function failed: do_compile (log file is located at /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-qoriq/3.12-r0/temp/log.do_compile.99560)

ERROR: Logfile of failure stored in: /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-qoriq/3.12-r0/temp/log.do_compile.99560

Log data follows:

| DEBUG: Executing shell function do_compile

| NOTE: make -j 4 uImage CC=arm-fsl-linux-gnueabi-gcc    --sysroot=/home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/sysroots/ls1021atwr LD=arm-fsl-linux-gnueabi-ld.bfd    --sysroot=/home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/sysroots/ls1021atwr LOADADDR=0x80008000

|   GEN     /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-qoriq/3.12-r0/build/Makefile

|   HOSTCC  scripts/basic/fixdep

|   HOSTCC  scripts/kconfig/conf.o

|   HOSTCC  scripts/kconfig/zconf.tab.o

|   HOSTLD  scripts/kconfig/conf

| scripts/kconfig/conf --silentoldconfig Kconfig

|   CHK     include/config/kernel.release

|   GEN     /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-qoriq/3.12-r0/build/Makefile

|   CHK     include/generated/uapi/linux/version.h

|   Using /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source as source for kernel

|   CHK     include/generated/utsrelease.h

| make[3]: `include/generated/mach-types.h' is up to date.

|   CALL    /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/scripts/checksyscalls.sh

|   CHK     include/generated/compile.h

|   CC      drivers/net/ethernet/freescale/fsl_pq_mdio.o

|   CC      drivers/soc/qe/qe.o

|   CC      drivers/tdm/tdm-core.o

|   LD      drivers/net/ethernet/freescale/built-in.o

|   LD      drivers/net/ethernet/built-in.o

|   LD      drivers/net/built-in.o

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/tdm-core.c: In function 'tdm_add_adapter':

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/tdm-core.c:204:2: warning: 'idr_pre_get' is deprecated (declared at /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/include/linux/idr.h:155) [-Wdeprecated-declarations]

|   if (idr_pre_get(&tdm_adapter_idr, GFP_KERNEL) == 0)

|   ^

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/tdm-core.c:208:2: warning: 'idr_get_new' is deprecated (declared at /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/include/linux/idr.h:185) [-Wdeprecated-declarations]

|   res = idr_get_new(&tdm_adapter_idr, adapter, &id);

|   ^

|   CC      drivers/soc/qe/qe_io.o

|   CC      drivers/tdm/device/fsl_ucc_tdm.o

|   CC      drivers/soc/qe/qe_common.o

|   CC      drivers/tdm/line_ctrl/slic_maxim.o

|   CC      drivers/soc/qe/ucc.o

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/line_ctrl/slic_maxim.c: In function 'slic_change_cs':

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/line_ctrl/slic_maxim.c:255:2: error: implicit declaration of function 'of_iomap' [-Werror=implicit-function-declaration]

|   cpld_base = of_iomap(cpld_node, 0);

|   ^

| /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work-shared/ls1021atwr/kernel-source/drivers/tdm/line_ctrl/slic_maxim.c:255:12: warning: assignment makes pointer from integer without a cast

|   cpld_base = of_iomap(cpld_node, 0);

|             ^

|   CC      drivers/soc/qe/ucc_fast.o

| cc1: some warnings being treated as errors

| make[5]: *** [drivers/tdm/line_ctrl/slic_maxim.o] Error 1

| make[4]: *** [drivers/tdm/line_ctrl] Error 2

| make[4]: *** Waiting for unfinished jobs....

|   LD      drivers/tdm/device/built-in.o

| make[3]: *** [drivers/tdm] Error 2

| make[3]: *** Waiting for unfinished jobs....

|   LD      drivers/soc/qe/built-in.o

|   LD      drivers/soc/built-in.o

| make[2]: *** [drivers] Error 2

| make[1]: *** [sub-make] Error 2

| make: *** [all] Error 2

| ERROR: oe_runmake failed

| WARNING: exit code 1 from a shell command.

| ERROR: Function failed: do_compile (log file is located at /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/build_ls1021atwr/tmp/work/ls1021atwr-fsl-linux-gnueabi/linux-qoriq/3.12-r0/temp/log.do_compile.99560)

ERROR: Task 4 (/home/dho01/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale/recipes-kernel/linux/linux-qoriq_3.12.bb, do_compile) failed with exit code '1'

NOTE: Tasks Summary: Attempted 264 tasks of which 263 didn't need to be rerun and 1 failed.

Summary: 1 task failed:

  /home/dho01/QorIQ-SDK-V1.9-20151210-yocto/sources/meta-freescale/recipes-kernel/linux/linux-qoriq_3.12.bb, do_compile

Summary: There was 1 WARNING message shown.

Summary: There was 1 ERROR message shown, returning a non-zero exit code.

0 Kudos
6,836 Views
datho
Contributor III

I was able to get TxD signals to come out of UART1_RTS. I didn't realize that configuring location 0x21d0600 DUART would configure UART 1 RTS and CTS pins.

I did change the kernel config for Device drivers ->character devices -> serial drivers -> max number of 8250/16550 serial ports, number of 8250/16550 serial ports to register at runtime, and support more than 4 legacy serial ports. I'm pretty sure this had no impact though.

I still have no idea how to configure the QUICC engine block, but I've got the functionality I need out of the UART1_RTS and _CTS pins.

0 Kudos
6,835 Views
datho
Contributor III

Has anyone configured UART pins on the TWR-LS1021A? I've only seen examples in IMX.

0 Kudos