| Author |
Message |
|
|
Posted: Oct 18, 2011 - 06:03 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
|
Quote:
excuse me youtube is filter in my country!
can you uplod you'r movie on 4shared or another server? |
|
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 06:03 PM |
|


Joined: Jul 18, 2005
Posts: 62948
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| On Windows you will find usbdeview.exe to by invaluable I think - it's a free download - it tells you loads about the enumeration of USB devices you plug into the PC. Google it. |
_________________
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 06:31 PM |
|


Joined: Mar 16, 2011
Posts: 22
|
|
|
clawson wrote:
On Windows you will find usbdeview.exe to by invaluable I think - it's a free download - it tells you loads about the enumeration of USB devices you plug into the PC. Google it.
This is the best solution for you mojtaba_led, as clawson has already said!
and I put a file on site 4shared:
http://www.4shared.com/video/SnGA6Pks/A ... _LUFA.html |
|
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 06:54 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
thanks
i download usbdeview.exe and use but i don't see any expect connection than clicck on start application!
my schematic is correct that i use to connect to usb port of pc? |
|
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 07:24 PM |
|


Joined: Mar 16, 2011
Posts: 22
|
|
Now you know where to look for the problem. I went through this problem and he was on my board...
Whether you're after build successfully programmed device?
Did you put the VirtualSerial.hex file into device by programmer? |
|
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 07:38 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
|
Quote:
Whether you're after build successfully programmed device?
yes,i sure
this is output then compile :
Build succeeded.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Quote:
Did you put the VirtualSerial.hex file into device by programmer?
yes,i program flash with flip .
and a question , when run aplication what things display on terminal ?
consider i send "mojtaba" to terminal which function i shoud use that to send it?
and what is you'r terminal that use on that movie ?
thanks |
|
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 07:42 PM |
|


Joined: Jul 18, 2005
Posts: 62948
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
yes,i program flash with flip .
The very fact that Flip (and therefore DFU) work shows that the electronics of the USB interface to the PC are setup correctly. (unless you are holding it in bootloader mode all the time with HWB or something?) |
_________________
|
| |
|
|
|
|
|
Posted: Oct 18, 2011 - 08:03 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
|
Quote:
The very fact that Flip (and therefore DFU) work shows that the electronics of the USB interface to the PC are setup correctly. (unless you are holding it in bootloader mode all the time with HWB or something?)
before i use flip to program my codes to this device and those work corectly
my metod that use is as follow :
1.hold reset then
2.hold hwb then
3.release hwb then
4.release reset then
5.open usb in flip then
6.program flash then
7.click on start application
finish
see i just compile only this cod without any change and excess code ! do i need to add any code ?
Code:
#include "VirtualSerial.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
.Config =
{
.ControlInterfaceNumber = 0,
.DataINEndpointNumber = CDC_TX_EPNUM,
.DataINEndpointSize = CDC_TXRX_EPSIZE,
.DataINEndpointDoubleBank = false,
.DataOUTEndpointNumber = CDC_RX_EPNUM,
.DataOUTEndpointSize = CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
},
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be
* used like any regular character stream in the C APIs
*/
static FILE USBSerialStream;
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
*/
int main(void)
{
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
CheckJoystickMovement();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
USB_Init();
}
/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
void CheckJoystickMovement(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
ReportString = "Joystick Down\r\n";
else if (JoyStatus_LCL & JOY_LEFT)
ReportString = "Joystick Left\r\n";
else if (JoyStatus_LCL & JOY_RIGHT)
ReportString = "Joystick Right\r\n";
else if (JoyStatus_LCL & JOY_PRESS)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
/* Write the string to the virtual COM port via the created character stream */
fputs(ReportString, &USBSerialStream);
/* Alternatively, without the stream: */
// CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString);
}
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface);
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
thanks |
|
|
| |
|
|
|
|
|
Posted: Oct 19, 2011 - 12:10 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi
i can connect to usb and hyperterminal with atmel example for CDC |
|
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 04:32 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi
i use the VirtualSerial demo to connect to avr (at90usb162) through usb port .
i change the target on makefile to at90usb162 then make all in winavr and it build succefull the .hex then i program that the hex file by flip on micro then perss the application start on flip then pc detect device as "lufa cdc demo" then i instal it's driver from this address: J:\sampels1\winavr\LUFA\LUFA-111009\Demos\Device\ClassDriver\VirtualSerial
and this driver install succefull with Communications Port name.
but now i can't connect to device by any terminal !
please hlep me for this problem
thanks |
|
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 04:38 PM |
|


Joined: Jan 23, 2004
Posts: 9894
Location: Trondheim, Norway
|
|
That version of LUFA contains a CDC bug that causes the problem you are having - update to the newest (corrected) release and recompile.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 07:12 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi dear dean
thank you
i now download the LUFA-120219 version and make all .
i can to connect with terminal
but
now i want to print a sentence for example i want to display "HELLO WORLD" on terminal to this work , i execes this code in part of progarm of main file :
Code:
int main(void)
{
fputs("HELLO WORLD"\r\n", &USBSerialStream);
SetupHardware();
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
CheckJoystickMovement();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
USB_Init();
}
then againe try make all and the hex file builded then i program with flip and start but now don't display anything on terminal !?
please say to me what i do to dispaly and resive a character than devise through writting ion terminal !
thanks |
|
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 07:22 PM |
|


Joined: Jan 23, 2004
Posts: 9894
Location: Trondheim, Norway
|
|
You can't call fputs() before SetupHardware(), or you'll try to write to the USB interface before the USB controller has been initialized. Try placing it just before the main loop.
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 07:37 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
thanks alot
now, can you say to me for send data for example a character to the avr through trminal what i do !?
or this better, i say for get data with avr from pc which function to use ? |
|
|
| |
|
|
|
|
|
Posted: Mar 14, 2012 - 08:39 PM |
|


Joined: Jan 23, 2004
Posts: 9894
Location: Trondheim, Norway
|
|
|
|
|
|
|
Posted: Apr 15, 2012 - 09:23 AM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi Dean.
i can't send a digit or character from pc to uc !?
i use follow routin for recive data from pc :
Code:
int16_t temp;
char ReportString2[1];
.
.
.
back:
USB_USBTask();
temp = CDC_Device_ReceiveByte (&VirtualSerial_CDC_Interface);
if(temp<0) goto back;
itoa(temp,ReportString2,10);
fputs("\n\r", &USBSerialStream);
fputs(ReportString2, &USBSerialStream);
this code recive data but send asci code in dec to pc where i want to send digit or charater from pc to pc with uc interface.
can you write an example about recive characther and digit from pc?
thanks |
|
|
| |
|
|
|
|
|
Posted: Apr 15, 2012 - 08:43 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
HI
i can transfer character form pc to pc with follow routin:
Code:
//recive_data_function
recive_data_function(){
int ch;
char str[20];
/*recive data form pc then
send to pc(display on hyper terminal):*/
ch=getc(&USBSerialStream);
while(ch!=EOF){
putc(ch,&USBSerialStream);
fputs("\n\r", &USBSerialStream);
ch=getc(&USBSerialStream);
}
}//recive_data_function
but , the rate of transmit data in above routin is very bad! for example , i must wait to eof check always so when i don't enter a character the routin don't implement so pc lose my charcter !
can tell me a metode to solve this problem?
thanks |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 10:39 AM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi again!
Mr.Camera
what is you'r intent than this follow parsmeter in Config structure?
Code:
uint8_t NotificationEndpointNumber;
uint16_t NotificationEndpointSize;
bool NotificationEndpointDoubleBank;
i don't understand that what is notification endpoint!?
Please help me.
Thanks |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 04:11 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
and again, Hi Mr.Camera!
in this part of you'r web tutorial saied, the USB_Init function have two input as blow:
Code:
void USB_Init (const uint8_t Mode, const uint8_t Options)
but, in VirtualSerial demo ,used this function without any input,as this blow routin :
Code:
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
[u][b]USB_Init();[/b][/u]
}
why? what is default input?
thanks again and again! |
|
|
| |
|
|
|
|
|
Posted: Apr 17, 2012 - 06:41 PM |
|

Joined: Jun 25, 2011
Posts: 55
Location: IRAN
|
|
hi
i find out an other thing!
when i delete this blow function from main routin ,
Code:
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
Is increased the speed of routin implementation !
do we have to use this function in main routin or when we want send or recive data Through usb, for corecte opration ?
please help me! |
|
|
| |
|
|
|
|
|