Show Posts
Pages: 1 2 [3] 4 5 ... 9
31  Products / Arduino Due / Re: How to get Vendor ID and Product Id of connected USB Device On Arduino Due board on: November 26, 2013, 02:33:02 am
Gericom: Please excuse my delay in responding to your suggestion on vendor/product id.  What you say is surely possible and I have seen an unofficial list of USB vendor/product ids somewhere in web forum.  But the basic problem is you cannot be too sure of what you get ... you know many users use multiple accounts to post in forums... smiley-wink

I think vijayPatil14 needs to distinguish what he wants to read:  the vendor/product ids of a media card is simply not easy to get if being used with a card reader.  Getting the USB Dev Descriptor's Vendor/product id would get him the id of card reader... not what is mounted on it.   Does this mean it is impossible to know the SD Assoc defined CID, CSD using a card reader?  Hardly.
If I am the manufacturer, I might leave a mechanism (vendor unique SCSI Command) to get that when working with common  media cards like SD, SDIO, CompactFlash, MMC2, stick(?), etc.
If he wants to know how to process the USB descriptors, I recently made available the mass storage class driver for Native USB port and it has all the code needed to extract the four primary descriptors: dev, config, interface & endpoint.  Look into doMscConfig().  While the driver code stops after discovering the first drivable interface, his code could carry on and discover all the descriptors if he likes.

The code I posted is part of my msd library for the due as well. It only works with 2 usb sticks so far. But this snipped works great.
32  Products / Arduino Due / Re: How to get Vendor ID and Product Id of connected USB Device On Arduino Due board on: November 08, 2013, 04:07:25 am
You can do something like this:
#include <Usb.h>

USBHost usb;

boolean found = false;

void setup()

void DeviceTest(UsbDevice *pdev)
     if(usb.getDevDescr(pdev->address, 0, DEV_DESCR_LEN, (byte*)&d) == 0)
            //Now use d.idVendor and d.idProduct to indentify your device.
            //If you have found the right one, store pdev global and set found to true.
33  Products / Arduino Due / Re: Reading analogical input and output it as analogical on: November 07, 2013, 02:27:58 am
I tried to send the sketch but I failed so I wrote the sketch I made:

float r1,r2;
void setup( )
void loop ( )
r1 = analogiRead(0);
r2= 2.5*r1;
analogWrite (DAC0,r2);
Why do you use a delay?
34  Products / Arduino Due / Re: How to get Vendor ID and Product Id of connected USB Device On Arduino Due board on: November 07, 2013, 02:26:17 am
Can you please share the code..
I will share it when I have time.
35  Products / Arduino Due / Re: How to get Vendor ID and Product Id of connected USB Device On Arduino Due board on: November 06, 2013, 01:49:24 pm
I will have to look it up. But I did it before.
36  Products / Arduino Due / Re: Waveform generation_DAC_faster speed on: November 06, 2013, 01:10:31 am
You can use a combination of a timer interrupt and some low level code. You can write to the 2 dacs at the same time using the word transfer mode in combination with the tag mode.
37  Products / Arduino Due / Re: How to get Vendor ID and Product Id of connected USB Device On Arduino Due board on: October 31, 2013, 01:57:13 am
It is not very difficult to read out them.

Each manufactor got it's own vendor id. And for each product, there is a product id. So if you have 2 of the same device, both id's are the same.
38  Products / Arduino Due / Re: sampling rate in arduino due on: October 28, 2013, 02:45:58 am
hello all,

i want to know what is the sampling rate of ADC in Due, and can it be altered to a certain frequency like 48khz (it is for audio input)


I think it was 1MHz.

For 48kHz you can just use an timer interrupt at 48kHz.
39  Products / Arduino Due / Re: What is the limit for array size on Arduino DUE? on: October 08, 2013, 02:00:19 pm
I think the cleanest way to declare an array is using a #define directive:
#define ARRAY_SIZE 65536   // maximum for Due
uint8_t array[ ARRAY_SIZE ];

IIRC I have used even bigger arrays. Like 93000 or something.
40  Products / Arduino Due / Re: Can anyone recommend low level USB host mass storage code for Due? on: October 06, 2013, 02:28:54 am

I am writing a new FAT12/FAT16/FAT32 library that cleanly separates the FAT filesystem code from the block device driver.  I am now testing with SD cards on SPI but the library supports any block device derived from this class.

class FatBlockDevice {
  // Return a code for an I/O error.
  virtual uint8_t hwErrorCode() const = 0;
  // Return extra data describing an I/O error.
  virtual uint8_t hwErrorData() const = 0;
  // Read a block from the device.
  virtual bool readBlock(uint32_t lbn, uint8_t* dst) = 0;

  // Write a block to the device.
  virtual bool writeBlock(uint32_t lbn, const uint8_t* src) = 0;

  // Optional multiple block transfers.
  virtual bool readBlocks(uint32_t lbn, uint16_t count, uint8_t* dst) = 0;

  virtual bool writeBlocks(uint32_t lbn, uint16_t count, const uint8_t* src) = 0;

For SD on SPI I use the class SdSpiCard that is defined like this:
class SdSpiCard : public FatBlockDevice {

This is how the equivalent of SdFat is setup:

#include <FatLib.h>
#include <SdSpiCard.h>

SdSpiCard card;

// The argument of FatFilesystem has type FatBlockDevice * .
FatFilesystem sd(&card);

FatPrintFile file;
void setup() {

  if (!card.begin() || !sd.begin()) {
    Serial.println("begin failed");



I am looking for a class for a USB flash drive to replace SdSpiCard.  For example a class UsbFlashDrive that is derived from FatBlockDevice like this:
class UsbFlashDrive : public FatBlockDevice {

Would this be possible with your setup/code?

I still need to do some development and cleanup and then I could send you my FatLib library.
That's very nice! That way I could implement my mass storage lib.
41  Products / Arduino Due / Re: Can anyone recommend low level USB host mass storage code for Due? on: October 05, 2013, 09:48:21 am
I have worked on a USB host mass storage library, but it only worked with some usb sticks. But I could play stereo audio from it.
42  Products / Arduino Due / Re: DUE DAC...Safe to test with oscilloscope? on: October 01, 2013, 12:45:30 pm
I have had a 75 ohm input connected to the dac output, and it still works. (and an oscilloscope too)
43  Products / Arduino Due / Re: Reading MIDI File, and parsing on: September 08, 2013, 02:39:34 pm
I think you can find enough documentation on the web.
44  Products / Arduino Due / Re: Due not detected via USB on: August 28, 2013, 01:34:44 pm

I have the same problem with the Arduino Due. Since the programming port is recognized under Device Manager, It is obvious that the AtMega16u2 is working. But since the Native USB port does not work it concludes that the SAM3X is not responding and I have no idea why. It shows up as Unknown Device. When you try programming the Due through the programming port it shows that there is no device on the COMx which further confirms that the SAM3X is unresponsive.

Sadly it worked for 2 days and now only seems to be nothing more than a paper-weight. I hope there is a way to ressurect it.

Have you tried the 2 button solution?
45  Products / Arduino Due / Re: change ADC clock on: August 23, 2013, 11:57:57 am
Quote from: groundfungus on Today at 02:12:41 am
The program output is  291666

ACTUAL_ADC_CLK is an int.  How can an int be 291666?
Why not? An int is 32 bit.

int is 2 bytes.  16 bit, ±32K.  Long is 4 bytes.  32 bits.
I thought that was on an original arduino. On a due int is 32bit as far as I know.
Pages: 1 2 [3] 4 5 ... 9