I'm totally new to the world of Raspberry and Linux, but I totally love it
Aftter the first simple tests with flashing LEDs and Co. I want to build my first project.
At this point I decided to build a MIDI Controller with TouchScreen on my own. Only MIDI out....it's just testing first
But for now I stuck on receiving the data on my PC or with a MIDI Instrumet.
I use RPi3 with an actual Raspbian OS and I mapped my UART back on /dev/ttyAMA0. So in different forum posts and tutorials I found out, that It's not possible to set the MIDI Baud of 31250 per default.
I have to use the UART Clock.....so I did the following in /boot/config.txt:
Code: Select all
init_uart_clock=39062500
init_uart_baud=38400
dtparam=uart0_clkrate=48000000
Code: Select all
vcgencmd measure_clock uartCode: Select all
frequency(22)=39063000http://m0xpd.blogspot.de/2013/01/midi-c ... n-rpi.html
And from there I copied a little bit code, my testing script:
Code: Select all
#!/usr/bin/env python
# m0xpd
# shack.nasties 'at Gee Male dot com'
import serial # Get the Serial library
ser=serial.Serial('/dev/ttyAMA0',38400) # Set up the UART
channel=int(raw_input("Enter MIDI Channel :")) # input the desired MIDI Channel
command=0xB0 + channel -1 # Build the command byte
controller=int(raw_input("Enter Controller :")) # input the controller number
while True: # set up a loop...
value=int(raw_input("Enter Value :")) # Get the controller value
accept=raw_input("Sending " + hex(command) + " " + hex(controller) + " " + hex(value) + " OK ? ('y' to send) ")
if accept=='y': # Happy with this ?
message=chr(command) + chr(controller) + chr(value)
ser.write(message) # then transmit the message
But I don't receive any data - like I said above.
When I run my script from above and after that showing the RPI vcgencmd usage with:
Code: Select all
vcgencmd measure_clock uartCode: Select all
frequency(22)=01. Maybe the UART Clock settings do not work as expected?!
2. The Pythoncode is wrong or causes setting UART frequency to 0??
I hope anyone of you can help me in this problem. I searched the web for over a week now and finding out many many things on my own, but here there are missing basics. I don't know how to get any further. Any help would be appreciated.
Thank you, Kiki


