Jump to content

understanding the .ngc code


Recommended Posts

well I have been playing around with the various commands and i seem to be getting to grips with this really quickly.  I am going to attach one of my oleds tomorrow and try some of the code i wrote,  have tried some tonight and its all worked fine.

hooked up a din etc and all is good there, moved syntax around etc and that was all good, this .ngc code is quite logical in how it works.

I did try the copy pase command sequence in mios, didnt like it!! so its one at a time.

thanks all have a great xmas, catch you onthe flip side.

Link to comment
Share on other sites

i noticed on the link here: http://www.ucapps.de/mbhp/mbhp_lcd_ssd1306_single_mios32.pdf

that there is a 1k resistor going from the 3.3v feed to reset and also a 10uF cap going from gnd to reset.

will i need to apply this to my oleds as well? mine are 7 pin:  1 gnd, 2 vdd, 3 sck, 4 sda, 5 res, 6 dc, 7 cs


Edited by ssp
Link to comment
Share on other sites

The circuit is a power-on reset (POR) that charges the cap for short period until the power rail stabilises. If you omit this then the displays will probably show garbage pixels. Only one POR is required for all of the displays. I would also suggest to wire a 1N4148  diode in parallel with the resistor with the cathode band at the +3.3V node.

Edited by latigid on
Link to comment
Share on other sites

having an issue with the bootloader update this morning, it wont accept the set lcd type command -->      set lcd_type GLCD_SSD1306


my mb_ng info

Operating System: MIOS32
Core Family: STM32F4xx
Chip ID: 0x10076413
Serial: #57003D001050484E52353320
Flash Memory Size: 1048576 bytes
RAM Size: 196608 bytes
MIDIbox NG V1.036
(C) 2018 T.Klose

this is what i get back: [ 476.439] set lcd_type clcd  [ 477.522] Unknown set parameter: 'lcd_type'!

if i try the clcd line it also fails, was ok the other day.


if i type "help" in the linie this is the command list, there is no option of set lcd_type


[1902.530] Welcome to MIDIbox NG V1.036!
[1902.531] Following commands are available:
[1902.531]   system:                           print system info
[1902.531]   memory:                           print memory allocation info
[1902.532]   sdcard:                           print SD Card info
[1902.532]   sdcard_format:                    formats the SD Card (you will be asked for confirmation)
[1902.532]   network:                          print network info
[1902.532]   set dhcp <on|off>:                enables/disables DHCP
[1902.532]   set ip <address>:                 changes IP address
[1902.532]   set netmask <mask>:               changes netmask
[1902.532]   set gateway <address>:            changes gateway address
[1902.532]   set osc_remote <con> <address>:   changes OSC Remote Address
[1902.532]   set osc_remote_port <con> <port>: changes OSC Remote Port (1024..65535)
[1902.532]   set osc_local_port <con> <port>:  changes OSC Local Port (1024..65535)
[1902.532]   set osc_mode <con> <mode>:        changes OSC Transfer Mode (0..4)
[1902.533]   set udpmon <0..4>:                enables UDP monitor (verbose level: 0)
[1902.533]   keyboard <1|2> (or kb <1|2>):     print current configuration of given keyboard number
[1902.533]   set kb <1|2> debug <on|off>:      enables/disables debug mode (not stored in EEPROM)
[1902.533]   set kb <1|2> note_offset <0-127>: selects the note offset (transpose)
[1902.534]   set kb <1|2> rows <0-16>:         how many rows should be scanned? (0=off)
[1902.534]   set kb <1|2> velocity <on|off>:   keyboard supports break and make contacts
[1902.534]   set kb <1|2> release_velocity <on|off>: keyboard supports NoteOff velocity
[1902.534]   set kb <1|2> optimized <on|off>:        make contacts only scanned if break contacts activated
[1902.534]   set kb <1|2> dout_sr1 <0-32>:            selects first DOUT shift register (0=off)
[1902.534]   set kb <1|2> dout_sr2 <0-32>:            selects second DOUT shift register (0=off)
[1902.534]   set kb <1|2> din_sr1 <0-32>:             selects first DIN shift register (0=off)
[1902.534]   set kb <1|2> din_sr2 <0-32>:             selects second DIN shift register (0=off)
[1902.534]   set kb <1|2> din_key_offset <0-127>:    selects the key offset between DIN1 and DIN2
[1902.535]   set kb <1|2> din_inverted <on|off>:     DINs inverted?
[1902.535]   set kb <1|2> break_inverted <on|off>:   Only break contacts inverted?
[1902.535]   set kb <1|2> make_debounced <on|off>:   Make contacts will be debounced
[1902.536]   set kb <1|2> break_is_make <on|off>:    Break contact will act like Make and trigger a note
[1902.536]   set kb <1|2> delay_fastest <0-65535>:   fastest delay for velocity calculation
[1902.536]   set kb <1|2> delay_fastest_black_keys <0-65535>: optional fastest delay for black keys
[1902.536]   set kb <1|2> delay_fastest_release <0-65535>: opt. fastest release delay for velocity calculation
[1902.536]   set kb <1|2> delay_fastest_release_black_keys <0-65535>: opt.fastest release delay for black keys
[1902.537]   set kb <1|2> delay_slowest <0-65535>:   slowest delay for velocity calculation
[1902.537]   set kb <1|2> delay_slowest_release <0-65535>: slowest release delay for velocity calculation
[1902.537]   set kb <1|2> key_calibration <on|off>               enables/disables key calibration
[1902.537]   set kb <1|2> key_calibration clean                  clears calibration data
[1902.537]   set kb <1|2> key_calibration_value <key> <delay>    directly sets delay value
[1902.537]   set midimon <on|off>:             enables/disables the MIDI monitor
[1902.537]   set midimon_filter <on|off>:      enables/disables MIDI monitor filters
[1902.537]   set midimon_tempo <on|off>:       enables/disables the tempo display
[1902.537]   router:                           print MIDI router info
[1902.537]   set router <node> <in-port> <off|channel|all> <out-port> <off|channel|all>: change router setting
[1902.537]   set mclk_in  <in-port>  <on|off>: change MIDI IN Clock setting
[1902.537]   set mclk_out <out-port> <on|off>: change MIDI OUT Clock setting
[1902.537]   testaoutpin:    type this command to get further informations about this testmode.
[1902.538]   caliaout:       type this command to get further informations about this testmode.
[1902.538]   testlcdpin:     type this command to get further informations about this testmode.
[1902.538]   set dout <pin> <0|1>:             directly sets DOUT (all or 0..255) to given level (1 or 0)
[1902.539]   show douts:                       prints the current DOUT patterns
[1902.539]   set debug <on|off>:               enables debug messages (current: on)
[1902.539]   set autoload <on|off>:            enables autoload after filebrowser upload (current: on)
[1902.539]   save <name>:                      stores current config on SD Card
[1902.539]   load <name>:                      restores config from SD Card
[1902.539]   show file:                        shows the current configuration file
[1902.539]   show pool:                        shows the items of the event pool
[1902.539]   show poolbin:                     shows the event pool in binary format
[1902.540]   show id <element>:<id>            shows informations about the given element id (e.g. BUTTON:1)
[1902.540]   show hw_id <element>:<hw_id>      shows informations about the given element hw_id (e.g. BUTTON:1)
[1902.540]   show ngr_tokens:                  shows .NGR token information
[1902.540]   lcd <string>:                     directly prints a string on LCD (can be formatted!)
[1902.540]   run [<section>] [<value>]:        executes the .NGR script with the optional section and value
[1902.540]   ngr_value:                        value used for 'run' (without parameter) and 'ngr' (is: 0)
[1902.540]   ngr_section:                      section used for 'run' (without parameter) and 'ngr' (is: 0)
[1902.540]   ngr <command>:                    directly executes a NGR command
[1902.540]   ngc <command>:                    directly executes a NGC command
[1902.540]   msd <on|off>:                     enables Mass Storage Device driver
[1902.541]   reset:                            resets the MIDIbox (!)
[1902.541]   help:                             this page
[1902.542]   exit:                             (telnet only) exits the terminal

Edited by ssp
Link to comment
Share on other sites


Hey Bruno, its ok I have been having a total brain fart again and not checking my notes.  I needed to start it up in mios32 bootloader.

I have it up now in mios studio as MIOS32 Bootloader in and out.

I forgot to hold the blue button down and tap the black to restart in bootloader mode on the discovery board.


all sorted now, thanks

Edited by ssp
  • Like 1
Link to comment
Share on other sites

So.... after some food and a break I sorted it. The board was wiped and re programmed. It took then, wierd as It says on the one web page to get into bootloader press the blue button and hold then short press the black on the discovery board, however it wouldn't take that way.  However tonight I get to try out some of the code I wrote on the display, really pleased. 




Link to comment
Share on other sites

Nice to see your progress!

It's confusing, but there is a difference between "bootloader hold" and flashing the "bootloader hex app" through MIOS Studio. 

Bootloader hold, using the blue DISCO button, is when you mess up a custom app or the flash is corrupted somehow and the Core will not boot anymore. This allows you to fix the Core with a known good hex upload.

Bootloader app is essentially the same but can be normally flashed with MIOS Studio. Upon USB re-enumeration you can then alter boot settings, including changing the LCD type.

Link to comment
Share on other sites

Had a good evening working on this, everything i have run through on first steps has worked. I have a din and dout hooked up led's are lighting up as they should with the set button presses etc.

The Oled display is working as it should off to have a read now and figure a few things out.

I really like John Finsters mackie setup here:http://www.midibox.org/dokuwiki/doku.php?id=john_e._finster#midibox_ng_mackie_control_clone_-_august_2013

and the custom fonts info here: http://www.midibox.org/dokuwiki/doku.php?id=john_e._finster#how_to_create_custom_glcd_fonts_icons_bars_for_midibox_ng

the section on the bars Panorama and Volume, i was hoping to pick johns brains a bit on this, but hes not been back in for a little while. I am reading his wiki page and the info and will have to try it out once i am more familiar with the code and its implementation in applying custom fonts. I also like the use of the mute/solo/record and monitor icons he used. 


Link to comment
Share on other sites

Thorsten i am reading Johns "Known Issues" section on the custom fonts/ Bars section. Any thoughts on this issues he had? see if this is solveable?  I can add this to my wiki documentation and reference johns when I am ready.




PS: Happy New year!!

Edited by ssp
Link to comment
Share on other sites

  • 2 weeks later...

grabbed some info on NRPN's also info on lsb and msb messages etc. So spent some time looking at those and the info on the matrix for the glcds. Lots to learn while I wait for my Ainser to arrive from the states.

Looking forward to trying things, failing, trying, failing and then working it out eventually! lol

Tried a few things out this evening with an older core8 , had to change some of the code and recompile (I manged to remember how to do that!!)  and it all worked back and fore.

Going to work on the case work tomorrow and the overlay graphics before i get it printed onto overlay vinyl and laser cut.

More to follow ;)

Link to comment
Share on other sites

20 hours ago, TK. said:

Important: when you are experimenting with NRPN, please use the latest version which got a fix for the NRPN numbers: http://www.ucapps.de/mios32/midibox_ng_v1_037_pre9.zip

(I will release this soon to make the changes official)

Best Regards, Thorsten.

Ah i just saw this been busy making solder fumes here!


thank you TK

Link to comment
Share on other sites

Question,  is it possible to connect a single pot to the MB_NG without the ainser?

i have got a single 3 digit 7 segment here and and single pot on breadboard, so i can try working out the code for the nrpn -99/-/99 values. and see if it will work.




edit,, just the pot info is needed

Edited by ssp
Link to comment
Share on other sites

2 hours ago, latigid on said:

Just use MIOS Studio and assign one of the sliders to your CC event, or rather assign your event to one of the sliders.

You can probably use J10 or J5 as analogue inputs.

I didnt think of that, I want to try and figure out the nrpn this weekend (this is dependent on my ability to keep a stable path for the required neuro transmitters to create a link from the correct areas of my brain to form a cognetive thought and also hold a stable enough charge to allow the required areas to form a coherant memory) or in simple terms... not have a brain fart and have a mild ability to understand stuffz....

Edited by ssp
Link to comment
Share on other sites

When I use a core 8 for a build and i want to do some testing, I usually just connect one fader or pot to J5 on the core and then I edit the code as shown

by default using the MB_64e V2 it is:



if you only have one fader you need to link any unused pins to ground however,  I always just change the code to this and everything is fine as it is not expecting any other inputs.



This makes the core happy and only sees the one input.

My question is can I also edit the MB_NG in a similar manner for the Ainser 64 rather than having to ground all the other pins?

This is such a time saving way for me to check and test a single pot or fader.

I dont have my ainser 64 pcbs from the states yet so I have no way of trying it for myself rather than asking a question.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...