PDA

View Full Version : UART at 31250 baud (MIDI, FullDuplexSerial)



6581
11-17-2010, 03:00 PM
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)

StefanL38
11-17-2010, 08:41 PM
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

6581
11-18-2010, 09:01 AM
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 ?

JonnyMac
11-20-2010, 06:28 PM
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.

6581
11-20-2010, 07:55 PM
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.