Forum Discussion

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

Implementing UART communication

Dear all.

I need to implement UART communication for high baudrate (by interrupts).

My communication must be implemented as described below:

RECEIVING: rcv_buffer up to 255 bytes.

TRANSMITTING: AFTER receiving and checking all rcv_buffer , i send transmit buffer ( up to 255 bytes).

* delay between 2 incoming buffers is 100ms.

** RECEIVING must interrupt my running application ,after transmitting i must return to my interrupted state.

It is important to choose fastest communication.

Thanks at advance.

Alex.

4 Replies

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

    Hi Alex,

    > RECEIVING: rcv_buffer up to 255 bytes.

    > TRANSMITTING: AFTER receiving and checking all rcv_buffer , i send transmit

    > buffer ( up to 255 bytes).

    >

    > * delay between 2 incoming buffers is 100ms.

    This can be achieved with baud rates as low as 38400.

    > ** RECEIVING must interrupt my running application ,after transmitting i must return

    > to my interrupted state.

    This is typical ;-)

    > It is important to choose fastest communication.

    It's not clear to me what you mean by this ... but you should have little difficulty

    handling the scenario you describe ... even with a very modest cpu clock.

    What is your question?

    Regards,

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

    Hi Scott.

    First of all thanks for the tips.

    I will be happy to get some Nios II IDE code example for same scenario.

    I want to understand how to use UART interrupts and to apply it in my application.

    Regards .

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

    --- Quote Start ---

    originally posted by burdalex@Nov 25 2005, 01:11 PM

    hi scott.

    first of all thanks for the tips.

    i will be happy to get some nios ii ide code example for same scenario.

    i want to understand how to use uart interrupts and to apply it in my application.

    regards .

    alex

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11162)

    --- quote end ---

    --- Quote End ---

    Altera provide a driver for the UART, you don&#39;t need to worry about handling the interrupts from the UART. I suggest you either look at the hello world example or read the Nios II Software Developers Handbook.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by rugbybloke+nov 26 2005, 02:24 am--><div class='quotetop'>quote (rugbybloke @ nov 26 2005, 02:24 am)</div>

    --- quote start ---

    <!--quotebegin-burdalex@Nov 25 2005, 01:11 PM

    hi scott.

    first of all thanks for the tips.

    i will be happy to get some nios ii ide code example for same scenario.

    i want to understand how to use uart interrupts and to apply it in my application.

    regards .

    alex

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11162)

    --- quote end ---

    --- Quote End ---

    Altera provide a driver for the UART, you don&#39;t need to worry about handling the interrupts from the UART. I suggest you either look at the hello world example or read the Nios II Software Developers Handbook.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11164)</div>

    [/b]

    --- Quote End ---

    I have the same question of how to receive and transmit data using UART interrupt .I have read the Nios II Software Developers Handbook and driver for the UART, but I don&#39;t know how to use the API function of HAL,

    for example:

    1,how to declare the "fd" parameter of alt_avalon_uart_read (alt_fd* fd, char* ptr, int len)?

    2,Can I use the alt_avalon_uart_read (alt_fd* fd, char* ptr, int len) directly or use it throuth some other system function sush as read()?

    can you give me some example about it ?

    my Email is: lvguihua23@126.com