Lamster

CORE_STM32F4 Module Help

22 posts in this topic

Hi I'm New here so Hello and please excuse my ignorance

I built a STM34F4 core last year with the intention of building a HUI clone but ended up modifying a D8B so I have a complete core (including the black smash tv board) in a drawer thats never been anywhere near a computer.

I recently had my Fatar Sl161 die so have a 61 note keyboard for the use of so i was thinking a Hammond style contoller I have a set of 9 drawbars around somewhere i looked over the KB project files and it looks like i can do this with this core?

What I need is some advice on other modules dout and din? and really how to get started. Do I need to buy modules first or can I start on programing without( have now idea how to program my limit was the basic program

"10.Print "Something stupid or rude". 20. Goto 10.  " Run"

So far I've worked out I need to load the mios boorloader and install the mios program I'm guessing I can load the hex files from the KB project and edit that? or do I need more research time?

Thanks in advance

Regards

 

 

Share this post


Link to post
Share on other sites

Welcome Lamster,and Happy New Year. I don't know if you've checked out the MIDIfication forum, the posts in that forum are exactly what you are interested in doing, modifying keybeds and organs using the MIDIbox KB project or the NG code. And Fatar keybeds are very popular so you should find alot of help. You'll need to read over the Wiki page 

Really this forum, User's Projects, is for user's WIP projects that don't fit in with one of the 'Official' projects.

Again Welcome aboard,

Yogi 

Share this post


Link to post
Share on other sites

Hi Lamster,

it's probably better if you would start with MIDIbox NG: http://www.ucapps.de/midibox_ng.html

It's a configurable MIDI controller which should fit for your needs (see the user manual, especially the "first steps" section).

And it supports the same keyboard scan routine like MIDIbox KB (see KEYBOARD command in the .NGC section), and the drawbars could be connected to a MBHP_AINSER64 module.

Best Regards, Thorsten. 

Share this post


Link to post
Share on other sites

Thanks Thorsten

Yes I can see that the NG would give me more options.

As you can most likely tell I have no issues with electronics or mechanical Its what Ive been doing my entire working life, but computer programming I have never really  tried. Last time I tried was on a 1kb basic machine at school( commadore PET) 30 odd years ago I think I managed to mess up a program with about 10 lines of code meanwhile everyone else had programmed space invaders using alpha numemic characters as the aliiens and missiles. That kind of finished me.

I do however flash modules, pics, gals, and epromms and the like at work pretty often on serveral different platforms with at least 6 or 7 different programmers and software so uploading bin hex and other code isnt a problem. I guess my first stage will be to load the bootloader to my core and make sure its working properly?

From what I can tell the project file sets up the defaults to start writting (creates the blank canvass)? From there I would need to write my own code to implement each function i.e keyscanning drawbars switches and knobs?

Are there some simple tutroials that need just the core so I can 1. test my core and 2. have some confidence building success.

I have to admit I am pretty usless with software takes me forever to configure factory built controllers in Cubase.  I've even sold stuff because I can't get it working the way I wanted it too

Share this post


Link to post
Share on other sites

Hi Lamster,

don't worry, in the past (as a teenager) I programmed PETs as well and know this situation. Let's say it this way: space invaders is already part of the firmware, you only have to configure it (should the spaceships attack vertically or diaconal? ;-)
Nobody will complain if you've questions how to configure it correctly, as long as you raise up the right questions which allow us at the "remote end" to understand the situation - and this requires sometimes "literature research".

So, here are two webpages as a starting point:

This page explains how to setup a STM32F4 microcontroller, which will be the brain of your MIDIbox NG: http://www.ucapps.de/mbhp_core_stm32f4.html

Even w/o the MBHP_CORE_STM32F4 PCB, you will already be able to flash the firmware (either via MIDI bootloader, or by directly flashing the .hex file - sooner or later you want to access via MIDI anyhow!). But the PCB + some additional modules (such as MBHP_DIN, MBHP_DOUT, MBHP_AINSER64) will allow access to the IO pins. The corresponding documentation can be found at ucapps.de as well; PCBs can be ordered at http://midibox-shop.com

Once the MIDIbox NG firmware has been programmed, the "First Steps" page help you to do get familiar with the MBNG "programming language": http://www.ucapps.de/midibox_ng_manual_fs.html

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hi Thanks Thorsten

Had a problem with my laptop latest windows update bombed it out I had to restore from old image after backing files up to external drive using linux.

unfortunately I forgot to backup my bookmarks and had trouble finding and getting back to this post. Im hoping to find some time next week to fire up the core.hopefully it will work and I can get the bootloader loaded.

So what you were saying is, if i'm sitting infront of my PET you have just handed me the tape backup of space invaders with a sheet which tells me which lines of code need editing once Its loaded?

Regards

Share this post


Link to post
Share on other sites

Hi again Was about to start playing with my core as I found a window to start.

I was reading through the methodology I noticed that the scan speed is 10x faster on the KB project. on Ng 3ms isn't much latency but there is between 5ms -8ms on the computer running the B4/Vb3 software to add to this.

I've found that I start to notice latency at 10-12ms. Scanning 2 keyboards will be 6ms

As I was hoping to implement 2 keyboards 18 drawbars 6-8 switches and 20 knobs.(give or take) Will one core manage this? or would it be better to say configure 1 core to scan the keyboards and one to do everything else then merge them?

or use a core for upper and a core fore lower manuals and merge?

I like the Idea of the faster scanning on the KB project esspecially as I need to scan 2 keyboards.Can this be done with 1 core? Also if using 2 cores I assume that they don't have to be the same? Although the STM32F4 core is pretty cheap to build

so likely would be as cheap to build a second.The other question is can the scan speed be made faster on the NG for example 2x or 3x faster still alowing processing time for other functions. Latency on things like switches and knobs is acceptable

Only the Keys, Drawbars and Leslie fast slow( mod Wheel) need to be in real time low latency

Regards

Share this post


Link to post
Share on other sites

Hi,

yes, there is a way to optimize the scan rate with a single core: just reduce the number of scanned DIN/DOUT registers.

By default, up to 32 DINs and DOUTs are scanned, but if you reduce it to 16, 8 or even 4 (like MBKB), you can reduce the latency by factor 2/4/8

See also: http://www.ucapps.de/midibox_ng_manual_ngc.html

(keyword: "SRIO")

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hi Thanks again Thorsten.

Did actually fire the thing up last night St link forced me to upgrade firmware before it would talk.

Loaded Mios bootloader and then opened Mios Terminal and then loaded Ng project Closed down restarted and it reported Ng loaded, But only the once  I closed down and went off to read some more coming back later and restarting everything and Mios terminal said core not present after much messing about decided to take the SD card out and read it direct on the compuer. There was about 5 files present so decided to format and start again back to ST link reload bootloader Mios finds it ok load Ng but this time Mios studio will not find the core Files have been written to SD card could not find a way to get the core to be seen, I decided to clear it all down and reload Boorloader and this again is working correctly.

Having now slept on it I wondered if the SD is not being read either the card type is not compatible or a bad joint on the reader, Or am I simply doing it wrong?

Should mention The SD card is a 4gb SDHC as that was all I could find in the local shops.

Also what is "SRIO"?

Regards

Edited by Lamster

Share this post


Link to post
Share on other sites

Hi there

I had another play with the core Inspected my work and tried a few things so that I can provide more detailed info.

I checked everything on my core board (Smash TV) pcb I'm happy that I have constructed this correctly.

My worry was that because I could not obtain an THP style SD card reader I used an SMD version instead but the joints are good so should not be an problem. The issue is that once I load a project file the core stops working. However if  while in Mios studio with bootloader running you chose bootloader as the project it loads this and after reset does reboot into the bootloader..This indicates that the bootloader is running and that the interface can write to the core?

When I load either Ng or KB I get a line that says 1 ignorable error resolved? After reset I get red text as though the core is not plugged in. Nothing appears to be running as I cannot select bootloader and reload that as Mios reports no core.  The interface is still present "USB Audio Device" as i'm on a windows machine. I'm "guessing of course" that the NG project replaces the bootloader and is then not being loaded and causing some kind of lock up ? Is that 1 ignorable error a factor in this?

As I stated in my last post the files appear to be created on the SD card as mentioned in the instructions. so I'm under the impression that my core is at least running the bootloader and updating to the NG project which appear to work in that it writes the files to the SD Card I proved this by formatting the card and reloading the project file and then checking the SD card.

The only way I can get it running is to go back to ST link and reflash the bootloader.

I was at least hoping to get as far as loading NG project without issues as I explained earlier I am clueless when it comes to software and this hicup right at the start hasn't done much for my confidence in getting a lot further with this.

There is also a mention in the instructions about V1_019 bootloader mine is V1_018 cant see a later version anywhere is there a later one or have I misunderstood that?.

I really have no idea what is happening I may try another micro usb cable if I can find one  and a different SD card but other than that I'm out of ideas, I'm confident that the core board is correctly constucted (as that would be the most likely source of a constructional error) leaving unlikely as It may be that I could have a faulty STM module which would be a bit of a drag.

Regards

 

Share this post


Link to post
Share on other sites

Hi,

Bootloader V1.018 is fine, where did you find the hint that V1.019 should be used?

Quote

I'm "guessing of course" that the NG project replaces the bootloader and is then not being loaded and causing some kind of lock up ?

No, a MIOS32 application doesn't replace the bootloader, this part resists in a protected range.
You could upload the application .hex file directly with ST Link, in this case the flash gets the bootloader + application binary
In both cases MIDI upload should work

Quote

Is that 1 ignorable error a factor in this?

No, the ignorable error really can be ignored, no reason to be worried about that

 

Questions to you:

- which Windows version are you using?
- some Windows versions require the "single_usb" option, see also: http://www.ucapps.de/mios32_bootstrap_newbies.html
- note that the single_usb option will be overwritten to the default (0) whenever you are overwriting the flash contents with the ST link programmer.

Proposal for further troubleshooting:

- flash the MIOS32 bootloader update application again with ST Link
- activate the single_usb option via MIOS Studio terminal as described in the "newbies" page (search for "single_usb")
- after "store", reconnect the USB cable
- wait until Windows found the device
- re-open MIOS Studio
- upload the application

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

To reiterate; when using Windows each time the Core resets you need to restart MIOS Studio to properly "sync" the USB-MIDI connection. It's annoying, especially because you have to click through an additional dialogue window asking if changes to the computer are permissible. 

Share this post


Link to post
Share on other sites

Hi Thorstern

Thankyou again for you response

The 1.019 is metioned here in the NG first steps document http://www.ucapps.de/midibox_ng_manual_fs.html

I loaded everything up on my old laptop so its on XP It also has Win7 as its dual boot so I could transfer everything over if that is better to use. Will be quicker I guess than messing about.

I think more reading and revision is needed on my part while I get my head round the MIOS system. I realised that I can't type anything in the box so forcing single use USB is a problem

I'll move everything over to Win7 later and have another go hopefully I'll be ready to start then?

Best regards

Share this post


Link to post
Share on other sites
19 minutes ago, Lamster said:

The 1.019 is metioned here in the NG first steps document http://www.ucapps.de/midibox_ng_manual_fs.html

This page refers to a feature which was introduced with the MIDIbox NG version V1.019 (I added this detail to make it clear)

20 minutes ago, Lamster said:

I think more reading and revision is needed on my part while I get my head round the MIOS system. I realised that I can't type anything in the box so forcing single use USB is a problem

commands have to be entered into the special text box under the terminal window

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Hi Thorstern

Yes I see now that From 1.019 of NG or later e.g 1.035 rather than bootloader 1.018 my bad.

tried typing in the box and nothing happening so definately giving up with XP and Moving over to win7

Hopefully when I try this later all will be well

Regards

 

Share this post


Link to post
Share on other sites

Hi Thorstern

Thankyou swapped over to Win7 and Midi port comes up a Midibox NG and loaded.

Only issue which is easy enough to sort is when Mios Studio is started I get the nothing there Red text if I go to Midi input and change to Midibox NG2 then back to 1 it connects and reports that STM34 Midibox NG 1.035 is present.

So I guess that means its running. If you click update it clears and the text confirming the ID of the connected core comes back a second or so later.

I guess this means that I can start on the tutorials?

I will need an AINSER64, DIN and a MIDIIO What else?

How much coding can be done without these modules?

Regards

 

 

Share this post


Link to post
Share on other sites

Alright, fine!

DIN/DOUT functions can be alternatively mapped to the IO pins at J10, search for the "J10" keyword in the tutorial

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

O.K
 i've ordered myself an LCD display as I didn't have a suitable one. Once I get that I'll work through the beginers tutorials.

So am I reading this correctly. The NG program is essentially aready written, what the user is doing is specifying the parameters in which it runs?

For example specifying that an 8x8 matrix is present on a DIN module connected to J?? on the core? the NG aready knows what to do with that?

 

Share this post


Link to post
Share on other sites

Yes, by telling the MBNG that a 8x8 DIN matrix is connected, it will scan the inputs and provide them for further event processing.

In the cfg/tests directory you will find a lot of additional programming examples which might help: http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Fcontrollers%2Fmidibox_ng_v1%2Fcfg%2Ftests%2F

E.g. this example shows the most simple way to send Note Events from a DIN matrix: http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Fcontrollers%2Fmidibox_ng_v1%2Fcfg%2Ftests%2Fblm8x8.ngc

And when you compare this configuration with the detailed description under http://www.ucapps.de/midibox_ng_manual_ngc.html you will notice that there are much more possibilities - the example only gives you a starting point. 

Best Regards, Thorsten.

Share this post


Link to post
Share on other sites

Thanks again Thorstern

E.g EVENT_BUTTON id=  1  type=CC  chn= 1 cc= 16  range=  0:127  
Pushing the button is sending cc 16 data on midi Channel 1 with variable velocity? in other words this is a velocity sensitive Button/key?

So the DIN is specified in the user set up and the ID1 of the button will be pre assibned in the MBNG so that  it will always correspont to a specific pin on the DIN?

Regards

 

Share this post


Link to post
Share on other sites

Hi Again

Slight change of plan I managed to aquire a Hammond organ with 2x61 note manuals complete with the 12 reverse preset keys 4 sets of 9 drawbars and ton of tablet switches. Free to collector.

It ended up being pretty easy collection after I introduced it to my circular saw. 4 hrs to harvest the parts and the rest is  now landfill. Dont worry it wasn't a good one

Looking at the diagram for non velocity keyboards it wasn't clear which end was the bass end I also assume that that loop can extend to 128 notes  or you can make a second clone and scan seperately?

Wanted to wire the keyboards while I'm waiting for my other midibox parts to arrive

Regards

Edited by Lamster

Share this post


Link to post
Share on other sites
Quote

Looking at the diagram for non velocity keyboards it wasn't clear which end was the bass end I also assume that that loop can extend to 128 notes  or you can make a second clone and scan seperately?

yes, up to 2 keyboards can be scanned separately.

Alternatively - since no velocity is involved - you could also scan the keyboards as a DOUT_MATRIX. Up to 16 matrices are supported.

Best Regards, Thorsten.

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