Shop OBEX P1 Docs P2 Docs Learn Events
anyone using VDive2 by Viniculum? — Parallax Forums

anyone using VDive2 by Viniculum?

sdysdy Posts: 40
edited 2007-03-18 05:23 in BASIC Stamp
I just got one, but can't get anything out of it. But once when I put in my USB memory stick, it blinked green, like when you plug it in a PC.
I have it configed for UART mode.
Here's my code: ( It just waits at "Rcving from VDRIVE" )
' {$STAMP BS2p}
' {$PBASIC 2.5}

ToVdrive CON 13 ' VDRIVE RxD pin 4 on P13
FromVdrive CON 14 ' VDRIVE TxD pin 5 on P14
Rts CON 11 ' VDRIVE RTS pin 2 on P11
Cts CON 15 ' VDRIVE CTS pin 6 on P15

Vbaud CON 16624

Value VAR Byte ' Data from VDRIVE
DO
'WRITE TO VDRIVE:

' send command:
SEROUT ToVdrive \Cts,Vbaud,[noparse][[/noparse]"DIR",CR]


'READ FROM VDRIVE:
DEBUG "Rcving from VDRIVE:",CR

' read data:
SERIN FromVdrive \Rts, Vbaud, [noparse][[/noparse]Value]
DEBUG "Data from VDRIVE = ", Value ,CR


LOOP

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-11 22:32
    Hi sdy, I have a Vdrive talking to a BS2, I see a couple of things in your·setup that are different. I did not use hardware handshaking so I left RTS disconnected and CTS tied to vss. The baud you are using is inverted, you should be using true (a value of 240 for your baud rate). I have better results setting input mode to ascii and is the first command I send (SEROUT tx,baud,[noparse][[/noparse]"IPA",$0D]). The Vdif firmware literature has errors and some missing information, use the Vdap firmware literature for reference. Using the DIR command is tricky because of the amount and the format of the information returned. What I do to confirm communication is run the shortened command set and after each command sent I wait for the prompt (">") which signals good communication.

    If you have the TTL-232-V3V USB to ttl serial cable I have a Visual Basic program that evaluates the Vdrive allowing you to become familiar before connecting it to a Stamp.

    Jeff T.
  • sdysdy Posts: 40
    edited 2007-03-11 23:43
    Hey, thanks loads for your reply. Let me play with your suggestions and I'll get back to you real soon. Where can I get that TTL-232-V3V USB to ttl serial cable?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-11 23:50
    By the way, the green blinking when you insert a USB drive is the VDRIVE2 mounting the drive and trying to send some configuation messages to the Stamp.
  • sdysdy Posts: 40
    edited 2007-03-12 00:03
    Here's what I changed to, but no response. It waitts at "Rcving from VDRIVE:". See anything?:
    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}

    ' VDRIVE CTS pin 6 to Vcc
    ToVdrive CON 13 ' VDRIVE RxD pin 4 on P13
    FromVdrive CON 14 ' VDRIVE TxD pin 5 on P14
    ' VDRIVE RTS pin 2 not connected
    ' pin 3 to Vcc
    ' pin 1 TO gnd

    Vbaud CON 240

    Value VAR Byte ' Data from VDRIVE

    'WRITE TO VDRIVE:

    ' send command:
    SEROUT 13 ,Vbaud,[noparse][[/noparse]"IPA",$0D]
    SEROUT 13 ,Vbaud,[noparse][[/noparse]"SCS",$0D]
    SEROUT 13 ,Vbaud,[noparse][[/noparse]CR]

    DO
    'READ FROM VDRIVE:
    DEBUG "Rcving from VDRIVE:",CR

    ' read data:
    SERIN 14 , Vbaud, [noparse][[/noparse]Value]
    DEBUG "Data from VDRIVE = ", Value ,CR

    LOOP
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-12 00:23
    Hi sdy, I ordered the cable from FTDI's web shop and·it was shipped from Oregon. The VB app really helped me understand but it's not completely necessary. The best thing to do in my opinion is start with the simplest command which I thought was to create a directory. I attach code that works for me see if it will work on your set up. My file has·the BS2 extension I don't have the BS2p

    Jeff T.

    Re-read your code....CTS should be connected to VSS, the code I supplied also has different tx/rx pin assignments.
    sdy said...
    ' VDRIVE CTS pin 6 to Vcc
    Post Edited (Unsoundcode) : 3/12/2007 12:45:23 AM GMT
  • sdysdy Posts: 40
    edited 2007-03-12 03:09
    Thanks, it's late. I'll look at tommorrow.
  • sdysdy Posts: 40
    edited 2007-03-12 22:14
    Tried your code, still nothing. jumper pulls UART/SPI to 3V3OUT, Vdrive-8 is not connected, -6(CTS) to Vss, -5(TxD) to P0, -4(RxD) to P1, -3(5V0) to Vdd, -2(RTS) not connected, -1(gnd) to Vss.
    About the LEDs: When I powerup Vdrive, blinks red/green/red/green, then goes out. Never goes on agian. When I insert USB memory stick, nothing, (tried two). Only once did the drivre and USB stick blink like it was being mounted. What does your's do?
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-12 22:36
    Hi sdy, jumper should be set to UART/SPI and·GND all your other connections are as I have them.·Power up is correct, it blinks once or twice then remains off. When you insert the memory stick it will blink a short time (several seconds if you have a large memory stick) while it reads the card loking for a firmware upgrade, when it stops its ready to recieve data commands.

    I have a switch in line with the positive to pin 3, some commands if sent badly will·cause the drive to lock up, and I found it convenient to be able to have a switch to do a reset.

    Jeff T.
  • sdysdy Posts: 40
    edited 2007-03-12 22:54
    Well alright!!! UART/SPI to GND? That did it, but data sheet says pull-up serial UART, pull down SPI. Go figure.
    Man I owe you!!! Whats your background? I'm just an old hobbiest programmer. Every new language interests me.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-12 23:13
    Hi sdy, like I said there are one or two errors or information that is difficult to glean·in the firmware literature.

    I too am a (old)hobbyist who knows little about everything but its fun.

    Glad your up and running, I am sure you will want to explore and discover the Vdrive Stamp combination in your own time but if you·need help with any of the functions PM me.

    Jeff T.
  • sdysdy Posts: 40
    edited 2007-03-12 23:45
    Thanks again. Want to try something neat: Google on FIRST Robotics. Being a mentor for the electronics is what got me into all this.
  • viskrviskr Posts: 34
    edited 2007-03-18 01:46
    I hooked up an RS-232 converter to try to run thru the commands and see what was going on.

    here's the turn on message (takes a number of seconds to check for update)

    Ver 02.08VDAPF On-Line:
    Device Detected P2
    No Upgrade
    D:\>

    And yes I agree the document has SPI/UART reversed.

    DIR works
    OPW seemed to work, though
    when I tried to WRF 000A
    and entered some data, the LED started flashing and it looks like it was kind of unhappy, seemed to be hung up

    At some point I really want to get the SPI version going, though its easier to debug in the long command serial state

    also you get a message when you remove a device--

    Device Removed P2
    No Disk

    and when reinserted--

    Device Detected P2
    No Upgrade
    D:\>
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-18 03:53
    Hi Bruce, I can't help with the SPI that is something I need to read up on but I can help with the Uart commands if you ever need.

    If you have a 232 converter you might find this VB app useful for debugging, I never finished programming it so it has flaws but its complete enough to be useful. It allows entry in short or extended command

    Jeff T.
  • viskrviskr Posts: 34
    edited 2007-03-18 04:05
    Hi Jeff

    thanks for that, were you able to get read or write working?

    I was able to look at directories, and open a file for reading, but RDF seemed to ignor the length field and it dumped the whole file each time

    As for WRF, I never was able to get it to write. I could OPW, but the WRF would turn the write indicator on on the USB drive, but not write anything out, and basically hang (had to reset by powering off)

    just got a clue though, looks like FS returns a number in hex, but its not an ASCII #, seems like is a binary field

    I can't type that in thru my terminal emulator, so have to switch back to the MPU
  • T ChapT Chap Posts: 4,223
    edited 2007-03-18 04:20
    I was going to order these, has anyone really ever gotten one to work? Seems an errata sheet needs to be posted and updated.

    Post Edited (originator) : 3/18/2007 4:46:28 AM GMT
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-18 05:23
    Hi Bruce, I have successfully·tested all the read write commands. I wrote two test programs, one that was primarily for reading, and one that was a little more difficult that logged and wrote data to a CSV file. The programs were simple in the respect I did not have to worry about file sizes etc. which was less for my programs to be concerned with.

    Try reading first, create a Notepad file on the thumbdrive from your PC with a short string as the text (Hello World comes to mind) and save it as test.txt then rename it to test. Then put it in the Vdrive and read it.

    rd_file:
    SEROUT tx,baud,[noparse][[/noparse]$4,$20,"test",$0D]
    SERIN rx,baud,200,bad_data,[noparse][[/noparse]STR string\15\">"]
    DEBUG· STR string
    RETURN

    I used the timeout to bad_data if I did not get the prompt back, the string needs to be less than 15 characters. I expanded the above example to contain user data (firstname lastname logtime) displayed on the swipe of a RFID tag #.

    When I logged and wrote data I jumped out of a loop at each sample to the subroutine.The character size would alter so I had to place two variables in the write string. The first (c) is the character length of the data (for example datavalue 220·then c would=3 characters) and the second (b) is the actual data.

    SEROUT tx,baud,[noparse][[/noparse]$8,$20,0,0,0,DEC c,$0D,DEC b,$0D]
    SERIN rx,baud,1000,bad_data,[noparse][[/noparse]WAIT (">")]
    RETURN

    The write file was opened before the write and wasn't closed until logging had ended. The data from the above example was charted on an Excel Workbook.

    hope it helps

    Jeff T.
Sign In or Register to comment.