Shop OBEX P1 Docs P2 Docs Learn Events
UART at 31250 baud (MIDI, FullDuplexSerial) — Parallax Forums

UART at 31250 baud (MIDI, FullDuplexSerial)

65816581 Posts: 132
edited 2010-11-20 11:55 in Propeller 1
Hi,

I have some trouble using a UART at 31250 baud (the baud rate using
by MIDI. The Data (NoteOn, NoteOff, etc.) seems to be received
correctly about 98% of the time, but something about 2% gets
discarded for some reason. I'm using the FullDuplexSerial object.
This seems only to appear when I'm using more cogs - e.g.
SIDCog (modified version), ADC objects and FullDuplexSerial.
It has worked without any problems previously.

This is some snippet to show how the data is processed:
repeat
     note := -1
     if ( b := midi.rxcheck ) <> -1
       midi.tx(b)
       if b & $80
         runningStatus := b
         b := midi.rx

       if ( runningStatus ) == $90
         note := b
         vel := midi.rx
         if vel == 0
           note := -1

       elseif ( runningStatus  ) == $80
         ' Do something (CH0 note off)
         midi.rx ' Ignore velocity.
     if note <> -1
         ' Do something (NoteOn)

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2010-11-17 12:41
    Hello,

    it might be a problem wth the buffer.

    The standard fullduplexserial-object (short fdx) has send and receivebuffer of 16 bytes. If 16 bytes have been received and a seventeentth byte arrives
    the oldest byte gets overwritten by the newest byte.

    It is possible to increase the buffersize. With the standard fdx-object you have to do this at sevral places including the PASM-code.

    There are other versions of FDX that make it very easy to change the buffersize. I don't have the names handy. Maybe somebody else can chime
    in and post a link or the name of this objects.

    best regards

    Stefan
  • 65816581 Posts: 132
    edited 2010-11-18 01:01
    StefanL38 wrote: »
    Hello,

    it might be a problem wth the buffer.

    The standard fullduplexserial-object (short fdx) has send and receivebuffer of 16 bytes. If 16 bytes have been received and a seventeentth byte arrives
    the oldest byte gets overwritten by the newest byte.

    It is possible to increase the buffersize. With the standard fdx-object you have to do this at sevral places including the PASM-code.

    There are other versions of FDX that make it very easy to change the buffersize. I don't have the names handy. Maybe somebody else can chime
    in and post a link or the name of this objects.

    best regards

    Stefan

    Are you thinking about http://forums.parallax.com/showpost.php?p=883228&postcount=3 ?
  • JonnyMacJonnyMac Posts: 9,235
    edited 2010-11-20 10:28
    I had a small buffer issue with FDS as well and went in and changed it to 64. That code is attached.

    BTW, is okay that your system adds a 1-byte delay to the outgoing MIDI stream? Seems like you'd want to have the MIDI THRU port done in hardware to that it passes through without delay.
  • 65816581 Posts: 132
    edited 2010-11-20 11:55
    JonnyMac wrote: »
    I had a small buffer issue with FDS as well and went in and changed it to 64. That code is attached.

    BTW, is okay that your system adds a 1-byte delay to the outgoing MIDI stream? Seems like you'd want to have the MIDI THRU port done in hardware to that it passes through without delay.

    It actually has a hardware MIDI thru port. The MIDI output is only used
    for sequencer output etc.
Sign In or Register to comment.