921600 baud and above

Anonymous
2012-12-04
2013-04-01
  • Anonymous - 2012-12-04

    I've seen in the code that the maximum baudrate is 230400. It also says that 460800 is not supported.

    I would like to use speeds above 921600, but I don't know if they are unsupported because no one asked for it, or there is a limitation somewhere in the code…  Any hints?

     
  • Corey Minyard

    Corey Minyard - 2012-12-04

    There is no limitation that I know of, but I have had no requests and no real reason to add it.  I'd be happy to take patches for it, though.

     
  • Anonymous - 2012-12-13

    Ok. I've added the hi-speed (more or less standard) baudrates that follows:
    B230400  
    B460800  
    B500000  
    B576000  
    B921600  
    B1000000  
    B1152000  
    B1500000  
    B2000000  
    B2500000  
    B3000000  
    B3500000  
    B4000000  

    I've personally tested 921600 bps and 3 Mbps and they worked as expected on Ubuntu linux. The rest should work also but had not been tested.

    The patch follows:

    diff --git a/devcfg.c b/devcfg.c
    index 1f211a6..2b2588f 100644
    --- a/devcfg.c
    +++ b/devcfg.c
    @@ -126,6 +126,45 @@ devconfig(char *instr, dev_info_t *dinfo)
        } else if (strcmp(pos, "115200") == 0) {
            cfsetospeed(termctl, B115200);
            cfsetispeed(termctl, B115200);
    +   } else if (strcmp(pos, "230400") == 0) {
    +       cfsetospeed(termctl, B230400);
    +       cfsetispeed(termctl, B230400);
    +   } else if (strcmp(pos, "460800") == 0) {
    +       cfsetospeed(termctl, B460800);
    +       cfsetispeed(termctl, B460800);
    +   } else if (strcmp(pos, "500000") == 0) {
    +       cfsetospeed(termctl, B500000);
    +       cfsetispeed(termctl, B500000);
    +   } else if (strcmp(pos, "576000") == 0) {
    +       cfsetospeed(termctl, B576000);
    +       cfsetispeed(termctl, B576000);
    +   } else if (strcmp(pos, "921600") == 0) {
    +       cfsetospeed(termctl, B921600);
    +       cfsetispeed(termctl, B921600);
    +   } else if (strcmp(pos, "1000000") == 0) {
    +       cfsetospeed(termctl, B1000000);
    +       cfsetispeed(termctl, B1000000);
    +   } else if (strcmp(pos, "1152000") == 0) {
    +       cfsetospeed(termctl, B1152000);
    +       cfsetispeed(termctl, B1152000);
    +   } else if (strcmp(pos, "1500000") == 0) {
    +       cfsetospeed(termctl, B1500000);
    +       cfsetispeed(termctl, B1500000);
    +   } else if (strcmp(pos, "2000000") == 0) {
    +       cfsetospeed(termctl, B2000000);
    +       cfsetispeed(termctl, B2000000);
    +   } else if (strcmp(pos, "2500000") == 0) {
    +       cfsetospeed(termctl, B2500000);
    +       cfsetispeed(termctl, B2500000);
    +   } else if (strcmp(pos, "3000000") == 0) {
    +       cfsetospeed(termctl, B3000000);
    +       cfsetispeed(termctl, B3000000);
    +   } else if (strcmp(pos, "3500000") == 0) {
    +       cfsetospeed(termctl, B3500000);
    +       cfsetispeed(termctl, B3500000);
    +   } else if (strcmp(pos, "4000000") == 0) {
    +       cfsetospeed(termctl, B4000000);
    +       cfsetispeed(termctl, B4000000);     
        } else if (strcmp(pos, "1STOPBIT") == 0) {
            termctl->c_cflag &= ~(CSTOPB);
        } else if (strcmp(pos, "2STOPBITS") == 0) {
    

    I hope it will make into the next release, and finally on Openwrt, which is where I need them ;-)

     
  • Corey Minyard

    Corey Minyard - 2012-12-13

    Ok, I've added this.  I also added the corresponding changes to the baud_string() function, for going the other direction and printing it out.  I also added ifdefs for older systems and OSes that didn't have those definitions.  Can you pull the git repository and try it out?

    Also, could I get your name and/or email for the changelog?  You can mail me directly at minyard@acm.org.

     
  • Anonymous - 2012-12-19

    Ok, I did not thought about the baud_string() function or the safety ifdefs. Much better now. Thank you.

    I tested the code from the repository and all continue to work as expected, at least at 3 Mbps and using Ubuntu ;-)

    Contact details sent by email (bonus suggestion included).

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks