Reply by Peter Dickerson February 26, 20072007-02-26
"jhelm" <jhelm@ufl.edu> wrote in message 
news:9aidnWo9mMehmX_YnZ2dnUVZ_oipnZ2d@giganews.com...
> >On 10 Oct 2006 08:15:27 -0700, "Mercy" <mercy.chang@gmail.com> wrote: >> >>>Hi all, >>> >>>Any advice/pointers or instructions would be most helpful. I am still >>>a newbie at embedded design so please humor me. >>> >>>I have a datalogger module written using an Atmel 8051. I want to add >>>a USB port to it so I can simply plug in a USB flash drive and have the >>>data automatically downloaded as a formatted text file. >>> >>>I have read www.usb.org... but I still don't know where to start. If >>>someone could point me to an online resource or a book... preferrably >>>something with similiar applications... that'd be great! >> >> >>Life is too short to do this yourself. >> >>Use one of these : >>http://www.vinculum.com/ >> >>Or these : >>http://www.ghielectronics.com/details.php?id=1 >> > > Has anyone actually gotten one of these things to work?? I'm trying to > read a USB flash drive using the VDIP( Vinculum w/ VDAP firmware) through > a UART port on an MSP430F1611. > > The code below is supposed to generate an interupt to when CTS#(referenced > from the uP) is asserted. The interupt asserts RTS#, and waits for the > character to come into the RX Buffer. The character is then stored into > memory. The code is also supposed to transmit a <CR> to the VDIP, this > would generate a response saying that a USB devices is or in not > connected. > > The there are two problems I have noticed so far. For transmitting a > character to the VDIP, I assert the RTS# and wait for CTS# to be asserted. > Before sending a character to the VDIP over the UART. However CTS# never > goes high. The second problem is that nothing is ever recieved from the > VDIP because CTS# never goes high. And so nothingis ever transmited or > received.
Well 'asserted' for CTS# would be low, not high. [snip] Peter
Reply by jhelm February 25, 20072007-02-25
>On 10 Oct 2006 08:15:27 -0700, "Mercy" <mercy.chang@gmail.com> wrote: > >>Hi all, >> >>Any advice/pointers or instructions would be most helpful. I am still >>a newbie at embedded design so please humor me. >> >>I have a datalogger module written using an Atmel 8051. I want to add >>a USB port to it so I can simply plug in a USB flash drive and have the >>data automatically downloaded as a formatted text file. >> >>I have read www.usb.org... but I still don't know where to start. If >>someone could point me to an online resource or a book... preferrably >>something with similiar applications... that'd be great! > > >Life is too short to do this yourself. > >Use one of these : >http://www.vinculum.com/ > >Or these : >http://www.ghielectronics.com/details.php?id=1 >
Has anyone actually gotten one of these things to work?? I'm trying to read a USB flash drive using the VDIP( Vinculum w/ VDAP firmware) through a UART port on an MSP430F1611. The code below is supposed to generate an interupt to when CTS#(referenced from the uP) is asserted. The interupt asserts RTS#, and waits for the character to come into the RX Buffer. The character is then stored into memory. The code is also supposed to transmit a <CR> to the VDIP, this would generate a response saying that a USB devices is or in not connected. The there are two problems I have noticed so far. For transmitting a character to the VDIP, I assert the RTS# and wait for CTS# to be asserted. Before sending a character to the VDIP over the UART. However CTS# never goes high. The second problem is that nothing is ever recieved from the VDIP because CTS# never goes high. And so nothingis ever transmited or received. The code that I'm to use to communicate with the VDIP is shown below. ;---------------------------------------------------------------------------- ; Initialization Sequence #include <msp430x14x.h> ORG 01100h RESET mov.w #0A00h,SP ; Initialize stackpointer StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT bis.b #001h, &P1DIR ; Use P1.0 as output bic.b #001h, &P1OUT bis.b #030h, &P3SEL ; Use P3.4,5 for UART0 bis.b #050h, &P3DIR ; Use P3.4,6 as output bis.b #040h, &P5DIR ; Use P5.6 for DREQ bis.b #040h, &P5OUT ; mov.b #004h, &BCSCTL1 ; Setup Clocks mov.b #088h, &BCSCTL2 ; mov.b #002h, &IFG1 ; SetOsc0 bic.b #OFIFG, &IFG1 ; Test Oscilator mov.w #0FFh, R15 ; SetOsc1 dec.w R15 ; jnz SetOsc1 ; bit.b #OFIFG, &IFG1 ; jnz SetOsc0 ; mov.b #021h, &U0TCTL ; Setup U0TCTL mov.b #008h, &U0RCTL ; Setup U0RCTL mov.b #baudDiv0, U0BR0 ; Setup Baud Rate Clock mov.b #baudDiv1, U0BR1 ; mov.b #baudMod, U0MCTL ; bis.b #0C0h, &ME1 ; Enable UART Transmitters mov.b #010h, &U0CTL ; UART0 Released mov.b #000h, &P1IES ; Port 1: Low=>High Transition Cause Interupts bic.b #0FFh, &P1IFG ; Clear any existing Port 1 Interupt Flags mov.b #002h, &P1IE ; Allow P1.1 to Cause Interupts bis.b #GIE, R2 ; Enable global interupts ;---------------------------------------------------------------------------- ; Super_Loop mov.w &fromUSB, R5 ; R5 is a pointer to a table where data is received from the UART Super_Loop mov.w &toUSB, R4 ; R4 is pointer to data being sent to UART call #UART0_TX ; transmit character subroutine jmp Super_Loop ; Do nothing ;---------------------------------------------------------------------------- ; UART0 TX Subroutine UART0_TX bic.b #002h,&P1IE ; Disable Interupts Caused by P1.1 bis.b #rts, &P1OUT ; Set P1.1 (RTS# on uP, #CTS on USB Host) poll_CTS_TX bit.b #cts, &P1IN ; Wait for CTS#(uP) to set jz poll_CTS_TX poll_TX bit.b #TXEPT, &U0TCTL ; Wait until U0 TX Buffer is Empty jz poll_TX mov.b @R4,U0TXBUF ; Transmit Selected Character bic.b #rts, &P1OUT ; Reset P1.1 (RTS# on uP, #CTS on USB Host) bis.b #002, &P1OUT ; Enable Interupts Caused by P1.1 ret ; return from subroutine ;-------------------------------------------------------------------------- ; P1.1 Interupt Handler (for UART RX, activated on rising edge of #CTS P1_ISR bit.b #cts, &P1IFG ; test P1_ISR Trigger jz end_ISR ; bis.b #rts,&P1OUT ; Set P1.1 (RTS# on uP, CTS# on Host) poll_RX bit.b #040h, &IFG1 ; Poll UART RX Flag until 1 jz poll_RX mov.b &U0RXBUF, 0(R5) ; Move RXed Char to Address pointed to by R5, post inc. inc.b R5 end_ISR mov.b #000h, &P1IFG ; Reset All P1 Interupt Flags bic.b #rts,&P1OUT ; Reset P1.1 (RTS# on uP, CTS# on Host) reti ; return from interupt ;--------------------------------------------------------------------------- ; Memory toUSB DW testDataTx ; pointer to table where data is transmitted fromUSB DW testDataRx ; pointer to table where data is received testDataTx DW 00Dh ; Data to be transmitted to USB testDataRx DW 0, 0, 0, 0, 0, 0, 0, 0 ; Data received from USB Host DW 0, 0, 0, 0, 0, 0, 0, 0 ;--------------------------------------------------------------------------- ;Interupt Vectors ORG 0FFFEh DW RESET ORG 0FFE8h DW P1_ISR ;-------------------------------------------------------------------------- ;EQUATES baudDiv0 EQU 041h baudDiv1 EQU 003h baudMod EQU 000h rts EQU 001h cts EQU 002h end Any help is much appreciated.
Reply by larwe October 11, 20062006-10-11
Mike Harrison wrote:

> >Outsourced complexity is still complexity. > But it's complexity that's already been developed and, more importantly, tested. > I have no doubt that there are subtle quirks with different USB memory devices - if you buy
My point is that if the question is "How do I remove data from point A and collect it at point B?" there are much simpler options - and if it comes to that, better-tested ones (through having been fielded longer).
Reply by Mike Harrison October 11, 20062006-10-11
On 10 Oct 2006 17:45:17 -0700, "larwe" <zwsdotcom@gmail.com> wrote:

> >Rocky wrote: > >> > Implementing host-side USB is not a trivial exercise and should only be >> > undertaken for the gravest reasons, and where no reasonable alternative >> >> Actually, with the FTDI Vinculum (VNC1L) it seems almost trivial. > >Outsourced complexity is still complexity.
But it's complexity that's already been developed and, more importantly, tested. I have no doubt that there are subtle quirks with different USB memory devices - if you buy the solution from someone selling it to lots of people, there is a good chance that they will already have found most of the bugs.
>A 32-bit peripheral to an >8-bit micro, purely for mass storage? Insane.
Why exactly..? Who cares what's inside the chip as long as it does the job. Actually it's an 8 bit core with some hardware to help accelerate 32 bit operations.
Reply by Mike Harrison October 11, 20062006-10-11
On 10 Oct 2006 11:20:32 -0700, "Mercy" <mercy.chang@gmail.com> wrote:

> >Mike Harrison wrote: >> On 10 Oct 2006 08:15:27 -0700, "Mercy" <mercy.chang@gmail.com> wrote: >> Life is too short to do this yourself. >> >> Use one of these : >> http://www.vinculum.com/ >> >> Or these : >> http://www.ghielectronics.com/details.php?id=1 > >Good point. Those are perfect solutions for my problem . But a little >too pricey... I don't think my manager would be very impressed... hehe >....
More impressed than when you find out how long he has to pay you do to it from scratch. The Viniculum device is an absolute bargain, and unless your volume is well into 5-6 figures you'd be crazy to roll your own.
Reply by kunil October 11, 20062006-10-11
Just a suggestion: use AT43USB380 USB Host from Atmel. It has USB
library to handle all USB host transactions and MSD (FAT32) library to
handle USB Disk.

-kunil

Mercy wrote:
> Mike Harrison wrote: > > On 10 Oct 2006 08:15:27 -0700, "Mercy" <mercy.chang@gmail.com> wrote: > > Life is too short to do this yourself. > > > > Use one of these : > > http://www.vinculum.com/ > > > > Or these : > > http://www.ghielectronics.com/details.php?id=1 > > Good point. Those are perfect solutions for my problem . But a little > too pricey... I don't think my manager would be very impressed... hehe > ....
Reply by larwe October 10, 20062006-10-10
Rocky wrote:

> > Implementing host-side USB is not a trivial exercise and should only be > > undertaken for the gravest reasons, and where no reasonable alternative > > Actually, with the FTDI Vinculum (VNC1L) it seems almost trivial.
Outsourced complexity is still complexity. A 32-bit peripheral to an 8-bit micro, purely for mass storage? Insane.
Reply by Mercy October 10, 20062006-10-10
Mike Harrison wrote:
> On 10 Oct 2006 08:15:27 -0700, "Mercy" <mercy.chang@gmail.com> wrote: > Life is too short to do this yourself. > > Use one of these : > http://www.vinculum.com/ > > Or these : > http://www.ghielectronics.com/details.php?id=1
Good point. Those are perfect solutions for my problem . But a little too pricey... I don't think my manager would be very impressed... hehe ....
Reply by Rocky October 10, 20062006-10-10
larwe wrote:
> Mercy wrote: > > > Any advice/pointers or instructions would be most helpful. I am still > > a newbie at embedded design so please humor me. > > > > I have a datalogger module written using an Atmel 8051. I want to add > > a USB port to it so I can simply plug in a USB flash drive and have the > > data automatically downloaded as a formatted text file. > > You don't want to do this. Use a removable flash storage medium like > SD. > > Implementing host-side USB is not a trivial exercise and should only be > undertaken for the gravest reasons, and where no reasonable alternative > exists.
Actually, with the FTDI Vinculum (VNC1L) it seems almost trivial. Rocky
Reply by Tim Wescott October 10, 20062006-10-10
Mercy wrote:

> Tim Wescott wrote: > >>At least one of the flash card protocols includes the ability to >>communicate with the card over SPI, so you don't tie up a bunch of >>processor pins. A recent Circuit Cellar had an article on doing just >>this -- it would be in the May-July time frame, probably. >> > > > When you guys refer to SPI, are you talking about: > > Serial Peripheral Interface or System Packet Interface? > > Also ... how can I identify what I have? >
Serial Peripheral Interface, AKA 'the easy way'. I don't know what you mean by identifying what you have -- I thought you had some design requirements to which you wanted to fit hardware. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html