TI E2E Community
Stellaris® ARM® Microcontrollers
Stellaris® ARM® LM3S Microcontrollers Forum
USB Bulk with CLI (Command Line Interface)
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
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.
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
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?
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
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.