LAN966x USART
SoC Resources
LAN966X SoC have 5 FLEXCOMs(Flexible Serial Communication Controller). In order to use flexcom USART interface, a specific flexcom should be configured in USART mode.
Kernel configurations
Following kernel config options should be enabled to use LAN966x flexcom USART interface:
-
CONFIG_MFD_AT91_USART
- USART driver config option.
Devicetree Configuration
To use Flexcom USART interface, following configurations are required in device tree.
-
Each of the flexcom flx0, flx1, flx2, flx3 and flx4 nodes can be configured in USART mode
ATMEL_FLEXCOM_MODE_USART
to use USART interface. -
compatible
string must be set to atmel,at91sam9260-usart. -
reg
property must be set with register address and length as<0x200 0x200>
. -
GPIO pins for TXD and RXD pins should be configured to
pinctrl-0
property. Also addcts
andrts
pins, if present. List of possible TXD and RXD pin mappings are as in below table:
FLEXCOM Node | DT RXD node | RXD pin | DT TXD node | TXD pin |
---|---|---|---|---|
flx0 |
fc0_a_rxd_pins |
GPIO9 |
fc0_a_txd_pins |
GPIO10 |
flx0 |
fc0_b_rxd_pins |
GPIO25 |
fc0_b_txd_pins |
GPIO26 |
flx0 |
fc0_c_rxd_pins |
GPIO62 |
fc0_c_txd_pins |
GPIO63 |
flx1 |
fc1_a_rxd_pins |
GPIO12 |
fc1_a_txd_pins |
GPIO13 |
flx1 |
fc1_b_rxd_pins |
GPIO34 |
fc1_b_txd_pins |
GPIO35 |
flx1 |
fc1_c_rxd_pins |
GPIO47 |
fc1_c_txd_pins |
GPIO48 |
flx2 |
fc2_a_rxd_pins |
GPIO15 |
fc2_a_txd_pins |
GPIO16 |
flx2 |
fc2_b_rxd_pins |
GPIO44 |
fc2_b_txd_pins |
GPIO45 |
flx3 |
fc3_a_rxd_pins |
GPIO18 |
fc3_a_txd_pins |
GPIO19 |
flx3 |
fc3_b_rxd_pins |
GPIO52 |
fc3_b_txd_pins |
GPIO53 |
flx3 |
fc3_c_rxd_pins |
GPIO31 |
fc3_c_txd_pins |
GPIO32 |
flx4 |
fc4_a_rxd_pins |
GPIO21 |
fc4_a_txd_pins |
GPIO22 |
flx4 |
fc4_b_rxd_pins |
GPIO57 |
fc4_b_txd_pins |
GPIO58 |
flx4 |
fc4_c_rxd_pins |
GPIO65 |
fc4_c_txd_pins |
GPIO66 |
-
interrupts
property must set with interrupt details. Interrupt number[CPU INTR] corresponding to a flexcom must be configured as defined in below table:
FLEXCOM ID | Shared Peripheral Interrupt | CPU INTR |
---|---|---|
flx0 |
80 |
48 |
flx1 |
81 |
49 |
flx2 |
82 |
50 |
flx3 |
83 |
51 |
flx4 |
84 |
52 |
Note that Shared peripheral interrupt lines start at index ID32. So, CPU INTR must be calculated as [Shared peripheral interrupt number - 32].
-
Input clock
clocks
property must be set to&nic_clk
. Note that NIC clock(200Mhz) is clock used by AXI, AHB fabric and APB bridges which connects all th peripherals.clock-names
must be set tousart
. -
GPIO flexcom shared pins should be configured as per board design.
Example
Following example shows how a flexcom USART should be defined in PCB8291 DT. On PCB8291, Flexcom3 USART is used as console.
chosen { stdout-path = "serial1:115200n8"; }; aliases { serial0 = &usart0; serial1 = &usart3; }; &flx0 { atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>; status = "okay"; usart0: serial@200 { compatible = "atmel,at91sam9260-usart"; reg = <0x200 0x200>; interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>; clocks = <&nic_clk>; clock-names = "usart"; pinctrl-0 = <&fc0_b_rxd_pins>, <&fc0_b_txd_pins>; pinctrl-names = "default"; atmel,fifo-size = <32>; status = "okay"; }; }; &flx3 { atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>; status = "okay"; usart3: serial@200 { compatible = "atmel,at91sam9260-usart"; reg = <0x200 0x200>; interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>; clocks = <&nic_clk>; clock-names = "usart"; pinctrl-0 = <&fc3_b_rxd_pins>, <&fc3_b_txd_pins>; pinctrl-names = "default"; atmel,fifo-size = <32>; status = "okay"; }; };
UserSpace
Confirm instances are created
-
Check if a tty device is created in
/dev/
directory. This can be also be verified by executingdmesg | tail
(on host PC) once the board is powered-up. -
Connect to console using
minicom -s /dev/ttyACM0
Example on how to use
Following demonstrates above DT flexcom examples on PCB8291 board: . Flexcom3, which is being used as console. . Flexcom0, which is standalone uart device.
FLEXCOM USART as console
In order to use flexcom3 USART as console,
add console=ttyS1,115200
to uboot bootargs
environment variable and
pass it to the kernel, then this usart will become the console.
First identify and connect to /dev/ttyACMx (Here x is port number) on Host machine. For Linux users, minicom application can be used to connect to console.
# dmesg | tail [1043817.472935] usb 3-9: USB disconnect, device number 33 [1043817.762295] debugfs: Directory '09' with parent 'devices' already present! [1043817.890248] usb 3-9: new high-speed USB device number 35 using xhci_hcd [1043818.038704] usb 3-9: New USB device found, idVendor=03eb, idProduct=6124, bcdDevice= 1.10 [1043818.038707] usb 3-9: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [1043818.039989] cdc_acm 3-9:1.0: ttyACM0: USB ACM device [1043818.230372] igb 0000:01:00.0 eth10: igb: eth10 NIC Link is Down [1043822.614597] igb 0000:01:00.0 eth10: igb: eth10 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX # # minicom -s /dev/ttyACM0 [?<debug_uart> Trying to boot from SPI U-Boot 2019.04-linux4sam_6.2-icp-00228-g2bdd7b58fc-dirty (Apr 28 2021 - 08:28:52 +0200) CPU: SAMA7 Crystal frequency: 0 MHz CPU clock : 0 MHz Master clock : 0 MHz DRAM: 1 GiB lan966x_pinctrl_probe done 0 MMC: sdhci-host@e0830000: 0, emmc@e0830000: 1 Loading Environment from SPI Flash... SF: Detected sst26vf016b with page size 256 Bytes, erase size 4 KiB, total 2 MiB OK In: serial Out: serial Err: serial Net: Warning: switch@0 (eth0) using random MAC address - a2:17:30:13:8a:46 eth0: switch@0 m => dhcp 0x64000000 fit_icpu.itb BOOTP broadcast 1 BOOTP broadcast 2 BOOTP broadcast 3 DHCP client bound to address 10.99.10.174 (940 ms) Using switch@0 device TFTP from server 10.99.10.1; our IP address is 10.99.10.174 Filename 'fit_icpu.itb'. Load address: 0x64000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ############# 8.9 MiB/s done Bytes transferred = 17356055 (108d517 hex) m => printenv baudrate=115200 bootargs=console=ttyS1,115200 root=/dev/ram0 loglevel=7 uio_pdrv_genirq.of_id=generic-uio bootdelay=3 bootfile=fit_icpu_build_623.itb dnsip=10.99.10.1 ethact=switch@0 fdt_high=0xffffffff fdtcontroladdr=9fb7e068 fileaddr=64000000 filesize=108d517 gatewayip=10.99.10.1 initrd_high=0xffffffff ipaddr=10.99.10.174 netmask=255.255.255.0 serverip=10.99.10.1 Environment size: 369/65532 bytes m => bootm 0x64000000#lan9662_ung8291_0_at_lan966x ## Loading kernel from FIT Image at 64000000 ... Using 'lan9662_ung8291_0_at_lan966x' configuration Trying 'kernel' kernel subimage Description: Kernel Type: Kernel Image Compression: gzip compressed Data Start: 0x640000c8 Data Size: 4114018 Bytes = 3.9 MiB Architecture: ARM OS: Linux Load Address: 0x60208000 Entry Point: 0x60208000 Verifying Hash Integrity ... OK ## Loading ramdisk from FIT Image at 64000000 ... Using 'lan9662_ung8291_0_at_lan966x' configuration Trying 'ramdisk' ramdisk subimage Description: Ramdisk Type: RAMDisk Image Compression: uncompressed Data Start: 0x64404c74 Data Size: 13139968 Bytes = 12.5 MiB Architecture: ARM OS: Linux Load Address: 0x68000000 Entry Point: unavailable Verifying Hash Integrity ... OK Loading ramdisk from 0x64404c74 to 0x68000000 ## Loading fdt from FIT Image at 64000000 ... Using 'lan9662_ung8291_0_at_lan966x' configuration Trying 'fdt_lan9662_ung8291_0_at_lan966x' fdt subimage Description: Flattened Device Tree Type: Flat Device Tree Compression: uncompressed Data Start: 0x643ec7f4 Data Size: 18808 Bytes = 18.4 KiB Architecture: ARM Load Address: 0x67e00000 Verifying Hash Integrity ... OK Loading fdt from 0x643ec7f4 to 0x67e00000 Booting using the fdt blob at 0x67e00000 Uncompressing Kernel Image ... OK Using Device Tree in place at 67e00000, end 67e07977 Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 5.15.25-18810-g70353fd4af6b-dirty (root@kavya-HP-Compaq-6000-Pro-SFF-PC) (arm-linux-gnueabi-gcc (Ubuntu/L2 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: Microchip EVB - LAN9662 [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] cma: Reserved 128 MiB at 0x98000000 [ 0.000000] Zone ranges: [ 0.000000] Normal [mem 0x0000000060000000-0x000000008fffffff] [ 0.000000] HighMem [mem 0x0000000090000000-0x000000009fffffff] [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000060000000-0x000000009fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000060000000-0x000000009fffffff] [ 0.000000] percpu: Embedded 11 pages/cpu s14668 r8192 d22196 u45056 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 260608 [ 0.000000] Kernel command line: console=ttyS1,115200 root=/dev/ram0 loglevel=7 uio_pdrv_genirq.of_id=generic-uio [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear) [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 888780K/1048576K available (8192K kernel code, 608K rwdata, 2928K rodata, 1024K init, 185K bss, 28724K reserved) [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU event tracing is enabled. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 [ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 [ 0.000000] random: get_random_bytes called from start_kernel+0x40c/0x628 with crng_init=0 [ 0.000000] arch_timer: cp15 timer(s) running at 37.50MHz (virt). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x8a60dd6a9, max_idle_ns: 440795204056 ns [ 0.000002] sched_clock: 56 bits at 37MHz, resolution 26ns, wraps every 2199023255540ns [ 0.000030] Switching to timer-based delay loop, resolution 26ns [ 0.001238] Console: colour dummy device 80x30 [ 0.001319] Calibrating delay loop (skipped), value calculated using timer frequency.. 75.00 BogoMIPS (lpj=375000) [ 0.001351] pid_max: default: 32768 minimum: 301 [ 0.001578] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear) [ 0.001613] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear) [ 0.002610] CPU: Testing write buffer coherency: ok [ 0.002979] CPU0: update cpu_capacity 1024 [ 0.003007] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.003788] Setting up static identity map for 0x60100000 - 0x60100078 [ 0.003978] rcu: Hierarchical SRCU implementation. [ 0.005018] smp: Bringing up secondary CPUs ... [ 0.005048] smp: Brought up 1 node, 1 CPU [ 0.005068] SMP: Total of 1 processors activated (75.00 BogoMIPS). [ 0.005085] CPU: All CPU(s) started in SVC mode. [ 0.005721] devtmpfs: initialized [ 0.011129] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5 [ 0.011480] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.011523] futex hash table entries: 256 (order: 2, 16384 bytes, linear) [ 0.018739] pinctrl core: initialized pinctrl subsystem [ 0.020545] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.038201] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 0.039214] audit: initializing netlink subsys (disabled) [ 0.056097] No ATAGs? [ 0.068134] audit: type=2000 audit(0.030:1): state=initialized audit_enabled=0 res=1 [ 0.071785] at_xdmac e0068000.dma-controller: 16 channels, mapped at 0x(ptrval) [ 0.073849] iommu: Default domain type: Translated [ 0.073876] iommu: DMA domain TLB invalidation policy: strict mode [ 0.074680] SCSI subsystem initialized [ 0.074984] usbcore: registered new interface driver usbfs [ 0.075068] usbcore: registered new interface driver hub [ 0.075146] usbcore: registered new device driver usb [ 0.075686] pps_core: LinuxPPS API ver. 1 registered [ 0.075706] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.075745] PTP clock support registered [ 0.077565] clocksource: Switched to clocksource arch_sys_counter [ 0.089125] NET: Registered PF_INET protocol family [ 0.089426] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.091357] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear) [ 0.091434] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear) [ 0.091574] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.091773] TCP: Hash tables configured (established 8192 bind 8192) [ 0.091925] UDP hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.092011] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.092282] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.093295] RPC: Registered named UNIX socket transport module. [ 0.093332] RPC: Registered udp transport module. [ 0.093346] RPC: Registered tcp transport module. [ 0.093357] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.093736] NetWinder Floating Point Emulator V0.97 (double precision) [ 0.094901] workingset: timestamp_bits=30 max_order=18 bucket_order=0 [ 0.095596] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.096286] Trying to unpack rootfs image as initramfs... [ 0.109411] bounce: pool size: 64 pages [ 0.109541] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250) [ 0.109563] io scheduler mq-deadline registered [ 0.109579] io scheduler kyber registered [ 0.116059] pinctrl-ocelot e2004064.pinctrl: driver registered [ 0.131516] brd: module loaded [ 0.149642] loop: module loaded [ 0.151731] atmel_usart_serial atmel_usart_serial.0.auto: Using FIFO (32 data) [ 0.152052] atmel_usart_serial.0.auto: ttyS0 at MMIO 0xe0040200 (irq = 43, base_baud = 12500000) is a ATMEL_SERIAL [ 0.160318] atmel_usart_serial atmel_usart_serial.1.auto: Using FIFO (32 data) [ 0.160646] atmel_usart_serial.1.auto: ttyS1 at MMIO 0xe0064200 (irq = 44, base_baud = 12500000) is a ATMEL_SERIAL [ 0.988484] Freeing initrd memory: 5504K [ 1.196259] printk: console [ttyS1] enabled [ 1.202400] SPI driver spidev has no spi_device_id for mchp,synce_builtin [ 1.209227] SPI driver spidev has no spi_device_id for mchp,synce_dpll [ 1.215711] SPI driver spidev has no spi_device_id for mchp,cpld [ 1.221749] SPI driver spidev has no spi_device_id for mchp,cpld_fifo [ 1.228197] SPI driver spidev has no spi_device_id for mchp,t1e1j1 [ 1.234372] SPI driver spidev has no spi_device_id for spidev [ 1.245566] spi-nor spi0.0: sst26vf016b (2048 Kbytes) [ 1.270532] CAN device driver interface [ 1.275507] lan966x-switch e2000000.switch: Use register extraction [ 1.281833] MAC addr was not set, use random MAC [ 1.298073] pps pps0: new PPS source ptp0 [ 1.302487] pps pps1: new PPS source ptp1 [ 1.306830] pps pps2: new PPS source ptp2 [ 1.321451] uio_sparx5_irqmux e0000000.mscc_switch: IO is enabled [ 1.327624] uio_sparx5_irqmux e0000000.mscc_switch: Mapped 0 irqs [ 1.335771] uio_sparx5_irqmux e0000000.mscc_switch: Mapping [mem 0xe0000000-0xe3ffffff] [ 1.344024] uio_sparx5_irqmux 100000.mscc_sram: IO is enabled [ 1.349790] uio_sparx5_irqmux 100000.mscc_sram: Mapped 0 irqs [ 1.355788] uio_sparx5_irqmux 100000.mscc_sram: Mapping [mem 0x00100000-0x0011ffff] [ 1.365823] dwc3 300000.usb_dwc3: Configuration mismatch. dr_mode forced to host [ 1.374036] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 1.380611] ehci-atmel: EHCI Atmel driver [ 1.384741] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 1.390928] ohci-platform: OHCI generic platform driver [ 1.396271] ohci-atmel: OHCI Atmel driver [ 1.400953] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller [ 1.406430] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 1 [ 1.414869] xhci-hcd xhci-hcd.2.auto: hcc params 0x0220fe6c hci version 0x110 quirks 0x0000000000010010 [ 1.424392] xhci-hcd xhci-hcd.2.auto: irq 45, io mem 0x00300000 [ 1.430830] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15 [ 1.439110] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1.446313] usb usb1: Product: xHCI Host Controller [ 1.451216] usb usb1: Manufacturer: Linux 5.15.25-18810-g70353fd4af6b-dirty xhci-hcd [ 1.458973] usb usb1: SerialNumber: xhci-hcd.2.auto [ 1.464744] hub 1-0:1.0: USB hub found [ 1.468595] hub 1-0:1.0: 1 port detected [ 1.473078] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller [ 1.478607] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 2 [ 1.486250] xhci-hcd xhci-hcd.2.auto: Host supports USB 3.0 SuperSpeed [ 1.492940] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. [ 1.501392] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.15 [ 1.509668] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1.516876] usb usb2: Product: xHCI Host Controller [ 1.521776] usb usb2: Manufacturer: Linux 5.15.25-18810-g70353fd4af6b-dirty xhci-hcd [ 1.529545] usb usb2: SerialNumber: xhci-hcd.2.auto [ 1.535227] hub 2-0:1.0: USB hub found [ 1.539058] hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19) [ 1.546594] usbcore: registered new interface driver usbtmc [ 1.552306] usbcore: registered new interface driver usb-storage [ 1.558447] usbcore: registered new interface driver usbserial_generic [ 1.564974] usbserial: USB Serial support registered for generic [ 1.571042] usbcore: registered new interface driver ftdi_sio [ 1.576779] usbserial: USB Serial support registered for FTDI USB Serial Device [ 1.584252] usbcore: registered new interface driver usb_serial_simple [ 1.590802] usbserial: USB Serial support registered for carelink [ 1.596882] usbserial: USB Serial support registered for zio [ 1.602596] usbserial: USB Serial support registered for funsoft [ 1.608608] usbserial: USB Serial support registered for flashloader [ 1.614951] usbserial: USB Serial support registered for google [ 1.620901] usbserial: USB Serial support registered for libtransistor [ 1.627421] usbserial: USB Serial support registered for vivopay [ 1.633458] usbserial: USB Serial support registered for moto_modem [ 1.639750] usbserial: USB Serial support registered for motorola_tetra [ 1.646351] usbserial: USB Serial support registered for novatel_gps [ 1.652739] usbserial: USB Serial support registered for hp4x [ 1.658492] usbserial: USB Serial support registered for suunto [ 1.664411] usbserial: USB Serial support registered for siemens_mpi [ 1.670937] usbcore: registered new interface driver usbtest [ 1.676707] i2c_dev: i2c /dev entries driver [ 1.682931] sdhci: Secure Digital Host Controller Interface driver [ 1.689159] sdhci: Copyright(c) Pierre Ossman [ 1.693462] sdhci-pltfm: SDHCI platform and OF driver helper [ 1.700925] atmel_aes e004c000.aes: version: 0x702 [ 1.743909] mmc0: SDHCI controller on e0830000.sdio-host [e0830000.sdio-host] using ADMA [ 1.755492] atmel_aes e004c000.aes: Atmel AES - Using dma0chan0, dma0chan1 for DMA transfers [ 1.764722] atmel_sha e006c000.sha: version: 0x700 [ 1.770160] atmel_sha e006c000.sha: using dma0chan2 for DMA transfers [ 1.812938] atmel_sha e006c000.sha: Atmel SHA1/SHA256/SHA224/SHA384/SHA512 [ 1.820576] hid: raw HID events driver (C) Jiri Kosina [ 1.825872] usbcore: registered new interface driver usbhid [ 1.831462] usbhid: USB HID core driver [ 1.836710] GACT probability NOT on [ 1.840241] Mirror/redirect action on [ 1.844374] NET: Registered PF_INET6 protocol family [ 1.851579] Segment Routing with IPv6 [ 1.855245] In-situ OAM (IOAM) with IPv6 [ 1.859386] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 1.866229] NET: Registered PF_PACKET protocol family [ 1.871416] Bridge firewalling registered [ 1.875396] can: controller area network core [ 1.879842] NET: Registered PF_CAN protocol family [ 1.884589] can: raw protocol [ 1.887586] can: broadcast manager protocol [ 1.891749] can: netlink gateway - max_hops=1 [ 1.896163] 8021q: 802.1Q VLAN Support v1.8 [ 1.900630] ThumbEE CPU extension supported. [ 1.904863] Registering SWP/SWPB emulation handler [ 1.913635] of_cfs_init [ 1.916173] of_cfs_init: OK [ 1.921314] Freeing unused kernel image (initmem) memory: 1024K [ 1.937894] Run /init as init process [ 1.939755] mmc0: new high speed MMC card at address 0001 [ 1.948336] mmcblk0: mmc0:0001 IS004G 3.64 GiB [ 1.958150] mmcblk0: [ 1.958863] mmcblk0boot0: mmc0:0001 IS004G 2.00 MiB [ 1.970417] mmcblk0boot1: mmc0:0001 IS004G 2.00 MiB [ 1.979285] mmcblk0rpmb: mmc0:0001 IS004G 512 KiB, chardev (247:0) Starting syslogd: OK Starting klogd: OK Running sysctl: OK Saving random seed: [ 2.165688] random: dd: uninitialized urandom read (512 bytes read) OK Starting rngd: OK Starting network: OK Welcome to Buildroot buildroot login: root
FLEXCOM USART as standalone uart device
This example is demonstrated by using TTL-232R-3V3 cable which is connected from Linux host to flexcom0 USART. Any other UART converter cables can be used. Make sure that pin connections of TTL-232R-3V3 to DUT flexcom0 USART are as below:
Once connections are done, verify that ttyUSBx interface is identified on Host machine as below:
root@swlab-HP-Z420-Workstation:/home/knariset# dmesg | tail [611319.667065] usb 3-1: new full-speed USB device number 4 using xhci_hcd [611319.861370] usb 3-1: New USB device found, idVendor=0403, idProduct=6001 [611319.861373] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [611319.861376] usb 3-1: Product: TTL232R-3V3 [611319.861379] usb 3-1: Manufacturer: FTDI [611319.861381] usb 3-1: SerialNumber: FTBR6A83 [611319.872422] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected [611319.872470] usb 3-1: Detected FT232RL [611319.877470] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB1 [611420.396414] usb 2-1.1: USB disconnect, device number 27
On DUT side, flexcom0 USART will be identified as ttyS0 interface:
# dmesg | grep usart [ 0.151931] atmel_usart_serial atmel_usart_serial.0.auto: Using FIFO (32 data) [ 0.151989] atmel_usart_serial atmel_[ 8.717907] random: fast init done usart_serial.0.auto: GPIO lookup for consumer rs485-term [ 0.152007] atmel_usart_serial atmel_usart_serial.0.auto: using device tree for GPIO lookup [ 0.152152] atmel_usart_serial atmel_usart_serial.0.auto: using lookup tables for GPIO lookup [ 0.152169] atmel_usart_serial atmel_usart_serial.0.auto: No GPIO consumer rs485-term found [ 0.152257] atmel_usart_serial.0.auto: ttyS0 at MMIO 0xe0040200 (irq = 43, base_baud = 12500000) is a ATMEL_SERIAL [ 0.160529] atmel_usart_serial atmel_usart_serial.1.auto: Using FIFO (32 data) [ 0.160591] atmel_usart_serial atmel_usart_serial.1.auto: GPIO lookup for consumer rs485-term [ 0.160608] atmel_usart_serial atmel_usart_serial.1.auto: using device tree for GPIO lookup [ 0.160755] atmel_usart_serial atmel_usart_serial.1.auto: using lookup tables for GPIO lookup [ 0.160771] atmel_usart_serial atmel_usart_serial.1.auto: No GPIO consumer rs485-term found [ 0.160858] atmel_usart_serial.1.auto: ttyS1 at MMIO 0xe0064200 (irq = 44, base_baud = 12500000) is a ATMEL_SERIAL # # # dmesg | grep ttyS [ 0.000000] Kernel command line: console=ttyS1,115200 root=/dev/ram0 loglevel=7 uio_pdrv_genirq.of_id=generic-uio [ 0.152257] atmel_usart_serial.0.auto: ttyS0 at MMIO 0xe0040200 (irq = 43, base_baud = 12500000) is a ATMEL_SERIAL [ 0.160858] atmel_usart_serial.1.auto: ttyS1 at MMIO 0xe0064200 (irq = 44, base_baud = 12500000) is a ATMEL_SERIAL [ 1.196296] printk: console [ttyS1] enabled # # ls -l /dev/ttyS* crw------- 1 root root 4, 64 Jan 1 00:00 /dev/ttyS0 crw------- 1 root root 4, 65 Jan 1 00:00 /dev/ttyS1
Before running serial tests, make sure baudrate is set to 115200 on
both sides using command stty -F /dev/ttyX 115200
Run stty -F /dev/ttyUSB1 115200
command on Host machine and
stty -F /dev/ttyS0 115200
command on DUT.
Write text to flexcom0 USART and read from Host machine interface
Use echo
command to write some text to /dev/ttyS0 interface on DUT:
# # echo "writing to ttyS0 USART0 on DUT" > /dev/ttyS0
Run cat
command to read from /dev/ttyUSB1 on Host:
root@swlab-HP-Z420-Workstation:/home/knariset# cat /dev/ttyUSB1 writing to ttyS0 USART0 on DUT
Write text to Host interface and read from flexcom0 USART
Use echo
command to write some text to /dev/ttyUSB1 interface on Host:
root@swlab-HP-Z420-Workstation:/home/knariset# echo "writing to USB1 on Host machine" > /dev/ttyUSB1 root@swlab-HP-Z420-Workstation:/home/knariset#
Run cat
command to read from /dev/ttyS0 on DUT:
# cat /dev/ttyS0 writing to USB1 on Host machine