RTS/CTS flow control

RonCzap

Member
RTS/CTS flow control - VMUSIC2

Does anyone have an example of program code to handle hardware flow control?

I have a VMUSIC2 MP3 module. I currently have it connected to a Basic Stamp using the serin/serout instructions and RTS/CTS pins and it works fine.
I receive all the data sent from the VMUSIC2. Without flow control I miss data and get garbage.

I would like to use the VMUSIC2 with the PICAXE but not sure how to implement flow control.

I would appreciate any code examples or suggestions.

- Ron

Output from VMUSIC2:

Ver 03.68VMSC1F On-Line:
Device Detected P2
No Upgrade
D:\>
D:\>
D:\>
D:\>
Firmware version:
MAIN 03.68VMSC1F
RPRG 1.00R
D:\>
Playing YOU'LL~1.MP3
01
You'll Never Find Another Love Like Mine
Lou Rawls
Greatest Hits [Cema]
T $00 $00
T $01 $00
T $02 $00
T $03 $00
T $04 $00
T $05 $00
T $06 $00
T $07 $00
T $08 $00
T $09 $00
 
Last edited:

RonCzap

Member
Jamster,
Not really - the code in that thread is not using flow control (just taking the VMUSIC2 CTS pin to ground).
Pretty sure you'll get sporadic junk back from the VMUSIC2 when it sends data (the ID3TAG song info, elapsed time, etc)
 

hippy

Ex-Staff (retired)
The best way is probably to use the high-speed background serial receive of a PICAXE then all data will be captured in the scratchpad which can be processed to keep it empty. Interrupts can be generated on bytes received and the amount of buffer filled can be determined and flow control signals can be set as the buffer is filled and cleared as the buffer is emptied.
 

RonCzap

Member
The best way is probably to use the high-speed background serial receive of a PICAXE then all data will be captured in the scratchpad which can be processed to keep it empty. Interrupts can be generated on bytes received and the amount of buffer filled can be determined and flow control signals can be set as the buffer is filled and cleared as the buffer is emptied.
Sounds like a good approach but could be problematic since the ID3TAG information could be several hundred bytes.
I haven't used interrupt handling on the PICAXE - need to study up on interrupts.

Thanks,
- Ron
 

Technical

Technical Support
Staff member
There is nothing magic about RTS / CTS signals, they can be very easily directly connected to a spare PICAXE input / output pin and controlled manually in your program.

So if you don't want the VMUSIC2 to send data, connect CTS (clear to send) to a PICAXE output pin and keep that pin high. When your PICAXE program is ready to receive data just do a 'low CTS_pin' command and then the VMUSIC will start sending the data for you to process. Once done put the CTS pin high again and the VMUSIC2 will stop sending data.
 
Top