Leggere file testo da pen drive usb

Sezione dedicata al sistema di sviluppo BASCOM-AVR per i micro AVR
At90s, Attiny, Atmega e Xmega

Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 09:01

Salve a tutti,

potreste, gentilmente, farmi un esempio su come leggere un file di testo memorizzato su un pen drive usb?
posso farlo con un atmega8?

Grazie
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby Leonardo » 04 Jun 2013, 09:09

Salve tnnbascom,

il sistema che vuoi realizzare deve almeno:
- comunicare tramite il protocollo USB mass storage device class
- comprendere il file system adottato

compiti decisamente difficili da svolgere da zero, praticamente infattibili per un solo atmega8.

Puoi utilizzare una SD con il file di testo? Eliminando tutte le problematiche USB sarebbe molto più facile gestire il tutto partendo magari da una libreria per leggere il filesystem come http://elm-chan.org/fsw/ff/00index_e.html

Ciao
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: Leggere file testo da pen drive usb

Postby js-bascom » 04 Jun 2013, 09:34

Avresti bisogno di almeno un AVR con "USB on the go" come il AT90USB1287 (??) e poi tutto il codice necessario.
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
User avatar
js-bascom
 
Posts: 176
Joined: 23 Mar 2013, 02:53
Location: Sydney, AUSTRALIA Ex Nunziata, Mascali (CT)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 10:13

Spiego meglio,
mi basterebbe anche una card magnetica, l'importante è che posso memorizzare e leggere un numero di 5 cifre...
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 11:43

Bene che ne dite di usare una smartcard...

qualche modifica a questa applicazione che ho trovato potrebbe far a caso mio... http://www.mcselec.com/index.php?option ... &Itemid=57
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby deluca » 04 Jun 2013, 12:48

vorrei capire...

ti serve una memoria x memorizzare un codice di protezione tipo pass?
una chiave identificativa ? o?
spiega meglio....

o altro
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 13:28

si... una sorta di codice di 5-6 cifre
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby deluca » 04 Jun 2013, 13:34

tnn, visto che sei un fruitore del forum

ti volevo segnalare la chat.... hai già visionato?

chat
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Leggere file testo da pen drive usb

Postby deluca » 04 Jun 2013, 13:35

hai necessità di cambiare il codice?

che grado di sicurezza desideri?
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 15:11

devo poter cambiare il codice...
nessun grado di sicurezza...
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 04 Jun 2013, 15:12

come funziona la chat???
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby deluca » 04 Jun 2013, 16:10

clicca su chat .... e stai on-line
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 06 Jun 2013, 07:18

Salve a tutti,

non prendetemi per pazzo, ma ho bisogno che come supporto sia proprio una PenDriveUSB formattato FAT32... mi basta leggere solo 6 numeri...

Vi prego ho bisogno di una strada valida da seguire... grazie.
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby Leonardo » 06 Jun 2013, 08:16

Salve,
Su un atmega8 non hai le risorse di calcolo necessarie e le librerie per una comunicazione affidabile USB host, come detto da js-bascom potresti utilizzare un micro con supporto hw per questa funzionalità.
In parole povere non è facile e richiede molto codice leggere una penna USB, in genere si usano librerie per velocizzare i tempi di sviluppo e concentrarsi sull'applicazione.
Esistono degli IC esterni USB host controller disponibili su modulo (es. Vinculum VNC1L Module) oppure altri moduli basati su micro con supporto USB host.
L' AT90USB1287 suggerito da js-bascom è un micro di Atmel con supporto USB Host che potresti prendere in considerazione. A meno di non andare sui 32 bit di casa Atmel, Microchip ha un'ampio catalogo di micro con queste funzionalità.
Ma a questo punto forse sarebbe più conveniente e semplice un raspberry? Avresti l'hardware già pronto e ti basterebbe scrivere un semplice software per Linux.

Ciao
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: Leggere file testo da pen drive usb

Postby deluca » 06 Jun 2013, 08:25

@tnn,
come già detto da js e da leonardo ti puoi scordare di gestire un pendrive con un atmega8. Proprio è impossibile dal punto di vista hardware.

L'alternativa, se vuoi renderti la vita semplice, è di usare il chip VNC1 o il modulino con il connettore USB già montato.
Lo inferfacci attraverso la Uart o la SPI e il gioco è fatto.
Bastano praticamente 2 righe di programma per creare un file testo, scriverci dentro e chiuderlo.

Non vedo alternative x te a meno che non cambi micro.
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 06 Jun 2013, 09:43

Ottimo, penso che il VNC1 sia una soluzione da provare...

che ne pensate di questo esempio?

http://www.mcselec.com/index.php?option ... &Itemid=57
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby js-bascom » 06 Jun 2013, 10:37

il VNC1
Come gia suggerito puoi combrare i moduli come il VDRIVE (ora VDRIVE 3) http://www.ftdichip.com/Products/Module ... odules.htm

Io ho usati un bel po' del VMUSIC2 (ora VMusic3 ), tutto pronto solo mandare comandi via l'USART.

edit haha ho scoperto il tuo gemello :-) http://www.avrfreaks.net/index.php?name ... c&t=133337
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
User avatar
js-bascom
 
Posts: 176
Joined: 23 Mar 2013, 02:53
Location: Sydney, AUSTRALIA Ex Nunziata, Mascali (CT)

Re: Leggere file testo da pen drive usb

Postby tnnbascom » 06 Jun 2013, 11:57

che bel oggetto questo VDRIVE3...

comunque già ho acquistato il VDIP1... per i test va comunque bene... giusto?

grazie
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Leggere file testo da pen drive usb

Postby js-bascom » 06 Jun 2013, 22:32

Da quello che dice FTDI sembra perfetto per te, specialmente se ne userai molti.
The Vinculum VNC1L is the first of FTDI’s Vinculum family of Embedded USB host controller integrated circuit devices. Not only is it able to handle the USB Host Interface, and data transfer functions but owing to the inbuilt MCU and embedded Flash memory, Vinculum can encapsulate the USB device classes as well. When interfacing to mass storage devices such as USB Flash drives, Vinculum also transparently handles the FAT File structure communicating via UART, SPI or parallel FIFO interfaces via a simple to implement command set. Vinculum provides a new cost effective solution for providing USB Host capability into products that previously did not have the hardware resources available.
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
User avatar
js-bascom
 
Posts: 176
Joined: 23 Mar 2013, 02:53
Location: Sydney, AUSTRALIA Ex Nunziata, Mascali (CT)

Re: Leggere file testo da pen drive usb

Postby deluca » 07 Jun 2013, 08:22

@js-bascom,
puoi trovare i clone del DNA di tnnbascom in tanti forum :

http://www.avrfreaks.net/index.php?name ... c&t=133337
http://www.mcselec.com/index2.php?optio ... ic&t=11625
http://www.mcselec.com/index2.php?optio ... ic&t=11626

Oh! ... tnn, fidati il VNC1 è quello che ti serve.... :)

@tnnbascom, naturalmente stiamo scherzando... sei liberissimo chiedere in tutti i forum che vuoi :)
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Next

Return to BASCOM-AVR

Who is online

Users browsing this forum: No registered users and 5 guests