Jump to content

Midibox SID and com/midi interface selection


sjakie
 Share

Recommended Posts

Hi,

I was thinking to use the 2com interface to start with in my midibox sid. However at first I thought it would be possible to make a simple switch for midi / serial selection without any changes to the software and reprogramming the pics, but now I am not sure.

If it does require re-programming, would the following be ok to add to the main.asm of sid application so I can have my switch function?


USER_Init       
        movlw 0x00
        call MIOS_SRIO_TS_SensitivitySet
        
        movlw 0x00 ; common midi
        btfss PORTC, 4  ; rd4 is 1 is common midi
        movlw 0x01 ; to host
        call  MIOS_MIDI_InterfaceSet
        
        ...     
I would use a 4052 and a switch to switch either the max232 or the 6n138 the rx/tx lines to pic, like so:
                 +5
                  |
                 [ ]10K
                  |
            +--SW-+---- To J14 all cores
            |     |
           Gnd    |
                  |  4052
                 ---------
                | S0      |
                |         |
      Midi RX---|1y1      |
      Midi TX---|2y1      |
                |         |
      COM RX----|1y0      |
      COM TX----|2y0    1z|--- Pic RX
                |       2z|--- Pix TX
                | E S1    |
                 ---------
                  |  |
                  +--+
                     |
                     GND

SW is a simple switch like an on/off switch.

So the idea here is that the interface selection is controlled by a simple switch at power on for all cores.

Will this be ok, or is there an easier way?  ;D

Am I missing something?

Thanks

Link to comment
Share on other sites

Hi Sjakie,

I guess that you want to select the interface depending on PORTD, 4 (and not PORTC, 4)

Yes, this should work. But don't forget to bring this pin into TriState mode (bset TRISD, 4), otherwise you will get a short circuit

Best Regards, Thorsten.

Link to comment
Share on other sites

Changing the MIOS startup will be difficult, since the bootstrap loader already enables the driver of this pin.

Yes, you can put the TRISD, 4 at the beginning of USER_Init, MIOS won't overwrite this once more.

But take care: the driver of this pin will still be initialized at power-on for ca. 2 seconds. And if you would upload another application, you could also run in trouble. Therefore I recomment a resistor (let's say 220 Ohm) between J14 and the switch in order to avoid a short.

Best Regards, Thorsten.

Link to comment
Share on other sites

Does this also take into account the different transfer rates of the connections (ie, does the Core have an auto-detect function)?  Otherwise you're going to run into trouble with MIDI being 31250 bps and serial being... well, whatever your PC's serial port is set to.

Or is this just designed as a switch for the physical connection, and you otherwise have a device that does 31250 bps over an RS-232 link?

Link to comment
Share on other sites

Ok super, thanks Thorsten.

Hi Andrew,

Yes it runs at different baudrates.

It will run at 38400 over serial with a drivers for several OS's available. See the midibox-to-COM page or LTC module. Thorsten already made all this.

MIOS has this feature built-in, but normally it is controlled during programming time. This little add-on allows to change the interface type with a switch without the need for reprogramming the device id stuff, so you can easily use it directly with a laptop or in a midi-environment. It is not really auto-detect, but by re-using the J14 (touch sensor) pin, you can let the core (or all cores for the SID) know which interface type to configure. So it is only interface type at a time...

Link to comment
Share on other sites

  • 1 year later...

Hi

i wanna build this too and started this shematic...

midi-to-com-switch.jpg

it was hard to find out which pins are the right ones  ::) so please anyone can tell me is the shematic correct ?

I will implement it to LTC board to prevent for max/6N138-exchange ;)

Regards

MTE

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.

Guest
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.

Loading...
 Share

×
×
  • Create New...