Need help reading file from VMusic2
Vadoo
Posts: 92
I just brushed a couple years of dust off this project, so I have some memory refreshing to do. So lets start small.
FullDuplexSerialplus.getstr(@TempBuff[0],512)
I know this isn't right but I think it will help show what I am trying to do.
I want to read a file 512 bytes at a time, and store it in a buffer for use in other parts of the program. I have looked at a couple other objects, but don't know what I need exactly. I have found plenty of SPI objects that would work, but I'm using the UART interface...
Thanks!
FullDuplexSerialplus.getstr(@TempBuff[0],512)
I know this isn't right but I think it will help show what I am trying to do.
I want to read a file 512 bytes at a time, and store it in a buffer for use in other parts of the program. I have looked at a couple other objects, but don't know what I need exactly. I have found plenty of SPI objects that would work, but I'm using the UART interface...
Thanks!
Comments
if this doesn't hit what you want to know. Please give a more specific description of it
keep the questions coming
best regards
Stefan
Yes. But I want to read 512 bytes at a time, store it, use it, and then reload the buffer with the next 512 bytes. The file is not a zero terminating file. Its just a long line of shift register commands.
keep the questions coming
best regards
Stefan
www.ftdichip.com/Support/Documents/DataSheets/.../DS_VMUSIC2.pdf
I think this will help.
all I could find was
http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_VMUSIC2.pdf
but in this document only the spi-interface is described.
so I searched for VMusic2 source code and came up with this BASCOM-AVR basic code
http://www.surplusgizmos.com/assets/images/vmusic2/Vmusic2_demo.bas
So until now I haven't found any useful information about how to communicate via UART with the VMUSIC2 device
I guess you have already some code running
Please attach this code to a posting. I like to help but only if the starter of the thread does his "homework"
So keep the CONCRETE questions coming
best regards
Stefan
Here is something I was using at one point to play with this problem.
CON
_xinfreq = 5_000_000
_clkmode = xtal1 + pll16x
RX=25
TX=24
VAR
byte temp1[256]
long index
long temp2
long temp3
long numbyte
OBJ
VMusic2: "FullDuplexSerialplus"
PUB SYNC
numbyte := 24
VMusic2.Start(25, 24, 0, 9600)
VMusic2.str(string("OPR Data.HLX", 13))
VMusic2.str(string("RDF 24", 13))
VMusic2.getstr(@temp1, numbyte)
waitcnt(clkfreq * 4 + cnt)
VMusic2.Start(31, 30, 0, 9600)
repeat until temp1[index] == 0
VMusic2.tx(temp1[index])
waitcnt(clkfreq/10 + cnt)
index++
I have a data sheet somewhere with all of the commands for the VMusic. I'm currently searching a couple TB worth of hard drives to find it!
But all I really need for this part is the OPR command to open the file, and RDF to read the file. Then you tell it how much of the file you want to read I believe. Like I said, I'm still trying to refresh my memory
I think the problem I was running into was I could only get so much data at one time using the FullDuplexSerialplus Object.
I'm going to look over old notes and play with this a bit more and see if I can be more specific.
Go try to receive only 10 bytes and look if this is working properly.
If yes go try receiving 16 bytes.
Then 17 bytes and check if this is still working
There are modifications of the fds-driver with a larger receive-buffer. If the buffer is changed to HUB-RAM you can increase the buffer up to kilobytes.
But I don't have the modified driver handy. I remember a modified version in the obex called serial mirror which uses hub-ram. There you can increase
the receivebuffer-size and test if this solves the problem.
minimum what you should do about code is using the "[ code ] [ /code ] commands to make code look like in the propellertool with indention.
If you just cut and paste the indention gets lost and it makes the coe hard to read.
To say it very clear. You load more work than nescessary onto us (the forum-members)
If you keep this "I keep the work very short for me (and long for you)"-style I will refise to help any more.
So in the next posting I expect from you to attach your complete code to a posting using the Go advanced Button and the Attachement-Manager
And including an example of what your serial terminal-software is receiving from
and supporting what is originally stored on the usb-drive so that it will be easy for us to compare stored and received data
keep the DETAILS coming
best regards
Stefan
Thanks!
So now I'm back on trying to read the data from a thumb drive using the VMusic2 and storing it to a variable. I'm going to try using the FDSP object and see if I can read its maximum allowed bytes (which I think we decided was 16?), then I'll have to figure out how to scale it up so I can get 512 at a time to work with the full version of my program.
cogon := (cog := cognew(SHIFTout (10, 12, 11, temp) ,@stack)) >0
and:
PUB SHIFTout (Clock_pin, Latch_pin, Strobe_pin, DATA)
How can you pass on temp if temp is:
VAR
long temp[2]
I seem to be getting temp[0] only but when I try to use temp[1] from the PUB SHIFTout its empty though I know it has data stored to it. I know I'm not doing it right but I cant find the correct way to pass on temp[2] so far.
Sorry I still cant figure out the correct way to post code here. How do you use the "[ code ] [ /code ] commands?
Thanks!
You then need to treat it as an address within SHIFTout. Instead of writing out[index], you need to write byte[out][index]
Look up BYTE in the Propeller Manual for an explanation.
Ill play around with it tomorrow and see what I can come up with. I already have a much larger working program. Im just trying to modify it to work with a VMusic2. It originally worked with an sd card reader. The main issue I have is finding or making an object that can buffer 512 of a file at a time. The shiftout object is just to test it once its running, in small scale. Any objects out there with a larger buffer that can do this?
I did work on making this one much easier to read, and made notations.
Edit: Wrong file, Ill repost the correct one in a few.....
Edit: Here it is.
I have several modified versions of Tim Moore's four port serial object. One of the versions uses a 512 byte rx buffer. I've posted the objects on this thread.
Duane
Thanks Duane! Ill take a look at it in a bit. I'm still fighting to get my object to read correctly.
This is the best I have been able to do.This object is storing something to my little buffer. But not sure what. Its defiantly not playing what is in the seqnum01 file correctly.
Attached is the file I'm trying to read. It has data for controlling my 32 bit shift register board.
Anyone have any ideas?
seqnum01.spin should be seqnum01.hlx It would not let me upload it without changing the extension...
http://forums.parallax.com/showthread.php?90387-Simple-Propeller-Vinculum-Test-Program&p=620161
Post #7, Jim C posted an object that looks promising. Iv been playing with it for a bit now and so far the communication works fine, but better then that it is set up to show me everything going on through the pc terminal.
Next I will work on storing the data to an address to use for the shift register board.
Anyone have any ideas/advice yet?
I have not looked at all the files that you posted but one that I did scan had open file ,read file and close file as three consecutive instructions. In my opinion before the instructions read file and close file there should be a check to see if the prompt and $0D were received from the previous instruction. One it keeps all the instructions flowing in a timely manner and two if the prompt $0D is not received you know something went wrong and can handle the error accordingly.
Jeff T.
What about receiving data from it? How can I best store the data? It seems the way I was doing it had to many steps, and I would miss little bits of the data because I was doing too much at once in my code. I then just set it up to directly store what UARTdebug.spin saw coming from the VMusic2, to a datptr, but that gave me slightly mixed up data. It was general correct but it would have mixed up parts in it.