Different transmit/receive baudrates on same USART?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is really out in the weeds, but I'm wondering if anyone has ever implemented or even seen different baud rates for receive/transmit on a single usart.

 

As to why anyone would do this, "The Micronet terminal works at 1,200 baud receive and 75 band transmit ". And this is supported on 'dumb' terminals. No, it's not common but it's been done before. Like I said, really out in the weeds.

 

My initial thought would be to configure two USARTs, one with the correct transmit speed, another with the correct receive speed, then use the tx pin from one, and rx pin from another in a really hackey way. Although it might actually be easier to bitbang serial considering the baud rate is so low.

 

Is there any easy way to do this?

 

 

void configure_usart(void)
{
    struct usart_config config_usart;
    usart_get_config_defaults(&config_usart);

    config_usart.baudrate    = 9600;
    config_usart.mux_setting = USART_RX_1_TX_0_XCK_1;
    config_usart.pinmux_pad0 = PINMUX_PA08D_SERCOM2_PAD0;
    config_usart.pinmux_pad1 = PINMUX_PA09D_SERCOM2_PAD1;
    config_usart.pinmux_pad2 = PINMUX_UNUSED;
    config_usart.pinmux_pad3 = PINMUX_UNUSED;
    
    while (usart_init(&usart_instance, SERCOM2, &config_usart) != STATUS_OK) {
    }
    stdio_serial_init(&usart_instance, SERCOM2, &config_usart);
    usart_enable(&usart_instance);
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You did not mention the CPU you are using, but I have never seen a UART in the Atmel family (at least the ones I have used) that have separate Tx and Rx baud rates.  Your idea to use 2 UARTs seems the best to me.

John Malaugh

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

malaugh wrote:

You did not mention the CPU you are using, but I have never seen a UART in the Atmel family (at least the ones I have used) that have separate Tx and Rx baud rates.  Your idea to use 2 UARTs seems the best to me.

 

SAMD21. Sorry about that.

 

Do you happen to know those Atmel parts with separate Tx and Rx baud rates?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


The datasheet suggests not:

 

http://ww1.microchip.com/downloa...

 

there is only one baud rate generator (BRG) - which suggests only one baud rate.

 

The same baud rate drives both receive & transmit.

 

 

 

 

malaugh wrote:
I have never seen a UART in the Atmel family (at least the ones I have used) that have separate Tx and Rx baud rates

coolhandlewis wrote:
Do you happen to know those Atmel parts with separate Tx and Rx baud rates?

He said he's never seen one.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

coolhandlewis wrote:
it's been done before

indeed - on ancient teletypes.

 

The theory being that people type a lot slower than the computer - so only need a much lower baud rate

 

Similar principle is still seen today with ADSL, where the 'A' is for Asymmetric - meaning that upload & download rates are different.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

malaugh wrote:
Your idea to use 2 UARTs seems the best to me

If you're short of hardware UARTs ("SERCOMs" in D21 speak), you could make one of them bit-banged - Tx is usually the easiest for this.

 

Another option: If the comms is half-duplex, you ould change the baud rate between Rx & Tx ... ?

 

Credit: https://electronics.stackexchang...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The SCC2681 UART and related follow-ons had separate tx and rx clock selections.  Ye old ay1013 (?) had separate clock input pins, I think.

I don’t know if I’ve ever seen the capability on a recent microcontroller.

 

Last Edited: Tue. Nov 17, 2020 - 11:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am sure that I might have done hardware 1200 / 75 either on 6502 or M68000 but can't remember.

 

It is incredibly simple to bit-bang TX.   So I would use hardware for 1200 RX and bit-bang the 75 baud TX.

Let's face it.   UART is fairly tolerant for timing.   Your UART RX ISR() will only take about 100 cycles.   Which is 7us @ 16MHz.  75 baud is 13333us per bit.   UARTs should accept +-2% i.e. +- 266us.

 

Yes,  if you intend to support different baud rates at runtime it means everything uses HW RX/TX except for 1200/75.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
I don’t know if I’ve ever seen the capability on a recent microcontroller.

likewise.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...