This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Serial Ir (SIR) on AM3517

Other Parts Discussed in Thread: AM3517

I have the AM3517 EVM board and need to convert the serial port to IrDA (raw serial) mode. UART3 is the only one which supports IrDA, so I will have to first move the console to one of the other UARTs.  I am having a hard time finding how to configure and use UART3 in IrDA mode via the embedded Linux.  Can anyone point me in the right direction?

What I have found so far only references the IrDA stack (vs Serial Ir comm) or commands like these which do not seem to exist in Linux on the EVM: setserial, irattach, modprobe serial.  I have build the kernel to include IrDA and serial IrDA, so maybe I have things setup correctly, but simply do not know how to use it.

Thank you for any advice.

  • [Self-answered]

    I am connecting the serial IR transceiver TFBS4711 to the AM3517 EVM using UART3.  This is not IrDA, but SIR-Free Format mode.

    I was successful by making the following changes:

    1) remove R254 from the bottom of the EVM. The EVM is designed to use UART3 for console or USB debug port for WiLan.  Since the ARM allows IR only on UART3, first the console must be moved off of UART3. Removal of R254 allows me to use UART3 for the external IR transceiver. See http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/p/142992/516956.aspx#516956

    2) add the following code to serial.c in the function omap_serial_init_port().  This sets the IR-mode bit in the ARM's UART module

     

     

    #if defined(CONFIG_IR_UART3) // i.e. SIR FF mode (Free Format)

    {

    struct plat_serial8250_port *p = dev->platform_data;

       struct plat_serial8250_port *uartp = uart->p;

     

    if (p->mapbase == OMAP_UART3_BASE)

    {

    u16 data;

    printk("Configuring UART3 for SIR-FF mode");

    data = serial_read_reg(uartp, UART_OMAP_MDR2);

    data |= (1<<3); // bit 3 is UART pulse shape

    serial_write_reg(uartp, UART_OMAP_MDR2, data);

    }

    }

    #endif

    3) add the .config entry for CONFIG_IR_UART3 and select it for configuring the kernel
    config IR_UART3
       default n
    bool "Enable IrDA on UART3"
    depends on MACH_OMAP3517NUPULSE
    default n
    help
     Say YES here to use UART3 for IrDA (or IrCOMM) purposes. Note: on the AM3517 EVM, hardware
     modifications (disabling the RS232 driver, U24) may be required to have UART3 work correctly.
    4) use J16 on the EVM to access the UART3 Rx/Tx signals
    5) plug in a USB cable from J41 to a Host (e.g. PC). This switches off the RS-232 voltage level chip.
    6) in user space code, send/receive data via ttyS2 using open/read/write calls

     

  • Hi Daren Yeo,

    I am working on AM3517 controller, with 2.6.37 kernel.

    I am trying to configure uart3 as IrDA port. by your post i am able to get some idea how to configure and change code in serial.c

    But how can i change uart3 common serial port to IrDA port. as one should not configure uart3 in serial port and IrDA mode and also about platform data

    Any document for how to change serial ports.

    Thanks in Advance,

    Rajeev Battu.

  • My kernel is 2.6.33-RT31, but here is where I made the change. I created the CONFIG_IR_UART3 in the .config file, but you can hard code it if you need to.  Hope this helps

    void __init omap_serial_init_port(int port)
    {
    struct omap_uart_state *uart;
    struct platform_device *pdev;
    struct device *dev;

    BUG_ON(port < 0);
    BUG_ON(port >= ARRAY_SIZE(omap_uart));

    uart = &omap_uart[port];
    pdev = &uart->pdev;
    dev = &pdev->dev;

    omap_uart_enable_clocks(uart);

    omap_uart_reset(uart);
    omap_uart_idle_init(uart);

    list_add_tail(&uart->node, &uart_list);

    if (WARN_ON(platform_device_register(pdev)))
    return;

    if ((cpu_is_omap34xx() && uart->padconf) ||
    (uart->wk_en && uart->wk_mask)) {
    device_init_wakeup(dev, true);
    DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
    }

    #if defined(CONFIG_IR_UART3) // i.e. SIR FF mode (Free Format)
    {
    struct plat_serial8250_port *p = dev->platform_data;
    struct plat_serial8250_port *uartp = uart->p;

    if (p->mapbase == OMAP_UART3_BASE)
    {
    u16 data;
    printk("Configuring UART3 for SIR-FF mode");
    data = serial_read_reg(uartp, UART_OMAP_MDR2);
    data |= (1<<3); // bit 3 is UART pulse shape
    serial_write_reg(uartp, UART_OMAP_MDR2, data);
    }
    }
    #endif

    /* omap44xx: Never read empty UART fifo
    * omap3xxx: Never read empty UART fifo on UARTs
    * with IP rev >=0x52
    */
    if (cpu_is_omap44xx())
    uart->p->serial_in = serial_in_override;
    else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
    >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
    uart->p->serial_in = serial_in_override;
    }

  • Hi Daren Yeo,

    Thank you for your reply. it really help me to understand about IrDA but i am unable to figure it out how to disable

    RS232 driver for com3.

    debug message on com0 

    [    0.489837] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
    [    0.492065] omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a ANALOGICS OMAP UART0
    [    1.158966] console [ttyO0] enabled
    [    1.163146] omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a ANALOGICS OMAP UART1
    [    1.171936] omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a ANALOGICS OMAP UART2
    [    1.180908] at24 1-0050: 256 byte 24c02 EEPROM (writable)

    i had done what you have asked to, i had hard-codded CONFIG_IR_UART3

    When i am digging the kernel 2.6.37 i came across a function called omap_irda_config() from irda.h

    i am working around this one also.

    Thanks in advance,

    Rajeev Battu

  • Rajeev Battu

    Be careful to understand the difference between raw IR (SIR in FF mode) and IRDA.  I needed raw IR for my device.  IRDA includes higher protocol-level support (i.e. ir stack) for communications with IRDA devices (PDAs, etc.). I do not know the answer to your exact question regarding disabling of the Com3 driver.  My 2.6.33 kernel version may be an important difference.

  • Daren Yeo,

    Yes you are correct, there are lot of changes when compared between two kernel versions.

    Modifications for UART structure, omap_hwmod has come up and it quit hard to know where is the platform data for uart,

    i am trying to understand your code and implement accordingly in 2.6.37 kernel. what exactly are you doing is trying to configure

    uart3 in IR SIR mode. Normally UARt3 is configured as serial port and then changed to IR port. correct me if i am wrong.

    Thanks,

    Raheev Battu