>
> *Is there someway of putting in a custom baud divisor in c code ideally? *


Yes. Peter Hurdley just posted a link to some code to do exactly that on
the forums here. The subject title was Portuguese( I think ), so should
stand out if you search Peter's name, and sort by date.

On Fri, Jul 24, 2015 at 11:15 AM, <[email protected]> wrote:

> Hi I'm trying to set a MIDI connection through serial port 4
>
> echo something > /dev/ttyO4
> works if I select one of the baud rates defined in termios.h (say 38400)
> but doesn't work for 31250 (the MIDI baud rate).
>
> I have flashed to 4.1 (uname -r == 4.1.2-ti-r4) and can get a 500k Baud
> serial port from another UART. With the idea that setting a divisor would
> work out to the desired BAUD if I could set a divisor of 16. I have another
> UART that needs to run at 1 MBaud.
>
> Is there someway of putting in a custom baud divisor in c code ideally?
>
> This is where I am at:
>
> void initializeBBB() {
> FILE *uartFileManager;
> //UART config using termios
> struct termios midiTermios, picTermios, tempTermios;
>
> midiDevice = open( "/dev/ttyO4", O_RDWR | O_NOCTTY );
> if ( midiDevice < 0 ) {
> printf("Error: MIDI connection failed to open");
> }
>
> tcgetattr( midiDevice, &tempTermios );
> bzero( &midiTermios, sizeof( midiTermios ) );
> midiTermios.c_cflag = B500000 | CS8 | CLOCAL | CREAD;
> midiTermios.c_iflag = IGNPAR | ICRNL;
> midiTermios.c_oflag = 0;
> midiTermios.c_lflag = 0;
>
> midiTermios.c_cc[VTIME] = 0;
> midiTermios.c_cc[VMIN] = 1;
>
> tcflush( midiDevice, TCIFLUSH );
> tcsetattr( midiDevice, TCSANOW, &midiTermios );
> }
>
> which will initialize ttyO4 to 500000 Baud. Placing in:
> cfsetispeed(&midiTermios, 31250);
> cfsetospeed(&midiTermios, 31250);
> cfmakeraw(&midiTermios);
>
> before tcsetattr did not accomplish setting.
>
> midiTermios.c_ispeed = 31250;
> midiTermios.c_ospeed = 31250;
>
> also didn't work. Are there ioctl commands available on the BBB? Any help
> that doesn't make me use a MIDI --> USB cable and connect that way would be
> appreciated. I would really like to not have to recompile the kernel.
>
> Thanks,
>
> j
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to