Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USB Interface / Driver issues with Arduino DUE compatible design Using ATSAM3X8E chip

Status
Not open for further replies.

asimlink

Full Member level 1
Joined
Jun 24, 2009
Messages
96
Helped
12
Reputation
24
Reaction score
12
Trophy points
1,288
Location
Islamabad
Activity points
2,287
Hi Friends,

I have designed a board around ATSAM3X8E chip which is also used in Arduino DUE Board. Original Arduino DUE board schematic can be seen here:

www.arduino.cc/en/uploads/Main/arduino-Due-schematic.pdf


I made my design keeping it compatible with Arduino DUE board. I have copied almost everything from from Arduino DUE Board schematic except USB Host Capability which I stripped from the design as it was not required in my system where i only needed this board to appear as USB Slave device.

I am currently able to program the ATSAM3X8E chip on my custom designed board over UART0 interface (RXD0/Pin27, TXD0/Pin2). I am using Arduino IDE to program the board. When i program the board using UART0 i select Arduino DUE Programming Port from Arduino IDE> Tools > Port menu. To test the board I had programmed Arduino AnalogReadSerial example and I was able to see Serial Prints on Serial Terimnal.


The trouble starts when I plug in my Boards USB interface with my PC running Windows 7 or Windows 8( i haven't tried any other OS yet). When I plug in my boards USB in to PC, the PC is able to generate USB Plugin sound. When I remove my board USB from PC USB then it also generate USB un-plug sound.

I also was able to see the USB device appearing in Device Manager window as shown below in this picture:
USB-Device.JPG

I also downloaded and installed Atmel SAM-BA tool. And tried updating thr USB device driver through following SAM-BA installation folder:
C:\Program Files (x86)\Atmel\sam-ba_2.15\drv

But windows does not recognizes this device and generates following error message:

"Windows was Unable to install your Unknown device"

Please see the ATMSA3X8E scheme that I am using for my board:

Arduino-Due-Schematic.png

i have already cycled through chip ERASE by pressing ERASE button. And I also tried to connect using SAM-BA but the board does not appear as Com port and remains appearing as Unknowd Device. Due to this reason the SAM-BA is unable to connect.

I also checked VDDOUT which are around 1.79V and made sure that 3.3V are also fine. Also the clock oscillator is working and producing 12MHz clock.

Can someone suggest what am i missing that my ATSAM3X8E based design is un able to appear as com port over its Native USB interface?

Kind Regards
 

Hi

You can try the following,

1) Shut Down and Turn on your PC.
2) Manually bind the driver for this device.
3) Probe on DP/DM of USB device to see where the enumeration fails or hook a USB Analyzer.

Thanks
Prajth
 

Hi Prajth,
Thanks for your reply. How do i manually bind the driver, can you please elaborate more on this?

I had probed DP/DM signals using oscilloscope. I was able to see some continuous activity on the USB signals. I will try to upload a screen capture of the signals. But somehow windows 7 or windows 8 does not lets me install driver.

As i stated earlier i get following error:

"Windows was Unable to install your Unknown device"

An important thing to note here is that if I attach a ready made Arduino DUE board on Native USB port, windows is always able to recognize it as Arduino DUE (COM15).

However when I press erase button for more than 250msec while resetting the Arduino DUE board the board appears as : Bossa Program port (COM20).

I then reprogram the board through Arduino IDE with AnalogReadSerial example. Now when i un-plug and plug the Arduino DUE board the board again starts to appear as Arduino DUE (COM15).

From this excercise, i can understand that ATSAM3X8E driver for the USB interface is already correctly installed. Its only my custom designed ATSAM3X8E board that is failing to configure its USB somehow.

We need to figure out what is that difference between my hardware and the original Arduino DUE board's hardware that is preventing my custom designed board to run its USB interface?

- - - Updated - - -

Here is screen capture of USB signals of my custom designed ATSAM3X8E board:

IMG_20150609_235257.jpg

The upper trace is for USB_D_P and lower trace is for USB_D_N. The activity on USB signals is brief and happens just after when i press and release RESET button.

- - - Updated - - -

I also noticed that the ATSAM3X8E chip on my board has a different ATMEL Logo than on Arduino DUE board.
However the part number is exactly same, i.e. :

Atmel
ATSAM3X8E
AU

The logo on Arduino DUE board has ATMEL logo in Capital letters.

- - - Updated - - -

Here are the top and bottom views of my 4-layer ATSAM3X8E board

Top view with highlighted short lenght USB signals
top-Arduino-due-compatible-design.JPG

Bottom view:
bottom-Arduino-due-compatible-design.JPG
 

I made my design keeping it compatible with Arduino DUE board. I have copied almost everything from from Arduino DUE Board schematic except USB Host Capability which I stripped from the design as it was not required in my system where i only needed this board to appear as USB Slave device.

I am currently able to program the ATSAM3X8E chip on my custom designed board over UART0 interface (RXD0/Pin27, TXD0/Pin2). I am using Arduino IDE to program the board. When i program the board using UART0 i select Arduino DUE Programming Port from Arduino IDE> Tools > Port menu. To test the board I had programmed Arduino AnalogReadSerial example and I was able to see Serial Prints on Serial Terimnal.

You mentioned you removed USB Host capability from your code, what USB Device Class is your device coded for, CDC, HID, etc?

The original Arduino Due appears to coded for a Communications Device Class (CDC), hence the Virtual COM Port (VCP) assignments.

If you have coded for a CDC, then you will need to copy/modify the exist CDC driver INF file included within the Windows OS, so that it recognizes your device.

Specifically, you need to copy/modify the Vendor ID (VID) and Product ID (PID) as well as the manufacturer strings with the driver install configuration file (INF).
 

As per my knowledge Atmel has a hard burned bootloader in these ATSAM microcontrollers and as per my knowledge these bootloaders get invoked both on USB and UART interface whenever someone presses ERASE button for more than 250 msec just after the device RESET.

In my case, the default Bootloader is correctly working on UART pins as I can always program my ATSAM3X8E chips using Arduino IDE when I connect the Chip using USB/TTL converter. But, somehow the USB interface is not usable. I also tried following AnalogReadSerial Arduino Sketch :

void setup() {
// initialize serial communication at 9600 bits per second:
SerialUSB.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}

Notice that this code has modified line: SerialUSB.begin In this line i am not using Serial.begin but SerialUSB.begin function.
This code should configure Native USB port of ATSAM3X8E chip as USB Com port. This code gets programmed successfully through UART but It just cant configure the USB interface correctly and I still see USB Interface as Unknown device.

- - - Updated - - -
 

Once the embedded atmel bootloader has release execution to the application in flash, the embedded atmel bootloader is no longer available and execution then shifts to the Arduino bootloader.

I suspect you will need to implement USB CDC code, configured to with the proper VID/PID for the Arduino IDE and Windows USB CDC driver to recognize the device once your application is running.

Are you sure you did not remove the CDC code, instead of the USB Host code from the Arduino bootloader?

Does the Arduino Due board utilize the ATSAM3 microcontroller?

If not, have you examined the Arduino Due bootloader code? You will probably find it as a starting point for your custom Arduino bootloader, which you will need to port to the ATSAM3.

I'm not that familiar with the Arduino product line to answer the above questions, however I do know the Arduino utilizes a custom bootloader which integrates with their Arduino IDE.

BigDog

Update:

I've examined the official Arduino DUE schematics and they appear to be utilizing an Atmel ATMEGA16U2 to implement the USB CDC bootloader.

Therefore, it appears you'll need to port the ATMEGA16U2 bootloader code to incorporate it into your ATSAM3 device to utilize the USB CDC for interacting with the Arduino IDE.
 

Hi Admin,

Thanks for your reply. I want to use ATSAM3X8E as CDC. Since i made my board copy of Arduino DUE design, I expect my board to behave like Arduino Board. I want to program Arduino Sketches on my board. To my knowledge ATSAM3X8E chip does not needs to be programmed with any other bootloader as it comes preloaded with Atmel Bootloader that when invoked makes Native USB a CDC device. All i am saying is that this is not happening. When I press ERASE button for more than 250msec code gets erased inside ATSAM3X8E chip and Native USB interface should become a CDC devcie but this is not happening. However I know the device gets erased correctly in my case as i can always program my ATSAM3X8E device over UART interface. The USB interface in my case remains Unknown device.

I know the ATSAM3X8E driver is already installed on my machine and is correct too. That i know because whenever i erase a ready made Arduino Board it shows Bossa Com port in device manager.

Hope this may give someone clue about whats wrong in my scheme.
 

I want to program Arduino Sketches on my board. To my knowledge ATSAM3X8E chip does not needs to be programmed with any other bootloader as it comes preloaded with Atmel Bootloader that when invoked makes Native USB a CDC device. All i am saying is that this is not happening. When I press ERASE button for more than 250msec code gets erased inside ATSAM3X8E chip and Native USB interface should become a CDC devcie but this is not happening. However I know the device gets erased correctly in my case as i can always program my ATSAM3X8E device over UART interface. The USB interface in my case remains Unknown device.

After reading most of the documentation available concerning the Arduino Due and knowing more than I ever wanted to know about the Arduino Due, it appears there are three ways to program the original board using the Arduino Due IDE and associated utilities.

1. Use the USB Programming Port implemented by the onboard ATMEGA16U2 which provides a USB CDC VCP connection.

2. Bypassing the ATMEGA16U2 and using the UART port on the ATSAM3, in conjunction with the embedded SAM-BA bootloader which is normally connected to ATMEGA16U2.

3. Use the USB Native Port on the ATSAM3 in conjunction with the embedded SAM-BA bootloader.

The onboard ATMEGA16U2 (assistant) simply acts as a USB CDC VCP USB-to-UART bridge.

Getting started with the Arduino Due



I want to use ATSAM3X8E as CDC. Since i made my board copy of Arduino DUE design, I expect my board to behave like Arduino Board.

Not exactly, you've omitted the ATMEGA16U2, therefore you are left with options two and three listed above.



I know the ATSAM3X8E driver is already installed on my machine and is correct too. That i know because whenever i erase a ready made Arduino Board it shows Bossa Com port in device manager.

Bossa is an open source version of the Atmel SAM-BA which targets solely the Atmel SAM device families and utilizes the Atmel embedded bootloader:

BOSSA Flash Programming Utility

The Arduino Due IDE includes and utilizes the Bossa Command Line Utility (bossac) and should be located in the following path:

C:\<Arduino Due IDE>\hardware\tools\bossac.exe



Does the Bossa COM Port show up in the device manager when the UART is NOT connected?

If so, that is the USB Native Port which can be used to program the device, in any event it appears the Basso driver is loading, at least for the direct UART connection.

It appears using the Native Port can be a bit finicky as there are numerous posts dealing with various issues, for example:

No device found on COM5 with Bossac on Winwdows 7

Help with ATSAM3X8E (Due barebones)

Another possible solution maybe pressing the reset button a few seconds after and while still pressing the erase button.

You also may want to double check your pinouts and connections to the USB interface, there appears to be errors on several schematics concerning the USB interface.



Hope the above helps in your endeavors,

BigDog


- - - Updated - - -

After further consideration of the issue, since both SAM-BA and Basso drivers recognize the same VIDs/PIDs, you maybe experiencing a driver contention issue. Therefore you might want to uninstall SAM-BA and its associated driver, which would alleviate the potential for such a driver contention issue.

Also, if all else fails, you maybe able to utilize a USB to UART cable/module like the FT232R or the MCP2200/MCP2221 directly connected to the UART.

While I do not have any SAM3 boards available, I do have several SAM7 and SAM9 which the Basso driver and utility are supposed compatible. If I have time I will test them with the Basso utility and driver for programmibility through the USB port.


BigDog
 

Thanks Admin for your detailed reply. I agree that I have following two options for programming ATSAM3X8E chip:

2. Bypassing the ATMEGA16U2 and using the UART port on the ATSAM3, in conjunction with the embedded SAM-BA bootloader which is normally connected to ATMEGA16U2.
3. Use the USB Native Port on the ATSAM3 in conjunction with the embedded SAM-BA bootloader.


The second option (i.e. programming over UART interface) works in my case. I can use Arduino IDE and can keep the Reset pressed until i dont see message : "uploading..." in Arduino IDE. The Arduino IDE is programming ATSAM3X8E chip using UART interface.

However 3rd option is not working in my case. I like your suggestion I will try your suggestions and will comeback to you with the experiments.

Thanks
 

I've managed to test both SAM-BA and Basso with several SAM7 and SAM9 development boards using the USB interface.

I first installed SAM-BA, however I was surprised to find when I connected the USB interface with the PC and erased the contents of the flash, the Basso device driver immediately loaded. Apparently, the system found the Basso driver in an AVR Arduino IDE which I had previously installed. Another surprise was the SAM-BA seemed to eventually work with the Basso driver. However, after erasing the device's flash I had to disconnect and then reconnect the USB cable for the Basso driver to properly enumerate and recognize the device.

I also had success with the Basso GUI, after ensuring I install the x64 version for the Windows 7 x64 OS which I have running. However, once again, after erasing the flash I had manually disconnect and reconnect the USB cable for the Basso driver to properly enumerate and recognize the device.

As I do not have a SAM3 development board available, I did not bother testing the Arduino IDE, however I see no reason why it should not have functioned as it simply utilizes the Basso commandline utility (bassoc) by running a script.

You did not mention whether or not when you saw the Basso device driver load, it established a VCP and assigned a COMx port.


BigDog
 

I plugged in an Erased ATSAM3X8E Arduino Due board to USB port of my PC running windows 8. I then opened device manager and I could see Bossa Program Port (Com20) under Ports (Com & LPT) as shown in this picture:

bossa-com-port.PNG

I then right clicked the Bossa Program Port (Com20) and uninstalled the driver. after re-pluging in the usb cable now i could see the Arduino DUE board appearing as : GPS Camera Detect (Com20) as shown in following picture:
gps.PNG

I now plugged in my Arduino DUE compatible Board USB port to same PC running windows 8 and could see the board appearing as Unknown Device as shown in this pic:

unknown-dev.PNG

I also have gone through multiple ERASE cycles and also tried pressing RESET button multiple times before and after ERASE sequence but the board always appear as Unknown Device. It looks like Native USB port on my board is somehow not behaving like Native USB port as on Arduino Due board.

Is there a way, like reading some USB Registers through Arduino code programmed using UART (Option-2) so that I can know what exactly is the issue with Native USB on my board?

Regards
 

I plugged in an Erased ATSAM3X8E Arduino Due board to USB port of my PC running windows 8. I then opened device manager and I could see Bossa Program Port (Com20) under Ports (Com & LPT) as shown in this picture:

View attachment 118382

The above description is exactly the outcome you want, you then need to select the board, Tools -> Board -> Arduino Due, following by selecting COM20 with in the Arduino IDE, Tools -> Serial Port -> COM20, you should then be able to download the compiled sketch.

If the above proceed fails, try using the commandline utility, bassc, as discussed in one of the thread of which earlier I provided the link.

I would recommend, right clicking on the "Unknown Device," in the Device Manager, Driver Tab, Update Driver and reselect the Basso driver located in the Arduino IDE directory -> drivers directory.



Is there a way, like reading some USB Registers through Arduino code programmed using UART (Option-2) so that I can know what exactly is the issue with Native USB on my board?

My understand, admittedly limited, is the Arduino has limited debug capabilities, however I suspect there is a way to directly read registers and print out there contents. Although, I suspect the issues with utilizing the Native USB Port for programming the device are regularly encountered as discussed in many of the forum thread concerning the topic.

In any event, the first situation you described, is the desired outcome. Before uninstalling the driver, did you attempt to program the device using the issued COMx VCP?

BigDog
 

Hi Admin,

You have perhaps misunderstood my last post. I can see Bossa Program Port (Com20) only in case of orignal Arduino DUE board. But in case of my own ATSAM3X8E board i never am able to see Bossa Program Port appearing in device manager. Instead i always see Unknown Device. I was saying that it looks as if USB port of my ATSAM3X8E chip on my designed board is not working as it should in Arduino DUE board.
 

Yes, I misunderstood your description of events.

Did you attempt to update the Unknown Device to the proper driver as I detailed in the previous post?

Also, did you double check the connections? according to a few of the forum posts, several of the example schematics are labelled incorrectly.

You might want to compare them to the actual device datasheet.

BigDog
 

Hi Admin,

Thanks for your reply. I mostly had compared my schematics agains the Arduino DUE schematics :
https://www.arduino.cc/en/uploads/Main/arduino-Due-schematic.pdf

I however will look at the datasheet again for any mismatches.
And yes i had attempted to install driver as suggested by you in your post. I also had uninstalled existing driver that were attached to USB Com port that belonged to Arduino DUE board. My board always appears as Unknown device.
 

Hi Admin,

I have compared my schematics with Atmel Datasheet and with Arduino Due Schematics. The pinouts in my schematics for ATSAM3X8E are 100% correct. However There is a netlabel exchange error at USB DFSDM/Pin43 and DFSDP/Pin42 signals. But the issue is just a net lable exchange. The USB signal scheme is still correct. Here is the snapshot of the net lables that are exchanged:
netlables-exchanged.PNG

I also verified following:

1. USB VBUS/Pin39 is correctly connected to USB +5V at USB Connector P5 at pin1
2. USB Signals USB_D_N and USB_D_P signals are correclty connected to USB Pins on microcontroller
3. UOTGID signal is routed to PB11/Pin 129 As in Arduino Due schematics and as in Atmel Checklist for ATSAM3X8e document
4. UOTGVBOF is left floating
5. 12MHZ crystal is running and the frequency is also correct.


6. Length of USB Signals between Microcontroller and USB connector is around 1 inch. The USB Signal routing can be seen in the following picture:
usb-signal-routing.PNG

Upto now i have not found any schematic design error.
 

I have compared the schematics with Arduino Due Board, i also read datasheet for pinout errors and also studied atmel document ATSAM3 checklist but I dont find any mistake in my USB Scheme. I also verified the usb section related power supply pins VDDOUTMI, VBUS connection but cant see what is the issue with USB interface on my board.

I also posted the issue on at91.com but nobody responded to my post. Similar thing happened when i had posted this issue on arduino forum and nobody came with any suggestion.
 

Hi Admin,

I have figured out one difference between the Arduino Due board (whose Native USB always works) and my custom designed Arduino Copy design.

In original Arduino DUE board:
When i probe the USB OTGID Pin 4 while it is connected to PC USB using USB cable I can see the logic level on this pin remains Low all the time.

Where as :
In my custom Designed Arduino Due copy board:

When i probe the USB OTGID Pin 4 while it is connected to PC USB using USB cable I can see the logic level on this pin remains High (~3V) all the time.

Does it gives any clue for a not working USB Native port on my board?

- - - Updated - - -

i also pulled the OTGID pin to low on my custom designed board and tried reset and erase sequences but still the ATSAM3X8E on its native USB interface appears as Unknown Device.

I cant understand why ATSAM3X8E is unable to go into Boot mode over USB interface. And I also cant understand why on orignal Arduino DUE board i see OTGID pin LOW but on my board at HIGH logic level.

- - - Updated - - -

In original Arduino DUE board:
When i probe the VBG pin 40 of the ATSAM3X8E microcontroller I can measure ~1.2V

Where as in my board :
When i probe the VBG pin 40 of the ATSAM3X8E microcontroller I can measure 0V

I think this may give us some clue. I am trying to look in the datasheet and trying to see what is the purpose of VBG pin.
The value of Resistor in orginal Arduino Schematic is
R7 = 6.8K /1%
C25 = 22pf

Where as in my design:
i have this R = 6.8k / 1%
but C25 = 20pf which is very small difference and in practice no capacitor is this accurate that a 2pf difference should matter at all.
 

Hi asimlink, I have the same problem in a custom board based on arduino due.
If you fix the problem, could you help me with that please.

- - - Updated - - -

Hi asimlink. I fixed the problem.
In my design I copied the complete design including programming and native port.
When I interrupt the lines rx, tx, E_C-In and M-R-In of the programming port the native port works.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top