Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

60 Uart's ?

I want to realize 60 Uart's on NIOS2 cpu

I can add 60 in SOPC builder only 32 IRQ can be assingd

What happen whit these other UART that have no IRQ?

Can someone tell that? And how can i fix this problem?

I am using uClinux.

10 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    You can connect 32 of these irq signals to a PIO. Let the PIO generate an interrupt. And in the interrupt routine, read the pio to look what UART triggered it.

    If you do 2 of them, you can process 64 interrupts with 2 pins.

    You can do a bit better by making a user peripheral with 60 inputs for the IRQ's and one output to interrupt the processor. Reading from the custom hardware can give you directly the number of the uart that you want to process first (if you do some priority encoding).

    Stefaan.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    uClinux only supports up to 4 altera_avalon_uarts... you'll need to mod the driver in order to support up to 60...

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I don't know anything about the uClinux driver -- but in general there is no requirement to have a UART that has an IRQ; its up to how your software is archictected. If your s/w driver polls the UART rather than relying on interrupts, you can just not connect the IRQ in SOPC Builder (specify "NC" instead of an integer in the IRQ field)..

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I remember that someone designed in a Nios I a few years ago because they wanted to use an outragous number of UARTs and no other controller/processor offered it... I can't remember what the application was, but hey, that's the beauty of programmable logic.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    So i make a interrupt controller as a peripheral and connect all the IRQ from de UART's to this controller and then the controller have one IRQ to de CPU.

    De peripheral generate a intterupt and tell witch UART gives a intterupt.

    Is it easy to mod de uClinux 4 altera_avalon_uarts driver ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    60 - RS232 UARTs? haha that's a lot of noise! lol

    (sorry couldn't resist)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    Is it easy to mod de uClinux 4 altera_avalon_uarts driver ?[/b]

    --- Quote End ---

    very easy to mod the Linux driver to support more. All you need is to instantiate more Nios_serial structure. In the file

    drivers/serial/NIOSserial.c:

    static struct NIOS_serial nios_soft = {
    //    { 0,0,1,0,0,0,0, (nasys_printf_uart), (nasys_printf_uart_irq) }, /* ttyS0 */
        { 0,0,1,0,0,0,0, (int) (na_uart0), (na_uart0_irq) },  /* ttyS0 */# ifdef na_uart1
    //    { 0,0,0,0,0,0,0, (nasys_gdb_uart), (nasys_gdb_uart_irq) },    /* ttyS1 */
        { 0,0,0,0,0,0,0, (int) (na_uart1), (na_uart1_irq) },  /* ttyS1 */# endif# ifdef na_uart2
        { 0,0,0,0,0,0,0, (int) (na_uart2), (na_uart2_irq) },  /* ttyS2 */# endif# ifdef na_uart3
        { 0,0,0,0,0,0,0, (int) (na_uart3), (na_uart3_irq) },  /* ttyS3 */# endif
    };

    You can add more, or change to dynamically allocate and initialize this array. Maybe you also need minor change to the interrupt service routine since you have shared interrupts.

    Wentao

    Microtronix