USB device, part 6 of 10 Part 1: USBPart 2: Initialising the USB peripheralPart 3: USB descriptors and how to send and receive data on endpoint 0Part 4: Finishing the USB CDC devicePart 5: USB progress updatePart 6: USB MSD codePart 7: How to make a USB Mass Storage Device part 1Part 8: How to make a USB Mass Storage Device part 2Part 9: USB HID joystick: it worksPart 10: USB HID joystick: schematic, code and KiCad files

USB MSD code

All 10 posts in USB device
  1. USB
  2. Initialising the USB peripheral
  3. USB descriptors and how to send and receive data on endpoint 0
  4. Finishing the USB CDC device
  5. USB progress update
  6. USB MSD code
  7. How to make a USB Mass Storage Device part 1
  8. How to make a USB Mass Storage Device part 2
  9. USB HID joystick: it works
  10. USB HID joystick: schematic, code and KiCad files

Code for this post

Code for USB MSD

OK, the mass storage device code is finally done! What a wild ride it's been. Bits and pieces of information everywhere, some of it very hard to find! It's been a good few weeks so I need a break before writing about it but I'm uploading the code for anyone who may want to use it.

Please bear in mind that on my board, the SD card is attached to SPI2 on RB3 (for SDI) and RB5 (for SDO). The Chip Select (CS) pin is attached to RA0. If you wish to use this code, you will have to modify the appropriate values in mmcpic32.h and also the PPS settings in main.c.

If anyone has any questions, please drop a comment and I'll try and help out.

Here's the code.

Comments are hosted by Disqus, which loads only when you ask for it.