Simple Propeller - Vinculum Test Program
Mike Green
Posts: 23,101
Attached is a simple test program for the Vinculum in SPI mode attached to a Propeller Demo Board with a keyboard and TV monitor. It simply copies anything typed to the Vinculum (while echoing it on the display) and copies any responses from the Vinculum to the TV text display. It does translate any responses with non-displayable characters to hex, so $03 will display as {03}. A return ($0D) character is echoed directly to the display for readability.
Comments
What kind of rates, in SPI mode, can be thrown at these chips?
-Parsko
Thanks for the demo. I'm just at the point of getting the propeller to talk to the V-Flash, using UART and ASCII. With that in hand, I will now try your SPI method.
Jim C
Thanks
Here is a simple test routine for assessing the V_Drive. It is done differently from yours, in that it uses a terminal program to view the output from the V_Drive. It uses a second Full Duplex in its own cog to send commands and data to the V_Drive, set up in UART mode. I'm sure there are slicker ways, but is was a way for me to visualize what is going on.
Jim C
I understand the FTDI chip itself can handle 2 x USB ports, one Thumbdrive and one camera, stereo cameras?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I've included a copy of his driver in the archive.
·Has anyone been able to determine the fix for the Vinculm error's codes being inserted into read responses?
Perhaps, the vinculum switches the RTS·or CTS pin states before sending it's extra gibbersih data?· That might be a key to detecting the transmissions.· It may also be that software handshaking is turn on. Table 4.8 shows how to change this.
I'm expecting a Memory DataLogger this week and look forward to working with it to communicated with other devices via the prop.· I've noticed that the vinculum chip has a number of free io pins. Can these be used to·read from other devices like keyboards and mice?· Has anyone tryed using the vinculum's IO pins?··I see commands to read them (QP1 and QP2) but haven't seen anything on writing to them yet. It seems like a great way to effectively expand the number available pins for use by the prop.· Basically, with the prop using 4 pins to communicate with the vinculum via SPI, you get 20 free vinculum IO pins (pins 11-23 and pins 41-48).· This is enough for a number of perpherials perhaps even an LCD display if there are send commands as well.
UPDATE :
There is a new version of the vinculum firmware documentation...
http://www.vinculum.com/documents/fwspecs/Vinculum%20Firmware%20User%20Manual%20V2.1%20Rev%202.pdf
assuming it's the same version that the datalogger has (I don't have mine yet), there is a write command for the IO pins (command IOW in section 6.4.2).· It looks like driving a Parallel LCD and other things via SPI from the prop is very doable
Post Edited (mcstar) : 8/28/2007 5:43:48 PM GMT
I have loaded·Mike's "Test program for Vinculum and Propeller Demo Board "
I had a hard time to figure ot how to achive the following without using the keyboard
What I want to achive is·using the spin program to send the following strings instead of using the keyboard to enter the string.
Hope somebody could help on this.
I have spent many hours trying but can't figure out how to do.
I am using the Vinculum USB and it works fine using the keyboard.
Regards Goran Sweden·
· (string("IPA", CR))············ 'Input numbers as ASCII
· (string("OPW FILE.3",CR))······ 'open new file
· (string("WRF 14",CR,"Hello World!! ")) 'save 14 characters
· (string("CLF FILE.3",CR))······ 'close file
· (string("RD FILE.3", CR))······ 'read it to confirm
· (string("DLF FILE.3", CR))····· 'Delete it so it can be created again next time.
· (string("E", CR))·············· 'Synchronizing character
Your code "snippets" only show the string, not the outer call. I assume you are going to send these with a serial driver. I've been using the FullDuplexSerial driver with a music playing program. You will need some kind of pause between commands or you will need to check for the prompt (or error message) from the Vinculum chip. You could do something like this sort of framework:
Well I did not explain properly.
What I tried is to instead of the keyboard use a string inside the spin program.
Code snippet from your "Test program for Vinculum and Propeller Demo Board"
Any idea
Regards, Goran
PUB start | t, s
· dsp.start(12)·················· ' TV pin block for Demo Board
· key.start(26,27)··············· ' Keyboard pins for Demo Board
· dsp.str(string("Vinculum Test Program",EOL))
· outa[noparse][[/noparse]RESET]~··················· ' Reset device
· dira[noparse][[/noparse]RESET]~~
· outa[noparse][[/noparse]SPI_CS]~·················· ' Select normally low
· dira[noparse][[/noparse]SPI_CS]~~
· outa[noparse][[/noparse]SPI_CLK]~················· ' Clock normally low
· dira[noparse][[/noparse]SPI_CLK]~~
· dira[noparse][[/noparse]SPI_DATA]~················ ' Data initially input
· outa[noparse][[/noparse]RESET]~~
· s := 0
· waitcnt(clkfreq / 4 + cnt)····· ' Wait for 250ms initialization
· repeat
··· if s == 0···················· ' Buffer not full in Vinculum?
***********************************************************************************
Here I want to take a string for example
"IPA" from a DAT section in the spin program
and transmit this via SPI to the Vinculum chip
i.e replace the····· s := key.key··············· ' Look for typed character
with s:=(@IPA)
and send a byte at a time.
***********************************************************************************
··· if s > 0····················· ' Character pending?
····· if (transfer(false,false,s) & 1) == 0
······· dsp.out(s)··············· ' If transmitted ok, echo to display
······· s := 0··················· ' Allow another
··· if ((t := transfer(true,false,0)) & 1) == 0
····· t := t >> 1 & $FF·········· ' If character read from Vinculum
····· if t & $7F => " " or t == EOL
······· dsp.out(t)··············· ' Display all displayable characters
····· else
······· dsp.out("{")············· ' Or display hex code of others
······· dsp.hex(t,2)
······· dsp.out("}")
DAT
IPA· Byte "IPA",0
I'm trying to use your Vinculum test in SPI mode. However I'm confused by the pinouts. In the vinculum docs and the parallax document, the following pins are listed.... SDO, SDI, SCLK, and CS. However, in your code, I see RESET, SPI_CLK, SPI_DATA and SPI_CS. I can assume the following relationships. SPI_CS -> CS and SPI_CLK -> SCLK, but I'm confused by the other pins. Which DATA line is controlled by the SPI_DATA pin (SDI, or SDO)? Also, what is the RESET line? Does it go to one of the data lines? Actually, I'm a bit confused how this works at all. According to the FTDI documentation (VNC1L USB Host Controller Datasheet version 0.97 section 2.5) shows both data lines used to do a read or a write. In Read mode, SDI is shown sending a preamble of 110 before reading SDO for 8 bits. In Write mode SDI sends the preamble 100, then it sends the 8-bits... during this time, the SDO line is meaningless until after the 8th bit, then it recieves a status bit from the controller. I don't see the preambles or status handling in your code. Am I missing something, or maybe I have a different version of the Vinculum?
Update... OK, now I see the preambles. They are the bits ANDed with the data and shifted into the data variable. Sorry I missed that.· From this I can presume that the SPI_DATA pin is acutally the SDI line.· However, I don't still don't see how you are able to read data from the Vinculum. The Vinculum docs show that is it sends data on the SDO line, a differnt pin than the input data, but I don't see any code reading from a line other than the SPI_DATA line (the same one that is sending the data).· Does your chip read and write from the same data line?
Post Edited (mcstar) : 9/10/2007 3:36:24 PM GMT
·
Could you post your modified program?
I don't have a keyboard/tv either and since you appear to have a working
demo with a terminal, that should save me and others some time.
Thanks.
regards peter
I adapted your test program for the spin stamp and a terminal output,
and I have some questions regarding the transfer method.
First, since your transfer only uses SPI_DATA, I assume the Vinculum SDO connects to
Vinculum SDI via a (1k) series resistor and that Vinculum SDI connects via 1k resistor
to the prop pin SDI_DATA. Is that correct?
Secondly, the first line in transfer
· data := $800 | $400 & read | $200 & status | data << 1
and·directly after the repeat
··· dira[noparse][[/noparse]SPI_DATA] := i < 4 or i < 12 and not read
I rewrote the transfer to transfer1·where I put·brackets
to make the·order more obvious.
· data := $800 | ($400 & read) | ($200 & status) | (data << 1)
··· dira[noparse][[/noparse]SPI_DATA] := (i < 4) or ((i < 12) and (not read)) '1 for i=[noparse][[/noparse]1..3], 0 for i=12, not read for i=[noparse][[/noparse]4..11]
Is that·correct?
Third, the line
··· dira[noparse][[/noparse]SPI_DATA]~·············· ' Let data line float after hold time
is that because after the next statement (make clock low)
the Vinculum SDO output directly outputs a new bit value?
Finally, I rewrote transfer1 to transfer2 to support seperate data in and data out pins.
Is the conversion I did correct? I commented out statements I think are no longer required.
regards peter
and a terminal program.
regards peter
to the hub. That appears to work. I just wonder what happens
when I connect 2 usb sticks.
Anybody tried that out? Is there a command to change drive?
(I don't have 2 usb sticks. Normally under DOS, one would use E: to change drive
but since E is an echo command that probably won't work.)
regards peter
The Vinculum's SPI timing is such that it never uses the data-in and data-out lines at the same time, so, to save I/O pins, I decided to just connect the two together and write the low level routine so it worked with that. I have done the same routine with the signals separated as you've done it and it does indeed work fine.
When I was debugging the routines, I used 1K resistors. After I was comfortable with how it all worked, I left them out. The Vinculum is a 3.3V logic / 5V tolerant chip so it doesn't require them and the timing diagrams are very clear about who talks when.