RS232 custom speed (baud rate)

  • Dear support-team,


    I need to set a custom baudrate to the serial port. I try this with the following code:


    When I run the program the first time it's killed in the

    Code
    1. ioctl(fd, TIOCSSERIAL, &new_serdrvinfo); // write new driver settings

    command with the message "... sets custom speed on ttySAC1. This is deprecated".


    The BaudBase and the Divisor will be printed with value 0. When I run the program a second time this seems to work. Baudbase and Divisor will be printed as 300000 and 6. The program will not be killed.


    Why does'nt this work when running the first time? Is this the right way to set a custom baud rate?


    On PicoMod7 with kernel 2.6.39 it was not possible to set a custom speed this way. I had to run a module where I could access a special register in "PHKMEM":



    But that was not very comfortable.


    Thanks for any hints.