Go Down

Topic: Arduino and VMUSIC2 (Read 7 times) previous topic - next topic

magi182

Quote
Yep, it's working if I connect it without external supply. Does anyone know why?


You need to run a ground between arduino and your external power supply; then i bet it will work with external power.

mattp

Hi - I've also made some code for the VMUSIC2 that I'd like to share. This works better for me (in our setup) because;
i) Arduino attaches to PC via USB serial, VMUSIC2 attaches to Arduino via softSerial
ii) All commands are available, and there is two-way communication with the VMUSIC2 (particularly good for reading where in the song playback is up to, since the VMUSIC2 sends a time updates every second).

This is slightly buggy, since quite often the VMUSIC2 will respond with 'Bad Command' - but that's the beauty of two-way comms, eh?

Here's the code:

Quote



#include <avr/interrupt.h>
#include <SoftwareSerial.h>

#define VMUSIC_CTS 5  //to VMUSIC CTS pin 6 (or ground!)
#define VMUSIC_RX 2  //to VMUSIC TXD pin 5
#define VMUSIC_TX 3  //to VMUSIC RXD pin 4
#define ledPin 13

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(VMUSIC_RX, VMUSIC_TX);  //(RXpin, TXpin)

void setup() {
 Serial.begin(9600);      // opens serial port, sets data rate to 9600 bps

 // define pin modes for tx, rx, led pins:
 pinMode(VMUSIC_CTS, OUTPUT);
 pinMode(VMUSIC_RX, INPUT);
 pinMode(VMUSIC_TX, OUTPUT);
 pinMode(ledPin, OUTPUT);  // declare LED as output
 digitalWrite(ledPin, LOW);

 // set the data rate for the SoftwareSerial port:
 mySerial.begin(9600);

 //This will allow softwareSerial to process incoming automatically:
 attachInterrupt(0, readSoftwareSerial, LOW);

 //Tells VMUSIC that hardware is connected:
 digitalWrite(VMUSIC_CTS, LOW);    
}


void loop() {
 int serialReceived = 0;
 if(Serial.available() > 0){
   noInterrupts();
   digitalWrite(VMUSIC_CTS, LOW);
 }  
 while(Serial.available() > 0){
   char incoming = Serial.read();
   mySerial.print(incoming);
   serialReceived = 1;
 }
 if (serialReceived == 1){
   mySerial.print(13,BYTE);  //carriage-return for VMUSIC2
   serialReceived == 0;
 }
 interrupts();  //re-enable softwareSerial
}


void readSoftwareSerial(){
 noInterrupts();
 digitalWrite(ledPin, HIGH);
 char incoming = mySerial.read();
 Serial.print(incoming);
 digitalWrite(ledPin, LOW);
 interrupts();
}


/* VMUSIC COMMANDS:

VPF·file       Plays a single file eg: "VPF 1.mp3"

VRF·file       Repeatedly plays a single file

VST            Stops playback

V3A            Plays all MP3 files

VRA            Repeatedly plays all MP3 files

VRR            Repeatedly plays random MP3 files

VSF            Skip forward one track

VSB            Skip back one track

VSD            Skip forward one whole directory

VP             Pause playback

VF             Fast forward 5 seconds

VB             Rewind 5 seconds

VRD·byte       Reads command register

VWR·byte+word  Writes command register

VSV·byte       Sets playback volume

*/


macsimski

And spend another day finding out a way to format a usb stick with 512bytes per sector on a mac and a pc. Aarrhhgg!!
is there a simple way to do it? disk utility on mac doesnt work, formatting in the explorer in win xp neither.

now i'm playing with the cli tool newfs_msdos but i'm not even shure if that is the right tool for the job.and should i select /dev/disk1 or /dev/rdisk1, or even /dev/disk1s1? no clues here.

it seems that using this tool, i only parially whipe the data. because sometimes it works, sometimes it doens'nt

besies that, if it works, the arduino can control the vmusic very nice.
--
"We're all in this together..."

macsimski

"What happen????. somebody set up us the bomb!!!" :-?

and once of a sudden it works. same sticks, same computer (mac MDD  os x 10.4.9) and disk utilities. first select whole drive and erase as mac os extended, not journaled. then format again as MS_DOS filesystem. eject and voila, working sicks.

How do i know?

make a working serial connection:

remove the atmega from your arduino. pry it off with a  small flatscrewdriver. working your way in from both sides. connect the following signals:

orange to 0 RX.

yelow to 1 TX
red to 5v
black to GND
green to GND

notice that for normal arduino operation, orange goes to 1 TX and yellow to 0 RX
set your terminal program to the right port (in zterm hold the shift after staring up the app and select usbserial-xxxxxx where xxxxx is a unique serialstring)
connection speed: 9600, no handshake, 8n1

if you have a working serial connection between the VMUSIC and your computer watch for the right sequence:

Device Detected P2
No Upgrade
D:\>


after removing notice the line that says:

No Disk

if the stick is not recognized you'll get the shorter version:

Device Detected P2

and nothing more. after removing only:

Device Removed P2

so the best thing to do when starting with the VMUSIC2 is:

1. check the usb stick like mentioned above.
2. upgrade the firmware to the latest from:
http://www.vinculum.com/downloads/firmware/ftrfb_main_03_64VMSC1F.ftd

notice that after pressing enter you also get the D:\> prompt. this does not indicate a working stick

if you send the string
idd

the VMUSIC answers with something like:

USB VID = $0204
USB PID = $6025
Vendor Id = USB
Product Id = FLASH DISK
Revision Level = 5.00
I/F = SCSI
FAT32
Bytes/Sector = $0200
Bytes/Cluster = $001000
Capacity = $391AB000 Bytes
Free Space = $ Bytes


with a non working stick, you will have a empty line where it reads FAT32 and the sizes will all be zeros

good luck!
--
"We're all in this together..."

macsimski

and after asking the vinculum team about the power requirements i got the following reply with a interesting option:

The VNC1L will have a normal operating current of 25mA (idle and play modes)
and the SUM firmware command will put the device into suspend during which
the device will only draw a maximum of 2mA.


i just asked them about the min and max voltages the player will work. (batteries?)

ill keep you posted. but it may take a few days before i get a reply.
--
"We're all in this together..."

Go Up