Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Atmel Studio 6.0 SP2, Arduino Due/X ASF DACC example on: January 22, 2013, 08:41:57 pm
The solution provided by Arduino support.

Quote
Hi,

to allow full USB speed on the 16U2 chip we provided the 5V power supply to it. Then we added a level shifter on the RX0 to adapt the voltage levels between the 16u2 ic and the sam3x UART.

In order to have it working with the atmel tools and utilities you have to activate the pull-up resistor on the Serial port pins.


Kind,
Federico Vanzati <support@arduino.cc>

This means to use the Atmel examples one must enable the pull-up resistors on Tx0 and Rx0. To do this in the file: arduino_due_x.h of an ASF example

Code:
/* ------------------------------------------------------------------------ */
/* UART                                                                     */
/* ------------------------------------------------------------------------ */
/*! UART pins (UTXD0 and URXD0) definitions, PA8,9. (labeled RX0->0 and TX0->1)*/
#define PINS_UART        (PIO_PA8A_URXD | PIO_PA9A_UTXD)
#define PINS_UART_FLAGS  (PIO_PERIPH_A | PIO_PULLUP)

#define PINS_UART_MASK (PIO_PA8A_URXD | PIO_PA9A_UTXD)
#define PINS_UART_PIO  PIOA
#define PINS_UART_ID   ID_PIOA
#define PINS_UART_TYPE PIO_PERIPH_A
#define PINS_UART_ATTR PIO_PULLUP
2  Products / Arduino Due / Re: Atmel Studio 6.0 SP2, Arduino Due/X ASF DACC example on: January 21, 2013, 11:15:31 am
Hello all,

I have confirmed this to be a problem from Atmel themselves. Please see below:

Quote
Hello,

I just had more inputs from the SW team.
The programming port is currently not supported in Studio: this feature was not available on the Developer Board we had from Arduino when developing ASF for the Due. The only way to program the Due using Studio today is to use the JTAG port and the serial communication must be done using the USB to Serial adapter or any FTDI adapter.

I did two tests to confirm this:
- Run ASF examples with UART using the USB to Serial adapter: OK
- Run the exact same ASF examples with UART using the programming port: KO. I reproduced your problem: menu is correctly displayed, but the characters sent are not valid.

So to me the problem is related to the ATMega firmware, which is maintained by Arduino. I contacted Arduino about this, but you can also try to contact them in parallel using the forum.

I also suspected the problem to lie in the ATMEGA16u2 firmware. I will investigate further. If anyone has tried this or has any input please reply. Also if you have any experience programming the 16u2 firmware please let me know.

I was told: http://arduino.cc/forum/index.php/topic,142608.0.html there is no DFU in the firmware for programming the 16u2 via USB and must use ISP. If anyone has experience with this please let me know.

Best Regards,
Michael
3  Products / Arduino Due / Re: Atmel Studio 6.0 SP2, Arduino Due/X ASF DACC example on: January 16, 2013, 04:17:39 pm
Hi Knuckles,

What do you mean? I am using just the Arduino Due connected to the programming port via USB, and using a terminal to Tx/Rx to the due.

I program the Due using BOSSA. The device that sits in between the SAM3x and the USB port is an ATMEGA16u2 which acts as as virtual serials port via USB.
4  Products / Arduino Due / [Solved] Atmel Studio 6.0 SP2, Arduino Due/X ASF DACC example on: January 16, 2013, 11:20:40 am
Hello,

I am using Atmel studio 6 to program an Arduino Due R3 board, using the provide ASF examples for the Arduino. I can program the Arduino just fine, however there are issues with several of the examples that use the UART.

The specific example is DACC_SINWAVE_EXAMPLE which communicates a menu over the UART to a console. The menu is used to control the sin wave output (amplitude and frequency) to the DAC on the arduino board. The menu is sent over the UART to the terminal correctly, however when I try to select a menu item, my characters are not being transferred or communicated to the SAM3X correctly.

I've attached the main program, and an outline of he main while loop below:

Code:
//Main while loop outline
while (1)
{
usart_serial_getchar((Usart *)CONSOLE_UART, &uc_key);

switch (uc_key)
                {
case '0':
       //do stuff
break;

case '1':
       //do stuff
break;

case 'i':
case 'I':
       //do stuff
break;

case 'w':
case 'W':
       //do stuff
break;

case 'm':
case 'M':
display_menu();
break;

                case default:
                       puts(uc_key);
                       break;
}

}

I have no idea what the problem is however it seems to be a problem with the following:

Code:
usart_serial_getchar((Usart *)CONSOLE_UART, &uc_key);

The ARM chip is not getting the correct characters, which I believe should be in the variable
Code:
uc_key

Regardless of what I type into the console, the program always jumps to the default case. I added a
Code:
puts(uc_key);
to see exactly what is being sent over the UART, and it always returns the same weird characters regardless of the key I press:

Code:
°)[07] © [08]

If anyone has any experience with this or more experience with the C/C++ than me, and can give me any insight it would be much appreciated.

Or if you have Atmel Studio 6, and can test this out on your due to confirm, that would also be helpful!

Best Regards,
Michael
5  Products / Arduino Due / Re: Convenient way to put ATMEGA16U2 into DFU mode? on: January 14, 2013, 03:25:06 pm
Hi Stimmer,

My mistake, _HWB should be low to enable hardware boot (DFU) mode and _RESET, as mentioned in the data sheet. These pin have 'bars' over them indicating negative logic. I don't have an ISP to check, however if you checked with an ISP, and telling by how the circuit is designed they must not have it in there.

Thanks again for your insight!

Best Regards,
Michael
6  Products / Arduino Due / Re: Convenient way to put ATMEGA16U2 into DFU mode? on: January 14, 2013, 02:35:17 pm
Hello Stimmer,

Thanks for your reply.

Have you tried to reset the chip into DFU mode? How would you know your board does not have it if the _HWB pin is always tied to ground through R18?

This chip absolutely does support DFU mode for programming from USB via Atmel flip (thats the beauty of the ATMEGAxU2 series, no ISP required). I have implemented two different PCBs that use the ATMEGA16U2 chip, and it definitely comes from Atmel with DFU mode (by resetting it as i described) in the firmware. I suppose it is possible the manufactures of the Due removed it completely. If i had a secondary Due i would remove the R18 resistor and test, however i don't. Either way thanks for your reply.

Best Regards,
Michael
7  Products / Arduino Due / Convenient way to put ATMEGA16U2 into DFU mode? on: January 13, 2013, 11:47:53 pm
Hello,

I would like to change the firmware on the ATMEGA16U2 on the Due board.

I know from the ATMEGA16U2's datasheet (http://www.atmel.com/Images/doc7799.pdf) that pin 13 (_HWB) needs to be tied high while the ATMEGA16U2 is reset with it's pin 24 (_RESET) - which also needs to be tied high.

Resetting the ATMEGA16U2 is easy (from the ICSP1 header), however I can see from the Due schematic that pin 13 (_HWB) on the ATMEGA16U2 is tied to a 10K resistor (R18) that goes directly to ground. This makes it pretty much impossible to put the ATMEGA16U2 into DFU mode unless one removes R18.

Anyone know of a convenient way to put the ATMEGA16U2 into DFU mode without removing the resistor R18? ... sadly i don't think there really is.

Best Regards,
Michael
8  Products / Arduino Due / Re: Programming from command line using the "Programming port" on: January 13, 2013, 09:02:51 pm
Hello gaplee,

I now understand your reply. I was able to get it working with your suggestion.

First open/close the virtual com port (arduino programming port) @ 1200bps to initiate the reset.

Code:
mode com3:1200

Next use BOSSA as usual:

Code:
bossac -p COM3 -U false -i -e -w -v -b D:\file.bin -R

The following flag
Code:
-U false
must be present for this to work.

Thanks again for your help!

Best Regards,
Michael
9  Products / Arduino Due / Re: Programming from command line using the "Programming port" on: January 13, 2013, 08:44:01 pm
Hello gaplee

Thanks for your reply. I have been looking at the arduino IDE source code to understand how the arduino IDE programs the SAM3X thru the virtual serial driver.

The arduino programming port driver is a virtual serial driver which is a modified version of the LUFA CDC driver:
http://www.fourwalledcubicle.com/LUFA.php

I think it is modified to erase, reset, and setup the programming mode over the SAM3X UART0. However I am not 100% certain.

If anyone can provide additional information regarding how the arduino IDE facilitates the programming the SAM3X through the MEGA16u2 chip using basic serial port commands/command line it would be incredibly helpful.

Thanks again.
10  Products / Arduino Due / Programming from command line using the "Programming port" on: January 12, 2013, 07:18:15 pm
Hello,

I have searched the forum for this issue but didn't find the answer.

I can upload sketches using the arduino IDE from the programming port. I can also upload programs I write in Atmel Studio 6 directly to the SAM3X via the native port using BOSSA with the following command:

Code:
bossac -p COM5 -i -e -w -v -b D:\file.bin -R

This all works fine, however, I would like to upload code to the SAM3X using the "programming port" from a command line (not using the arduino IDE).


Does anyone know a good way to do this, or how this can be done? Any assistance or insight will be much appreciated.

Best Regards,
Michael

 
Pages: [1]