help with USB datalogger 27937
matthew2
Posts: 5
I'm trying to set up an application that can log data locally when it wants to using the Parallax Memory Datalogger #27937. Currently I am using the code which is available on the Parallax Object Exchange, USBdrive and FullDuplexSerial (I am trying to take advantage of the UART communication mode in order to later combine it with the other UARTs I already have running).
However, I'm at a standstill and am not sure what is going wrong. I currently have the setup as follows:
27937 pin list
Pin 1 Vss
GND
Pin 2 RTS#
1K pulldown to GND and Pin 18
Pin 3 Vdd
Vcc, 5V
Pin 4 RXD
Pin 20
Pin 5 TXD
Pin 21
Pin 6 CTS
1K pulldown to GND and Pin 19
Pin 7 NC floating
Pin 8 RI floating
The problem is that the start function in USBdrive.spin doesn't pass the BigE (transmitting a serial E and reading it back, which is in the USBdrive file) test. I can't figure out what I'm doing wrong, does anyone have any suggestions?
However, I'm at a standstill and am not sure what is going wrong. I currently have the setup as follows:
27937 pin list
Pin 1 Vss
GND
Pin 2 RTS#
1K pulldown to GND and Pin 18
Pin 3 Vdd
Vcc, 5V
Pin 4 RXD
Pin 20
Pin 5 TXD
Pin 21
Pin 6 CTS
1K pulldown to GND and Pin 19
Pin 7 NC floating
Pin 8 RI floating
The problem is that the start function in USBdrive.spin doesn't pass the BigE (transmitting a serial E and reading it back, which is in the USBdrive file) test. I can't figure out what I'm doing wrong, does anyone have any suggestions?
Comments
I think its 2gig limit on the drive. Fat 16 is 2 gigs right? If its to big the drive will simpily·not respond. Also it doesnt work·with the dumb scan·disk ones from radio shack, becasue they have the weird 2 drive mount thing. It mounts the wrong·one. That annoying install this software one....
TJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
I've got the Datalogger recognizing the USB and giving me the ok-to-go red light. Now, I'm trying to open a file "Test.txt" and writing "Hello world" to it.
The functions that I use to do this; open, write, and close, all return TRUE but there is no data to be found on the USB when I plug it into my computer.
The red led does flash when I run the code, signifying there is data transfer from the propeller to the datalogger.
Is it possibly the formatting of the USB? It's a 2GB kingston drive that I have formatted to Fat32
Post Edited (matthew2) : 4/8/2009 7:36:13 PM GMT
I didn't have time to dig into it any further but if you get a program running that WILL let you read and write data to a flash drive and also allow you to open it on the PC... Please post the code. If I get back on the project and get it working, I'll do the same.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
" Anything worth doing... is worth overdoing. "
··············································· ( R.A.H. )
····································
Try some other tests like creating a file. I also suggest that you go to Vinculums site and download the manual for the firmware you are using.
I thought that Green meant ready on the Vmusic2, maybe your device is different.
Do post the code you are using.
Oh, you definitely have to make sure you are using the correct modes, i.e. hex, ascii, Extended, Short, etc. I forget the default input modes but I think it is Extended on boot. If you are sending it commands in one mode and it is in another, there will be problems.
What is provided in the code to monitor the Vinculum 'monitor'? You need a TV or LCD at a minimum.
Here is code I use on the Vmusic2, very similar to the Vdap. The code is for the 4 port so the "2" is for port 2, ignore that.
Code that works to open a file:
Post Edited (TChapman) : 4/8/2009 8:25:15 PM GMT
My result is that FAT 32 doesn't work!
Same code same stick (i tested Kingston 1 GByte and Imation 512MByte)
Formated as FAT16 (workings so la'la) FAT 32 not working. There is some comunication between the stick and the
Vinculum, i can read data, bit i am not able to write a file on FAT32!
I am now waiting (or hoping) for a new better firmware for the Vinculum, bit i am not very optimistic.
Regards
Markus Greim
Germany
i am using the
Datalogger SPI mode
object from
/* December 24, 2007 v1.0: Initial release.
* @author Peter Verkaik (verkaik6@zonnet.nl)
*/
from the PObject Exchange.
My own code is
/********************************************************************************/
PUB usbschreiben
logger.DataloggerSPI(SPI_CS,SPI_CLK,SPI_SDI,SPI_SDO)
waitcnt(clkfreq / 4 + cnt) ' Wait for 250ms initialization
logger.receivePromptOrError(2000) ' get unsollicited message from datalogger
if logger.diskPresent
if logger.changeDirectory(string("\"))
''text.str(string("creating testdir and testfile.txt ..."))
if logger.changeDirectory(string("SCHLUS"))
if logger.openFileForWrite(string("TESTFILE.TXT"),0)
if logger.writeToFile(@demobuf,strsize(@demobuf),0)
psaver := 0
if logger.closeFile(string("TESTFILE.TXT"))
return 1
else
text.out(home)
text.str(string("file write error"))
else
text.out(home)
text.str(string("file not op. f. write"))
else
text.out(home)
''text.str(string("not moved to dir"))
else
logger.makeDirectory(string("SCHLUS"),0)
text.out(home)
text.str(string("directory created"))
return 0
/*************************************************************/
This works as written with FAT16 but not with FAT32.
Any ideas why???
Regards
Markus
I have been trying for over two weeks now to communicate with the 27937 memory stick datalogger from Parallax. I bought three of the modules and all three modules I have had no success. I do not however believe it is a problem with the modules themselves.
I tried the code from the object exchange (only the UART versions as I would have this as my preferred means of communication) and I have had no success.
I have purchased two of the memory cards that are on the list of suggested memoty stick to use and still nothing.
I have tried many of the suggestions in the forum ie 1K pull down resistors on the handshaking lines and inline 1K resistor with the loggers TX pin, still nothing.
I then decided to write my own code that will "talk" to the memory stick data logger and record all the information that comes back from the logger and it still has not solved my problem. I used the capture text feature in Hyperterminal to record the data in a text file.
I have attached the text file that I have received in the hyperterminal windown from the logger and also the code I used to "generate" the responses. I know that there is a distinct lack of "handshaking" between the propeller chip and the datalogger.
Any help, comments questions, queries would be greatly appreciated.
I don't know about the Parallax version you bought, but the Vinculum must be programmed with firmware if not buying it preloaded. Maybe Parallax preloaded the part you have. If not, it will need the latest FW off their site, I use Vmusic firmware, forget the actual name but it operates basically the same as VDAP awith more commands related to music.
I think you are having problems confusing how to send hex and strings to talk to it, but that's just my guess at first glance. Try using .tx whyen using a hex value, and using .str when using "x" ascii values. It should boot on ECS and IPH. Leave it on IPH (hex) as default, I think I had problems until I started using ECS and IPH. Forget ASCII mode IMO! Just reboot the device with no need to send it any setup, and it will default to ECS and IPH. Communicate as in my code and test it out. .TX for hex values, .STR for ascii values, yes you cvan send ascii values for commands even though you are in hex(IPH), but you need to send hex values for information like data, values etc.
I will post code below that definitely works in ECS and IPH. After detecting the drive with a / response, you should easily be able to test the drive with a write to file, specify the size of data to be written, specify with SEK where to write it or it will append the data. Maybe do a test and write to file some values, then put the drive in a computer to see if it got written. Then start trying to read from file(set the length to read). Skip making dir for now until you can work in the main dir, if you can read and write the main dir then you don't need top try to tackle making and changing directories. Ignore the number 2 in my code, it just specifies a serial port on a 4 port serial, just a 4 port version of full duplex which requires you to state the port. Your code will drop the #2.
Various USB code:
Below is an actual method that reads from the drive, I took out other unimportant parts:
Post Edited (TChapman) : 4/29/2009 7:02:26 PM GMT
Thanks for the info. it was very useful.
I am now faced with a new problem (just my luck eh) I am trying to write a simple file and I keep getting "DISK FULL". I think that is better than a "Command Failed" error at least.
So I change the code to make it like a DOS prompt interface and I checked the IDD command result and I noticed two things;
1) there is no information for the "FAT" formart coming back from the logger
and
2) both the Capacity and the Free space are "$00000000 Bytes"
(as per data sheet for the Vinculum VNC1L datasheet verion 1.07 table 4.3 pg 14)
I tried formating the memory sticks in FAT32 and FAT format ( the only other option I get through Windows XP) and I got the same result. Obviously I check the disk on my laptop and it is blank. I do a properties check from the "My Computer" location and I see that is has bytes free. I also tried the "chkdsk x: /f" in the command prompt and still nothing.
I am at a lost as to how I can resolve this issue.
here is the result I get from the IDD command.
for my transcend stick
IDD
USB VID = $058F
USB PID = $6387
Vendor Id = JetFlash
Product Id = Transcend 2GB
Revision Level = 8.07
I/F = SCSI
Bytes/Sector = $0200
Bytes/Cluster = $000000
Capacity = $00000000 Bytes
Free Space = $00000000 Bytes
\>
for my Kingston stick
IDD
USB VID = $0951
USB PID = $1625
Vendor Id = Kingston
Product Id = DT 101 II
Revision Level = 1.00
I/F = SCSI
Bytes/Sector = $0200
Bytes/Cluster = $000000
Capacity = $00000000 Bytes
Free Space = $00000000 Bytes
\>
Can anyone help?
Sabre00...
Are you getting a sync with E and e?
Can you get a response with CR?
Have you powered up the device with the new code you are sending?
If you can get a response / from a command CR, then try creating a small .eeprom file from any spin file Proptools where you can read in the info area what the first 16 bytes are. rename the file as anyhing you want, 'test' is fine, put the file onto the USB drive. Then do a Open File, then read 16 bytes of the the file into an array that can be displayed on LCD or terminal. Find out if you can even read from the device and compare that to the eeprom file first 16 bytes, then move towards writing the drive.
Post Edited (TChapman) : 4/30/2009 7:35:58 PM GMT
I am getting the E and e syncs.
After I have gone through the synchronization when I press enter (CR) I do get the > prompt. It can be seen from the information I sent above that the prompt is also received after the information for the IDD commands were sent.
I am just using the Hyperterminal program to enter the commands directly into the datalogger. The code does not have any software echoes, that is done by echoing the characters locally within Hyperterminal. So there is no code that does the "IDD<CR>" command automatically. When I enter "OPW test.txt <CR>", I get the "DISK FULL" comment. I kept trying other commands and that is when I saw the strange Capacity 0 and available bytes 0.
I will attach the code anyway to show you what I did.
Sabre00...
<CR> stands for carriage return or simply enter
From what you are describing since I can't see what is actually taking place on the terminal, it looks like you are not specifying the size to write after OPR. I never bother with CTS, RTS etc.
Here is some code I was testing to read and write to the drive. Put some data in the array MonitorUSBbuffer[noparse][[/noparse]64], first few slots is fine just to be able to look at the drive manually later if needed from a PC to check it. In the case below, if you are testing using startaddr always as '0', the data will continue to write and read at the same location. If using -1 it will append.
I suggest using objects for display like TV, LCD, or other means to read the results other than hyperterminal.
Post Edited (TChapman) : 5/1/2009 2:31:44 AM GMT