Aniolek
Jul 2 2009, 8:00 AM
Hello,
I'm working on the c5131_usb_generic file. I'm sending datas from my USB device to my PC.
The LENGHT OF REPORT is define as 0x20, I'd like to send 128 bytes, but when I change the value of the LENGHT OF REPORT to 0x80, the device isn't recognised by the PC! I can change the value only if it is lower than 0x20.
Does someone has managed to make a change of the LENGHT OF REPORT value to send mores than 32 bytes?
Maybe it's impossible to do this with this microcontroller.
Thanks :bye
Isabel
I'm working on the c5131_usb_generic file. I'm sending datas from my USB device to my PC.
The LENGHT OF REPORT is define as 0x20, I'd like to send 128 bytes, but when I change the value of the LENGHT OF REPORT to 0x80, the device isn't recognised by the PC! I can change the value only if it is lower than 0x20.
Does someone has managed to make a change of the LENGHT OF REPORT value to send mores than 32 bytes?
Maybe it's impossible to do this with this microcontroller.
Thanks :bye
Isabel
Ajay Bhargav
Jul 3 2009, 6:30 AM
can you post the link to file or code?
Aniolek
Jul 6 2009, 2:50 AM
Of course, I've taken the code on atmel website :
http://www.atmel.com/dyn/resources/prod_documents/c5131-usb-generic-1_2_0.zip
I've modified the file user_application.c like this, more accurately:
http://www.atmel.com/dyn/resources/prod_documents/c5131-usb-generic-1_2_0.zip
I've modified the file user_application.c like this, more accurately:
CODE:
void user_application_task (void)
{
int var = 0;
int i,j=0;
unsigned char* chaine;
chaine = (char*) calloc (256,sizeof(unsigned char));
chaine = "000110101101010010101010101011001101010101010101010
101010100101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101101010010101011001010101100101101010101010100101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
011010010110101010010101011001101001011010101010101010101010
101010010101100101100101101001101010010110101010010101010101
010101010110011001100101100110011001011000110101101010010101
010101011001101010101010101010101010100101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101101010010101011001
010101100101101010101010100101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101011010010110101010010101011001
101001011010101010101010101010101010010101100101100101101001
101010010110101010010101010101010101010110011001100101100110
0110010110111";
if(Is_new_data_read())
{
usb_read_continuous(data_received);
if((data_received[0]=='1')&&(data_received[1]=='1'))
{
j=0;
for(i=0;i<29;i++)
{
data_to_send[i] = chaine[j];
j++;
}
data_to_send[i] = '\0';
usb_write_continuous(data_to_send,30);
}
if((data_received[0]=='1')&&(data_received[1]=='2'))
{
j=29;
for(i=0;i<29;i++)
{
data_to_send[i] = chaine[j];
j++;
}
data_to_send[i] = '\0';
usb_write_continuous(data_to_send,30);
}
}
if (INT0_button != last_INT0_button_state) // INT0 button pressed
{
if (Is_write_data_ready())
{
data_to_send[0] = !INT0_button;
last_INT0_button_state = INT0_button;
}
}
if (reset_to_bootloader == TRUE)
{
Usb_detach();
Led_all_off();
Enable_ale();
Configure_led(0,STANDARD_PORT);
Configure_led(1,STANDARD_PORT);
Configure_led(2,STANDARD_PORT);
Configure_led(3,STANDARD_PORT);
for (data_received[0]=0; data_received[0]<250; data_received[0]++);
Usb_disable();
Pll_stop();
EA = 0;
MAP_BOOT;
__API_JMP_BOOTLOADER();
}
}
{
int var = 0;
int i,j=0;
unsigned char* chaine;
chaine = (char*) calloc (256,sizeof(unsigned char));
chaine = "000110101101010010101010101011001101010101010101010
101010100101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101101010010101011001010101100101101010101010100101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
011010010110101010010101011001101001011010101010101010101010
101010010101100101100101101001101010010110101010010101010101
010101010110011001100101100110011001011000110101101010010101
010101011001101010101010101010101010100101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101010101010101101010010101011001
010101100101101010101010100101010101010101010101010101010101
010101010101010101010101010101010101010101010101010101010101
010101010101010101010101010101011010010110101010010101011001
101001011010101010101010101010101010010101100101100101101001
101010010110101010010101010101010101010110011001100101100110
0110010110111";
if(Is_new_data_read())
{
usb_read_continuous(data_received);
if((data_received[0]=='1')&&(data_received[1]=='1'))
{
j=0;
for(i=0;i<29;i++)
{
data_to_send[i] = chaine[j];
j++;
}
data_to_send[i] = '\0';
usb_write_continuous(data_to_send,30);
}
if((data_received[0]=='1')&&(data_received[1]=='2'))
{
j=29;
for(i=0;i<29;i++)
{
data_to_send[i] = chaine[j];
j++;
}
data_to_send[i] = '\0';
usb_write_continuous(data_to_send,30);
}
}
if (INT0_button != last_INT0_button_state) // INT0 button pressed
{
if (Is_write_data_ready())
{
data_to_send[0] = !INT0_button;
last_INT0_button_state = INT0_button;
}
}
if (reset_to_bootloader == TRUE)
{
Usb_detach();
Led_all_off();
Enable_ale();
Configure_led(0,STANDARD_PORT);
Configure_led(1,STANDARD_PORT);
Configure_led(2,STANDARD_PORT);
Configure_led(3,STANDARD_PORT);
for (data_received[0]=0; data_received[0]<250; data_received[0]++);
Usb_disable();
Pll_stop();
EA = 0;
MAP_BOOT;
__API_JMP_BOOTLOADER();
}
}