TK.

USB Host support for MBHP_CORE_STM32F4

80 posts in this topic

Hi Thorsten.

Great stuff! I have been hunting all over for exactly this solution. I should have known to come check here first ^_^

I'm keen to try this out. A question or two if I may?

Do you have any ideas why USB hubs are not working? You mentioned power issues before - have you (or anyone else) tried a powered hub? Or do you have any other thoughts about how that might be fixed?

If not, then I might try another board with more than one USB port, like say the new Raspberry Pi Model B+. Granted, that will involve porting MIOS :/ but I think FreeRTOS runs on it already at least.

Share this post


Link to post
Share on other sites

Thank Thorsten ! I'm honoured !

The Discovery Board is already equipped with a MOSFET "power switch" (not a charge pump because it is not needed) controlled by PC0.

The STMPS2141 is spec'd at 500mA max current.
But as you mentioned before the voltage is a bit weak (4.3V) because of a BAT60 diode on the path.

An external true 5V power connected on the 5V pin of connector P2 will avoid that drop voltage.

But I suppose you already know this...

Edited by BlueXav

Share this post


Link to post
Share on other sites
Do you have any ideas why USB hubs are not working? You mentioned power issues before - have you (or anyone else) tried a powered hub? Or do you have any other thoughts about how that might be fixed?

 

It's not related to a hardware limitation, but due to special software which is required to establish the connection to the hub and to enable the device ports. This isn't straightforward, but it's on my mid term agenda (of course, I would be interested to use a hub as well...)

 

 

The Discovery Board is already equipped with a MOSFET "power switch" (not a charge pump because it is not needed) controlled by PC0.

The STMPS2141 is spec'd at 500mA max current.

 

Ok, I will check this sooner or later.

My focus was on the SW side, not so much on the HW side yet

 

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

I'm trying to use this with an Akai MPD32. It doesn't turn on, thinking it's a voltage issue as described, since it works fine with another controller. I veroboarded my own core. I looked at the schematics, but just to double check, I simply put any old 5V PSU of sufficient wattage to the 5V pin of the Discovery board and PA9? And then I can leave the USB debug port unplugged?

Edited by niklasni1

Share this post


Link to post
Share on other sites

yes

 

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Yes, works.

 

The MPD32 (and the other Akai MPD/MPKs) are nice in that it's USB but also has regular DIN MIDI I/O which you can access seemingly fine from Seq v4.

Share this post


Link to post
Share on other sites

it works with my e-mu xboard25 keyboard, but not with my mutable instruments cvpal.

 

has anybody else got it running with cvpal?

Share this post


Link to post
Share on other sites

Limitations:
- USB hubs are not supported, the MIDI device has to be connected directly.

I don't know if this will help or not, but recently I have been researching USB Host MIDI on Android platform. 

I found a note on one software company's site that said a USB hub was needed that supports "Multi-Transaction Translator" (MTT or Multi-TT).  This will allow multiple USB MIDI devices to connect via the hub to an Android host.

I've found hubs with those magic words in their description for around $20 on ebay, so perhaps this is worth trying out?

Share this post


Link to post
Share on other sites

The MTT will translate USB 1.1 to 2.0, it won't solve the problem because the actual problem is the missing USB Hub support in the USB drivers provided by ST. Enhancing the code seems to be difficult, I haven't found a ready made (and open source) solution in the internet yet.

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hey,

I didn't get it yet: I tried to connect a AKAI LPK25 to the STM via the micro-port and I used the adapter you posted in the first post. But whats next? I power the core via the mini-USB-port. 

How do I route now the signal of the LPK to one of the MIDI ports?

Thanks! :-)

Share this post


Link to post
Share on other sites

I would try with an external power instead of via the mini-USB port. 

Share this post


Link to post
Share on other sites
2 minutes ago, Shuriken said:

I would try with an external power instead of via the mini-USB port. 

I tested it with an external power supply. But as I said: How to go on? How can I assign the LPK to the MIDI ports?

Share this post


Link to post
Share on other sites
9 minutes ago, Shuriken said:

Are you running the  usb_midi_2x2_v1_010.zip application?

No, I read somewhere in the forum that the host-mode will be supported by every application. My core is running NG. I assume that I'd need to configure the midibox before connecting a usb device to it? Because I (of course) can not access the midibox via the MIOS Studio anymore when using the usb host mode.

Share this post


Link to post
Share on other sites

MIOS Studio can connect via MIDI IN1/OUT1

But you could also change the router configuration in DEFAULT.NGC via an USB based connection to MIOS Studio before connecting the keyboard.

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

...

this was too easy... didn't see it :-) I'll try it! Thanks!

Share this post


Link to post
Share on other sites

Hello all, I'am started today with MIOS32 on bare STM32F4DISCOVERY and I try to run it as a MIDI Host for the M-Audio Oxygen, as Master-Keyboard, in my life-performance setup (Korg R3 synth and a Technics KN920 keyboard).

While the Keyboard is connected to the STM32F4DISCOVERY the USB-OTG port is not longer available to MIOS-Studio. As suggested before, the MIDI-BOX should be configured before usage using der USB-mini connector to configure the MIOS32 core. I tried to upload the application "usb_midi_2x2_v1_010" to get a brigde between the USB-MIDI Host Port and the classic MIDI-IO Port.

The upload of the "usb_midi_2x2_v1_010" application ends with an error message. After that MIOS Core can't be accessed by MIOS-Studio only until I reload the MIOS_bootloader via the STlink interface.

Has anyone an idea what I'm doing wrong or have a suggestion where to get some documents which may lead to a solution.

Best regards, Matthias

Share this post


Link to post
Share on other sites

Hello Matthias, I'm sorry I can't help with your problem directly. But I've just run across an interesting product that offers a 'have your cake and eat it too' solution to the host mode midi function. In another forum someone pointed this chip out-

http://www.hobbytronics.co.uk/usb-host-dip

USB Host midi on one side and TTL serial midi on the other. At 5 pounds for the bare chip, It's a little on the spendy side compared to the STM host mode; but using it with one of the STM's midi ports would provide a very simple bridge without losing the PC midibox studio link. For that matter, would work on a PIC core project also.

Just a thought, Yogi

Share this post


Link to post
Share on other sites

Hi Matthias,

I just tested the following at my end:

  • uploaded usb_midi_2x2_v1_010 application to a STM32F4 core
  • no error message noticed
  • disconnected USB cable to my computer, connected USB host adapter
  • STM32F4 powered via J2 (but I also tested power supply via STLink USB socket)
  • connected M-Audio Oxygen49 keyboard
  • reseted the core (pushing black button) to ensure that the keyboard will be found
  • -> MIDI data will be sent via MIDI OUT1.
  • The green status LED on the STM32F4DISCOVERY board will flash whenever the keyboard sends data

Which error message did you get exactly?

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hi Thorsten,

Thanks for your reply.

Here the messages I get from MIOS Studio:

This message is display when MIOS-Studio is started with the STM-Discovery board flashed from scratch with a ST-Link utility:

Operating System: MIOS32
Board: MBHP_CORE_STM32F4
Core Family: STM32F4xx
Chip ID: 0x10036413
Serial: #2B004D000B51333335393336
Flash Memory Size: 1048576 bytes
RAM Size: 196608 bytes
Bootloader 1.018
(C) 2014 T.Klose


Then when I select the "usb_midi_2x2_v1_010" application for upload I see this:

Reading project.hex
project.hex contains 67262 bytes (264 blocks).
Range 0x08000000-0x08003fff (16384 bytes) - BL excluded
Range 0x08004000-0x080041ff (512 bytes) - STM32 Flash
Range 0x08010000-0x0801c5ff (50688 bytes) - STM32 Flash
Press start button to begin upload.

and after pressing the START button I get this text in the two message boxes

Upload of 51200 bytes completed after 1.33s (37.68 kb/s)
1 ignorable errors during upload solved (no issue!)
--------------------------------------
No response from MIOS8 or MIOS32 core!
Check MIDI IN/OUT connections
and Device ID!
For debugging see also
Help->MIDI Troubleshooting

I think this is because after the application upload the "discovery"-board perform a reset and come up with the OTG-USB port in host mode. But why, if I press the reset button on the "discovery"-board it still comes up in host mode when it is still connected to the PC?

after rescan of the midi ports MIOS-Studio shows:

Scanning for MIDI Outputs...
[1] Midi Through
[2] USB MIDI 2x2 (1)
[3] USB MIDI 2x2 (2)
[4] Juce Midi Input
MIDI Monitor ready.

Scanning for MIDI Inputs...
[1] Midi Through
[2] USB MIDI 2x2 (1)
[3] USB MIDI 2x2 (2)
MIDI Monitor ready.

MIOS Studio show MIDI Output messages when keys on integrated the virtual keyboard are pressed and the green led on the core is flashing, but the MIDI message is not present on PA2/PA3 (I'am used a terminal program).

Please help me to find what I am doing wrong.

Best regards
Matthias

Share this post


Link to post
Share on other sites

Hi Yogi,

Thanks for your advice. I will check the your link.

My intention using the "discovery" board and MIOS32 as dedicated embedded OS is to learn how develop MIOS based applications, especially synthesizers.

best regards
Matthias
 

Share this post


Link to post
Share on other sites
2 minutes ago, aramz said:

Hi Yogi,

Thanks for your advice. I will check the your link.

My intention using the "discovery" board and MIOS32 as dedicated embedded OS is to learn how develop MIOS based applications, especially synthesizers.

best regards
Matthias
 

Hi Matthias, yes there is so much that can be done with MIOS32 and STM. The USB host mode is the 'cherry on top'. I only pointed out that chip as an option for people having to choose when wanting to support a USB device AND maintaining the MIOS Studio/PC USB connection :) Plus it could be useful for older Core 8 projects.

Yogi

Share this post


Link to post
Share on other sites

Working:

AKAI APC40

Stanton SCS.3D (daScrath)

 

Not Working

Novation Launchpad (Version01)

steinberg CMC-PD (to bad i wanted to record drumlines...)

Alesis Photon X25 (usb or ps supplied...dont matter)

 

(setup: stm32F4 @ 5V 2A Power via J2, J17 bridged)

Edited by Phatline

Share this post


Link to post
Share on other sites

Hi everyone,

not sure if this is the right place for this question, but it seems to me like it.

Turning on usb midi host option was pretty easy, by just undefining MIOS32_DONT_USE_USB_HOST in application, and it just worked.

Problem I have is that I am losing midi packets, leaving dead notes and sometimes missing them. This problem appears only when using usb host mode - when I connect stm32f4 discovery board as device to computer, all messages seem to go through, even after many minutes of midi message violence. Did someone notice this problem before, and if so how could it be solved? I've tried two different midi controllers: m-audio keystation mini 32 and alesis vortex wireless, and it's all same - all fine in device mode, losing packets in host mode.

I didn't use midibox board, as I couldn't order it from my country, I am using naked stm32f4discovery with shorted pins for supply only.

Thanks in advance, and forgive me if I missed something really obvious.

Cheers,

Djordje
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now