View Full Version : Help with USB memory stick datalogger

06-05-2010, 08:51 AM

So, I'm trying to get the USB memory stick datalogger(27937) to work with my propeller chip. Where to start...

So far Ive tried·a few different·objects from the obex·to communicate with it. Ive tried both UART and SPI drivers. So far none of them have gotten through to the USB stick.

With the DataloggerSPI_test set the way it looks the pin assignments are supposed to be·I just get the intro·message and the red light on indefinetly. With the In and out pins flipped I get the intro message and "No disk present. Please insert Disk." and the red light on.

With AutoDatalogger_test I always get:
"AutoDatalogger Test ...
Starting Test..."
with the alternating red and green lights.

Basically the same sort of thing from any object I try; it never gets past the initialization parts in the beginning.

I've also tried a few different USB sticks of various sizes from 32MB to 4GB big. Ive tried formatting the drives to both FAT32 or FAT(default) and also the allocation size at the default and also at 512 bytes(which one of the objects suggested).

One thing I am a bit worried about is that I may have tried running it with the pin assignments for·IN and·OUT flipped. It may have also been running with a SPI object and the datalogger's jumper on UART. I dont know if either of these situations (or any?)·can damage the datalogger?

As far as the hardware goes I didnt put it together, but I traced the circuits and I dont think that there are any resistors between the prop and the datalogger. I've read both ways; that it does or doesnt need any resistors. I havent tried to put any in because the circuits have been wired together until the datalogger so there isnt really an easy way to add resistors. Ive checked continuity between the prop and the pins on the datalogger and it all looks fine.

Thats everything I can think of right now. Im new to microcontrollers, so Im lost about what to do. I got it to read in data from adc's and I was hoping that·getting the USB working would go as easily. :\

Any help would be greatly appreciated.

06-05-2010, 11:33 AM
Hi Jemartin,

Try the http://obex.parallax.com/objects/542/·DataLogger_UART object. I use this regularly these days in a {C328 camera / uOLED128 / MLX90614 / Datalogger} project without any problem.·It is practically bulletproof, but not wireing-proof. If it will not work at your site, please post the picture of your circuit, to find the problem.




Intentionally Left Blank

06-05-2010, 08:55 PM
I have the same problem.... The only object that workes perfectly is the one that Istvan says but the problem is that it is too big.. when i add the object to my project i have a lack of 300 longs and when is not i have about 1800 free..... Is there any working driver that doesnt need so much space and has basic data handling and reading in a file ???

06-05-2010, 09:38 PM

Here are the pin assignments from a working Camera/MLX90614/uOLED/DataLogger project

------------------------------Pin assignements----------------------------
Tx on the Propeller must be connected to Rx on the Datalogger, Rx on the
Propeller to Tx on the Datalogger, similarly CTS and RTS also must be

' On Propeller On Memory Stick Datalogger
'------------------------------------- ----------------------------------
'Symbol IOP# Function Symbol Pin IO Function
_RNG = 4 'Out Ring --> RI 8 In Ring Indicator
_RTS = 5 'Out Request To Send --> CTS 6 In Clear To Send
_RX = 6 ' In Receive data <-- TXD 5 Out Transmit data
_TX = 7 'Out Transmit data --> RXD 4 In Receive data
_CTS = 8 ' In Clear To Send <-- RTS 2 Out Request To Send
_RES = 9 'Out Reset --> Reset R In Reset VNC1L-1A

and you can see the schematics in the 1st attachment. The other attachments show the actual connections.


Thanks for using the driver. OK. Let's make a lite version. Let me know what are the basic features useful for your application and I can help by making a Lite version of the DatLogger UART object.




Intentionally Left Blank

T Chap
06-05-2010, 09:43 PM
Koxe85, what app are you using to compile and program? BST might give you some advantages using the optimization option.

06-06-2010, 12:47 AM
Todd : I am using Propeller Tool i know nothing about optimazation option!!!

cessnapilot : I want to use datalogger with sensirion and a tvgraphics· driver to display daily temperatures and save them to the datalogger (record, time, temperature humidity) and transfer same values from a distant propeller with RF to the same csv file ( temperature2, humidity2)·, so i only need basic csv writing and reading lines. THANK YOU VERY MUCH! (It is a Uni project).

T Chap
06-06-2010, 01:40 AM
www.fnarfbargle.com/bst/Latest/ (http://www.fnarfbargle.com/bst/Latest/)

Go there and get BST for your platform. It has several options you can check for optimizing the compiled file, very simple to use and will chop off a lot of longs from your program. Use "Generic Safe Optimisations" and "Eliminate Unused Spin Methods"

You don't really have to use an obj. I use the Vinculum and VMUSIC firmware and it is fairly easy to make up your own read/write methods to accomplish what you want to do. Basically you just open a file to read or write, then write/read the data and close the file. You may be having an issue with which protocol to use for communication. I recommend ECS and HEX which is the default boot up ( at least on VMUSIC it is).

You can also use a 4port Full Duplex Serial object, which will allow you to use 4 different sets of i/o on one object, this will save you some room also. See the obj xchange for 4port serial. Make sure you are at the right baud.

I highly recommend you download the Vinculum manual and read it over.

Some examples you can use without an object:

PUB OpenFile(filename)
ser.str(2, string("OPR"))
ser.tx(2, $20)
ser.str(2, filename)
ser.tx(2, $0D)

PUB CloseFile(cfname)
ser.str(2, string("CLF"))
ser.tx(2, $20)
ser.str(2, cfname)
ser.tx(2, $0D)

PUB ReadFile(readlen)
rd4 := readlen >> 24
rd3 := readlen >> 16
rd2 := readlen >> 8
rd1 := readlen

ser.str(2, string("RDF"))

Pub Seek(s) 'seek to a specific location within an already open for read file
sekval := s 'sekval is long, destination to seek for read start
ser.hex(3, sekval, 4)
sek4 := sekval >> 24
sek3 := sekval >> 16
sek2 := sekval >> 8
sek1 := sekval
ser.str(2, string("SEK"))

PUB OpenFileToWrite(filename) 'open or create file
'ser.str(2, string("OPW"))
ser.tx(2, $4F) 'O
ser.tx(2, $50) 'P
ser.tx(2, $57) 'W
ser.tx(2, $20)
ser.str(2, filename)
ser.tx(2, $0D)

PUB WriteFileSize(size) '4 bytes specifies size of data to follow in WriteData
wr4 := size >> 24
wr3 := size >> 16
wr2 := size >> 8
wr1 := size
ser.str(2, string("WRF"))

PUB WriteData(size, pointer) | g, o 'send the data part of WriteFile
g := 0
repeat size
'ser.tx(2, testbyte[g])
ser.tx(2, byte[pointer][g])

PUB readusb(size) | m, v, t, check
t := 0
w(500_000) 'delay required else usb hangs
m := 0
Repeat until t == size '<<<<<warning flag leave at 64
v := ser.rxtime(2, 200) ' (z, 100) 'read more, port 0, wait 2 ms if no byte
If v == -1
Return -1
ResponseArray1[m] := v
if check < 54 'detect/remove previous vinculum response left overs if below first 54 bytes
if ResponseArray1[m - 3] == $5C 'vinc left over info string
if ResponseArray1[m - 2] == $3E 'vinc left over info string
if ResponseArray1[m - 1] == $0D 'vinc left over info string
m := 0 'reset all if old string rec'd
t := 0 'reset all if old string rec'd
check := 0 'reset all if old string rec'd

PUB eSync | y
repeat until y == $45
ser.str(2, string("E")) 'returns $45
ser.tx(2, $0D)
y := ser.rx(2)
waitcnt(500_000 + cnt)
repeat until y == $65
ser.str(2, string("e")) 'returns $65
ser.tx(2, $0D)
y := ser.rx(2)
waitcnt(500_000 + cnt)

PUB ReadFileFromUSB(size, startaddr, filename) 'how to set to read if above 64bytes?
'if size is greater than current file size, device pads FE
ser.str(3, filename)
if startaddr > -1
ReadFile(size) 'read the file at start, using readsize
WritePage(eeprom2, eepromwriteindex, @ResponseArray1, size) 'for writing to eeprom

PUB WriteFileToUSB(size, startaddr,filename) 'open and write a file
'ser.str(3, string("Writing USB"))
OpenFileToWrite(filename) 'open or create file
if startaddr > -1
WriteFileSize(size) 'hex size we are going to send
WriteData(size, @USBbuffer)

PUB MakeDir
ser.str(2, string("MKD CCC"))
ser.tx(2, CR)

ser.str(2, string("DIR"))
ser.tx(2, CR)

PUB cdup
ser.str(2, string("CD"))
ser.tx(2, $20)
ser.tx(2, $2E)
ser.tx(2, $2E)
ser.tx(2, CR)

Post Edited (Todd Chapman) : 6/5/2010 6:46:39 PM GMT

06-07-2010, 01:30 AM
Superb!! that tool saved me a lot off space but i added a few more options on the optimasation tab. Thank you