|
|
View previous topic :: View next topic |
Author |
Message |
satish.drm
Joined: 25 May 2013 Posts: 7 Location: vizag
|
problem with vdrive2 spi mode data transfer |
Posted: Mon Jun 03, 2013 12:59 am |
|
|
hi all
I successfully transfered the data from MC to USB flash drive using VRIVE2 in UART mode. But i need to transfer the data in SPI mode. Anyone have any example codes in C? or any idea on this topic please tell me how can i go through this?? please help on this topic.
Thanks & Best regards
Kasi Arsavelli |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Mon Jun 03, 2013 5:41 am |
|
|
Having used those chips for awhile , in UART mode, I have to ask why go to SPI mode?
Right now you have working code, simple interface(2 pins,maybe 3) and reasonable speed( I'm using 115k200 baud).You can get 3M baud though!
With SPI you'll need to cut driver code,use more pins(4) ,perhaps get faster speed.
So I'd just like to know why SPI ?
jay' |
|
|
satish.drm
Joined: 25 May 2013 Posts: 7 Location: vizag
|
|
Posted: Tue Jun 04, 2013 12:24 am |
|
|
thanks for reply
I just want to test with SPI mode also, and my application occupies my two UART functions so i need to drive this VDRIVE2 in SPI mode only. Please tell me any changes that i need to do to connect it in SPI mode.
Thanks & Regards
Satish Kumar. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Tue Jun 04, 2013 1:42 am |
|
|
OK. You have a sensible 'reason' to want to use SPI.
Unfortunately the Vdrive SPI interface is very awkward to drive.
It is closer to the way I2C works than standard SPI. There is a dummy '1' sent, then the next bit sent signifies the 'direction' (rather like the LSb in I2C), then the next bit is used to signify data/address. Then for reading there are eight dummy bits clocked, while for writing there is the data. After the main transfer one more clock reads a status bit to verify acceptance of the transfer.
Since it uses twelve clocks for a transfer, software SPI has to be used.
On the returned data, you have to check the bottom bit, to verify that the data is OK, or read again if not, and once this is OK, rotate the value one bit to get the 8bit number.
When sending you have to multiply the value to send by two, add the address bit above this, and then two ones above this to say you want a write transaction.
SPI on this, is very much harder than serial.
Unfortunately, unlike most chips using odd data packet lengths (Texas and Motorola have several), where, once the required transfer 'count' is done, the device ignores extra clocks, so you can feed them off (for instance) 16 clocks, while the devices uses 12, the FTDI unit does not do this.
It is actually easier and faster to use something like an I2C UART, than to get this to work!.
If you really feel you 'must' go this way, then I'll see if I can find some old stuff I did trying this, but I decided performance was so poor, that I switched to adding another PIC, to give an extra UART.
It is funny, since most of the device is good, but the SPI is the exception. It behaves rather like it is a simple section of a gate array setup to clock out/in the single bytes, without any attempt to actually make the interface easy to use.
Best Wishes |
|
|
satish.drm
Joined: 25 May 2013 Posts: 7 Location: vizag
|
|
Posted: Tue Jun 04, 2013 10:38 pm |
|
|
Thanks for giving me this stuff.
I agree with you, it is very difficult process to run in SPI mode. I tried it but its fail to connect to monitor. The LED flasher red and green for 2sec after it gets off. I think it means there is a problem with SPI clock. So I decided to go with UART only. So, please guide me to change FIRMWARE to set my baudrate to 115200. What are the needs to get this baudrate??
Thanks & Regards
Satish Kumar |
|
|
satish.drm
Joined: 25 May 2013 Posts: 7 Location: vizag
|
|
Posted: Thu Jun 06, 2013 12:03 am |
|
|
hi
I successfully configured and upgraded my VDRIVE2. But, i have one more doubt on vdrive2 SPI mode. Can we transfer entire FILE from SPI lines to USB flash drive instead of creating file through COMMANDS?? If can please give me any idea to do like that.
Thanks & Regards
Satish Kumar |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|