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:
//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:
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 uc_key
Regardless of what I type into the console, the program always jumps to the default case. I added a 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:
°)[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
sinewave_example.c (12.3 KB)