Odroid N2 UART Custom Baud Rate for MIDI

Post Reply
stepy
Posts: 5
Joined: Tue Sep 10, 2019 11:12 pm
languages_spoken: english
ODROIDs: Odroid C2, N2, VU7
Has thanked: 3 times
Been thanked: 0
Contact:

Odroid N2 UART Custom Baud Rate for MIDI

Unread post by stepy » Mon Oct 07, 2019 11:29 pm

Is it possible for an Odroid N2, UART port, to operate, at a non-standard baud rate?

My test setup is as follows:

Operating system is Armbian Buster.

Followed the instructions on the Odroid N2 Wiki, in order to enable and use the UART_EE_A feature.

https://wiki.odroid.com/odroid-n2/appli ... /gpio/uart

Connected an oscilloscope to the Odroid N2,

Header J2, Pin 8, which gives the TXD output.

Using

command line

sudo stty -F /dev/ttyS1 115200

echo "somestringdata" > ttyS1

or

my own custom software

Am able to set standard baud rates and send data, which arrives correctly, on the oscilloscope.
For example, 9600, 115200.

However, the baud rate, that I require, for Midi, is a non-standard

31250

When I try to set this baud rate, it causes an error, or falls back, to a standard baud rate. The closest standard baud rate is 38400, but this will not work for Midi.

In the past, the solution that I have successfully used, on a Raspberry Pi 3 with Raspbian is as follows.

There are various hacks/fixes that can be applied. These are related to the Pi's configuration. It is hardware and operating system dependent and also quite fiddly to setup. But it does work.

In short, if I am not mistaken, I believe that the UART clock and various divisors are 'tricked' or set in such a way, so that the desired Midi 31250 baud rate, is attained. In other words, after the fix has been applied, select a standard 38400 and you get 31250.

Tried searching the web, for solution like this, or any other solution, for the Odroid N2, but could not find much.

Is the Odroid N2 hardware able to work with 31250 baud rate?

If yes, then what are the configuration parameters and where can they be found, in order to achieve this?

Any help would be very much appreciated, thanks.

User avatar
odroid
Site Admin
Posts: 32318
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 138 times
Been thanked: 315 times
Contact:

Re: Odroid N2 UART Custom Baud Rate for MIDI

Unread post by odroid » Tue Oct 08, 2019 9:41 am

According to the UART device driver source code, there seems no falls back function to a standard baud rate. So there would be no hardware limitation.
https://github.com/hardkernel/linux/blo ... #L537-L587

I think a similar method in this link might be a solution even I have zero experience though.
https://stackoverflow.com/questions/194 ... e-on-linux
These users thanked the author odroid for the post (total 2):
ManuelFantoni (Wed Oct 09, 2019 7:08 pm) • stepy (Fri Oct 11, 2019 4:11 am)

stepy
Posts: 5
Joined: Tue Sep 10, 2019 11:12 pm
languages_spoken: english
ODROIDs: Odroid C2, N2, VU7
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Odroid N2 UART Custom Baud Rate for MIDI

Unread post by stepy » Fri Oct 11, 2019 4:09 am

Thanks very much for your reply. It was very helpful. Learnt a lot about device drivers. Am familiar with C but am still struggling to get it to work.

Tried the suggestion of setting speed to 38400 and custom devisor to 48. (baud_base/31250 = 48) Did this using linux setserial program, with the appropriate parameters. setserial seems to set and show the parameters correctly, but still do not see 31250 midi baud rate on the oscilloscope. Also setserial is shown as being depreciated.

Tried the suggestion of setting speed to 38400 and tty->alt_speed to 31250, but could not figure out how to do it.

If I am not mistaken, it seems that both of these mechanisms, may be depreciated or not supported in the meson uart device driver. Please correct me if I am not understanding correctly.

Therefore, would be great-full for any help.

How do you get 31250 baud rate out of the Odroid N2 UART Port?

Thanks for any help or suggestions

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests