Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Internal Disk Example

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Posts
    415

    Internal Disk Example

    I've been trying to add an internal disk to my MIDI / rawHID combo and I think I have pretty much all the hacking in place, but I'm at a loss as to how to procede.

    Where and how do I specify the properties of the disk? Is there any example code for using an internal disk? How do I put stuff on it ( I realize it'll be read only)?

    Regards,
    Rob

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,208
    When you program a Teensy2 with the USB Disk (internal) type, the filesystem will be initialized with a readme file that explains how to initialize the disk with your own files. Please read that file for details.

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    Quote Originally Posted by PaulStoffregen View Post
    When you program a Teensy2 with the USB Disk (internal) type, the filesystem will be initialized with a readme file that explains how to initialize the disk with your own files. Please read that file for details.
    Okay, how do I specify that I want to use internal versus sd card?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,208
    Use the Tools > USB Type menu in Arduino.

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    Quote Originally Posted by PaulStoffregen View Post
    Use the Tools > USB Type menu in Arduino.
    Ya, I've hacked together my own custom usb type.... It must be very obvious what I need to do. I guess I'll just do some more poking around.

  6. #6
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    Okay, so because my custom type does not define USB_DISK, I have to change some code in the in my usb.c,

    Code:
    #include "media_internal.c"
    /*
    #if defined(USB_DISK_SDFLASH)
    #include "media_sdcard.c"
    #elif defined(USB_DISK)
    #include "media_internal.c"
    #else
    #error "No known media type specified\n"
    #endif
    */
    Everything compiles now, but Windows reports problem with the descriptor. (yes I did increment the bcdDevice).... So here come some Yes / No questions.

    1) Must BULK type endpoints be listed in the descriptor before INTERRUPT ones? i.e. Do my MIDI and DISK need to come before rawHID and DEBUG?
    2) I've calculated the incremental offset of the DISK descriptor to be 32 (the same size as my rawHID and Debug) Does that sound right to you?

    Sorry for the million question I ask.

    Regards,
    Rob

  7. #7
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    I see the size of the DISK descriptor should be 23.... I know understand that you just need to add together all the 'bLength' fields for the particular interface, so question two is answered already.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    I've increased the bcdDevice number but windows is still giving me issues...Device works fine on my Android Tablet.

  9. #9
    Senior Member
    Join Date
    Jun 2013
    Posts
    415
    Paul, there must something that's not quite right. My MIDI / rahHID / Internal Disk works fine in Android 4.03 and in OSX. When plugged into my Android 4.2 phone, the drive won't mount but the device otherwise works fine. However in Windows, the device still doesn't install properly. I even tried using on a computer that I had never plugged it into before, but it still doesn't work. I know you're not much of a Windows man, but can you think of anything?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •