Forum Discussion

sfillingim's avatar
sfillingim
Icon for New Contributor rankNew Contributor
28 days ago

Sending serial commands on DB9 Arria 10 SoC FPGA

I am attempting to send serial based commands using the RS-232 protocol on the DB9 connector on the Arria 10 but do not know which device to use within my C program.

I've opened "/dev/tty0" and can send appropriate commands "AT+CGMM\r" but these commands are sent out the J10 UART1 (HPS) on the board and not the DB9.

I'm unable to read "/dev/ttyS1" within my c program.

I've tried various other devices without luck.

I've also set status to "okay" on serial0@ffc02000.

In file: ./arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts and rebuild the dtb and placed on SD card. 

I've looked in Non-8250 serial port support in .config but haven't modified the kernel. Previously, I did enable the FTDI in the kernel for another device and got that working correctly. 

Any suggestions will be greatly appreciated. Thank you.

stty -F /dev/ttyS1
stty: /dev/ttyS1: Input/output error

3 Replies

  • zwchan's avatar
    zwchan
    Icon for New Contributor rankNew Contributor

    Hi,

    From what you described, you are trying to send commands "AT+CGMM\r" via UART0 DB9 RS-232 on an Arria 10 SoC Dev Kit using Linux on HPS. Is that correct?

    By default, Arria 10 uses UART0 as the Linux console. You will need to make some changes to ensure UART0 is free out from the console.

    • Base setup change required:
      • UART0 -> AT commands
      • UART1 -> Linux console (login + kernel messages) or tty0 -> Linux console
        Note: tty0 does not mean UART0/1
    • Important Notes: you will lose access for console on DB9 and only accessible via UART1/tty0
    • Example Steps (move console to UART1 and enable UART0 for AT commands):
      • Verify both UART0 and UART1 present
        ls -l /dev/ttyS*
      • Expected to see  "/dev/ttyS0" and "/dev/ttyS1" if both are present.
      • Check the current console usage:
        cat /proc/cmdline
      • if you see "console=ttyS0,115200", you must change it to UART1
      • Editing DTS "socfpga_arria10_socdk_sdmmc.dts" to make sure both UART0 and UART1 are enable
        &uart0 {
            status = "okay";
        };
        &uart1 {
            status = "okay";
        };
      • In Early boot stage(ROM/SPL), you will still have console access via UART0/DB9
      • In U-Boot stage:
        • move console to UART1
          setenv bootargs console=ttyS1,115200 root=...
          saveenv
      • Rebuild with DTS changes .dtb "make dtbs"
      • Deploy the new .dtb and reboot.
      • After reboot, UART change will be applied as following.
        • UART0(/dev/ttyS0) -> AT commands
        • UART1(/dev/ttyS1) -> Linux console (login + kernel messages)
      • Important Notes to take away:
        • tty0 can host the console, but AT commands must always use /dev/ttySx for the actual UART
  • KianHinT_altera's avatar
    KianHinT_altera
    Icon for Frequent Contributor rankFrequent Contributor

    Hi sfillingim,

    FYI from the Arria 10 user guide 

    From what I understand, you're trying to use DB9 as HPS  UART with your C program?

    From schematic , DB9 is connected to UART1 which is default routed to FPGA fabric via the MAX V MUX.

    For HPS UART0/UARTA J10 , it is connected to MAX V pin N5 and P6

    https://www.intel.com/content/www/us/en/content-details/649726/intel-arria-10-soc-fpga-development-kit-board-schematic.html

    To use DB9 with HPS UART, in the device tree ensure that you have the UART1 definition and status set to okay  @0xFF02100 (https://www.intel.com/content/www/us/en/programmable/hps/arria-10/hps.html#topic/sfo1429890261413.html)

    In platform designer, you need to set the HPS UART1 pin mux to FPGA, and then instantiate the HPS uart1 ports (from schematic, seems only TX/RX is connected thus dont think it has any flow control or those pins cts,dts,cd,dsr,dtr etc.). In pin planner you also need to configure the fpga uart1_tx,uart1_rx to their respective pins.

    Hope that helps.

    Thanks

    Regards

    Kian

      

  • KianHinT_altera's avatar
    KianHinT_altera
    Icon for Frequent Contributor rankFrequent Contributor

    HI sfillingim,

    As we do not hear back from you for sometime, we will transition this thread into community support onwards.

    Thanks

    Regards

    Kian