What does it take to use a usb?

  • Thread starter Thread starter GiTS
  • Start date Start date
  • Tags Tags
    Usb
Click For Summary

Discussion Overview

The discussion revolves around the feasibility and technical requirements for using USB memory sticks with microcontrollers, particularly focusing on the PIC and AVR families. Participants explore the challenges of interfacing with USB and SD memory, including the necessary hardware and software components.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about the possibility of using a PIC microcontroller to record audio onto a USB memory stick or SD memory chip, expressing a lack of technical knowledge about flash memory.
  • Another participant notes that while MicroChip PICs can function as USB slaves, a USB host is required to communicate with memory sticks, mentioning the complexity of the sample code available.
  • A different participant expresses confusion about the necessity of a large host controller and suggests that smaller solutions might exist, referencing the functionality of small cameras with SD cards.
  • One participant clarifies that SD cards do not typically have native USB interfaces and suggests that the complexity of USB technology often complicates convenience.
  • Another participant discusses the need to handle file systems when writing data to memory, proposing a simplified approach using a fixed file structure to ease the process.
  • A participant familiar with Atmel's AVR microcontrollers proposes using an SD card breakout board for audio recording, highlighting the simplicity of connecting it via SPI without needing extensive drivers.
  • One participant shares their preference for using PIC32 microcontrollers with USB support but expresses frustration with the complexity of USB communication, opting instead for a USB-to-UART interface chip for ease of use.
  • A participant provides a link to an article about interfacing a USB flash drive with a PIC microcontroller, suggesting it may contain relevant information.

Areas of Agreement / Disagreement

Participants express a range of views on the complexity of using USB with microcontrollers, with some agreeing on the challenges of USB communication while others propose alternative methods or components. No consensus is reached on the best approach or the feasibility of using USB memory sticks directly.

Contextual Notes

Participants highlight various assumptions about the capabilities of microcontrollers, the nature of USB and SD interfaces, and the requirements for handling file systems, indicating that these factors may influence the discussion's outcomes.

GiTS
Messages
132
Reaction score
0
Is it possible for a microcontroller like PIC to use a USB memory stick?

I wanted to make a small microphone that will record onto USB memory stick or those SD memory chips that go into cameras.

I know nothing of how flash memory works on a technical level but I imagine you have to send commands like start/stop recording.

Please enlighten me as I cannot find information.

Thank you,

-GITS
 
Computer science news on Phys.org
I've used MicroChip 18Fxxx PICs as USB slaves, but you need a USB host to talk to memory sticks and most everything else. Microchip has sample code for the slave operation, which for me was nearly impenetrable until I found a bit of a working example -- I think at Sparkfun. I've not looked into sample host code, but they may have that as well...best to rummage around their support site.
 
Thank you for the information. Wow, a host controller is big. I don't get why there has to be so much to it. It's got 5 pins and some combination of signals has to be able to tell it to write. I'll have to do more research and post it. Maybe someone else is interested in this and would like to share. I mean small cameras write on SD so there has to be a way to make the host smaller.
 
Memory cards like the SD don't usually have native USB interfaces. I think they are more of a bus-like thing, but I haven't worked with them. I also should look into the USB host thing -- as you say, how can it be so hard? Well...Every step forward in technology is accompanied by a backward step in convenience...almost anything I can think of doing would work fine with a bi-directional parallel printer port.
 
Then you have to handle the file system
The easiest way I found was to use fat and a 32Mb limit, format a card in a PC and create a single file with a fixed name. Then just dump the filesystem header bytes. You can write this fixed header structure from your microcontroller rather than implement a full filesystem
 
I'm more familiar with Atmel's ARV microcontrollers, so here's my proposal to make an audio-recording device:

If you want removable storage, pick up an SD card breakout board. SD is a little easire to connect to an MCU since it doesn't need any drivers or ontrollers, just a handful of pull-up resistors. Connect it to an AVR MCU (i.e. Atmega8) via the SPI interface (MOSI-MISO-SCK-SS'). Connect an analog microphone to one the the ADC pins on the MCU. You will have uncompressed audio at your ADC pin.

However, that uncompressed audio will be nothing but a pile of zeros and ones; you will have to decide what you want to do with them.
 
schip666! said:
-- as you say, how can it be so hard?

I like to use the PIC32's, many of which have USB support. Each time I look at using USB communication I always end up just going with a FTDI chip. I tried learning all about USB once and found that its extremely complicated, even with a bunch of sample code. In the end I decided it was better to spend the $3 on a USB->UART interface chip and just be done with it.

Writing data to a SD card is much easier than writing to a USB drive. There's a ton of sample code out there for this for just about all the latest PIC micros. It only requires basic SPI communication as mentioned above.
 
I haven't played with this myself, but here's a relevant article:
http://electronicdesign.com/article/digital/interfacing-a-usb-flash-drive-to-a-pic-microcontro.aspx
 
Last edited by a moderator:

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
Replies
7
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
16K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 15 ·
Replies
15
Views
6K
  • · Replies 18 ·
Replies
18
Views
4K
Replies
4
Views
3K