Jump to content

Investigating Latencies


FantomXR
 Share

Recommended Posts

Hey people,

for a project of mine I need high speed on the MIDI output. 
I took the NG-firmware and cleaned it from all the stuff that I do not need. Also I added this line to my app.c which speeds up the scanrate of the SRIO significantly

MIOS32_SPI_TransferModeInit(MIOS32_SRIO_SPI, MIOS32_SPI_MODE_CLK1_PHASE1, MIOS32_SPI_PRESCALER_8);

I think the standard prescaler is at 64 or so. This gives me an ultra high scanning frequency for the SRIO chain and it works great. I can not see any loss of data.

My setup looks like this: I have the core and a DIO-Matrix connected to it. I connected a simple switch to the DIO-Matrix which sends a note event to the midi-port. 
I connected my oscilloscope to this setup. The first channel is directly connected to the switch, the second channel is connected to the midi-output. Due to the open-drain-mode of the MIDI-out I need to bridge pin4 and pin5 of the midi-jack to get accurate results. The wiring of the MIDI-out is straight forward: Pin 4 is connected to +5V via 220Ohm. Pin 5 is connected to the core via 220Ohm.

So what I notice here is the time between pressing the switch and the midi-out signal differs any time I press the button. Sometimes it's only 100-200us, sometimes it's more than a millisecond. 

I'd like to know where this comes from and if it's possible to minimize this latency. 

Also I'd like to know why the gap between pressing the switch and midi-out signal differs and doesn't stay the same (which would I expect if there is a buffer involved).

We had a discussion about speed in the past:

 But even if I change the baudrate or buffersize of the midi-out, the latency stays. 

Any ideas?

Thanks,
Chris

Edited by FantomXR
Link to comment
Share on other sites

Just now, FantomXR said:

So what I notice here is the time between pressing the switch and the midi-out signal differs any time I press the button. Sometimes it's only 100-200us, sometimes it's more than a millisecond. 

I'd like to know where this comes from and if it's possible to minimize this latency. 

This is normal, MIDI processing in MIOS32 is a periodic Task called every ms. So if you push your button just before the task you will get " 100-200us " if it's just after it will be something like 1ms.
 

Link to comment
Share on other sites

Just now, Antichambre said:

This is normal, MIDI processing in MIOS32 is a periodic Task called every ms. So if you push your button just before the task you will get " 100-200us " if it's just after it will be something like 1ms.
 

Thanks! I thought it's something like that. Is there a chance to halve that?

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