04/28/2012
Hello everybody. I need some help
I wish to design a simple cli between the host - PC and the device - Stellaris MCU LM3S9xxx. using USB bus
The host sends short text messages the device decodes the commands and send a response back to the host.
My problem is with a dialog involved transfer large buffers (16KBytes) from the device to the host in response to a request from the host
I am not clear about how to do this. I started from the USB_Bulk example but I can't find a simple way how to modified example to make the device send this buffer
in response to the host request
Any help is very appreciated
Ehud
Ehud,
It's not clear to use what will be the best solution for you. Sending back the 16K buffer as text bytes should work, but may be too slow.
Using a composite device with a bulk transfer device and a character device should also work, but we don't have sample code for exactly this. It's certainly not clear to us how you would plan to synchronize these devices.
KC Witte
Hello KC. Thank you very much for your response
"It's not clear to use what will be the best solution for you"
At this point speed is not that critical I just need it to work correctly.
I can send a command from the host to the device "SendBuf". the device transfer buffer back
The size of the buffer as much as I define: #define BULK_BUFFER_SIZE 256
When I define#define BULK_BUFFER_SIZE 1024 I get about 1KB . If I need for instance 16KB I can simply repeat this command 16 times in a for loop
I have one issue with my code - it send only BULK_BUFFER_SIZE -7. the 7 is the length of the command itself "SendBuf" and I can't get rid of it.
Can you take a look at my code and see if you can come up with an idea how to make it transfer exactly 1KB?
Thank you in advance
Ehud Benhagai
I'm not quite clear on what is happenning here. Are the first seven characters after you send the SendBuf command the echoed "SendBuf"? If so, I suspect you don't want to call EchoNewDataToHost before sending your buffer. If this isn't what you're seeing, can you provide a little more detail?
Hello KC
I attach the ost side project so you may try to run it and see what is going on. The problem is that the available space for transmission is is 248 not 256 as I ecpect so I get only the first 248 elements in the Tx buffer correctly and the last 7 are not. I can't understand why and may be you can help here
Actualy I solve this problem by increasing the #define BULK_BUFFER_SIZE 256 to 320. Then everything works OK