Jump to content
Sign in to follow this  
PaulStoffregen

Native USB port on LM4F120 board?

Recommended Posts

Does Energia support the native USB port on the LM4F120 launchpad board?

 

I've been running benchmarks on all the Arduino compatible boards with native USB.  So far, I've tested Arduino Leonardo, Arduino Due, Fubarino Mini, Maple, Teensy 2.0 and Teensy 3.0.

 

I have a LM4F120 launchpad board here.  I was able to compile and run my benchmark, but only through "Serial" from the debug part of the board.  It measures a slow 11 kbytes/sec, because it's obviously a hardware serial port running at 115200 baud, not USB virtual serial.

 

On Arduino Due and Maple, "SerialUSB" accesses the native serial port.I tried this on Energia, but no luck.  On the others "Serial" is the USB virtual serial. I tried "Serial1" and a few other guesses, but no luck.

 

So far, I've been unable to find much documentation on Energia regarding the native USB port.  If it exists, please forgive my ignorance and point me to the right place?

Share this post


Link to post
Share on other sites

Does Energia support the native USB port on the LM4F120 launchpad board?

 

I've been running benchmarks on all the Arduino compatible boards with native USB.  So far, I've tested Arduino Leonardo, Arduino Due, Fubarino Mini, Maple, Teensy 2.0 and Teensy 3.0.

 

I have a LM4F120 launchpad board here.  I was able to compile and run my benchmark, but only through "Serial" from the debug part of the board.  It measures a slow 11 kbytes/sec, because it's obviously a hardware serial port running at 115200 baud, not USB virtual serial.

 

On Arduino Due and Maple, "SerialUSB" accesses the native serial port.I tried this on Energia, but no luck.  On the others "Serial" is the USB virtual serial. I tried "Serial1" and a few other guesses, but no luck.

 

So far, I've been unable to find much documentation on Energia regarding the native USB port.  If it exists, please forgive my ignorance and point me to the right place?

I don't think it is supported yet, but try asking it here. You may have to register though. Make sure you have the same username.

 

Edit: 1st post! Welcome to 43oh.

Share this post


Link to post
Share on other sites

I published my article regarding USB benchmarks.  It's making the rounds on various blog sites today.

 

Yesterday I put quite a bit more effort into reading through Energia's code.  There's definitely not any native USB code in the lm4f core.  There are 3 libraries in hardware/lm4f, for EEPROM, SPI and I2C (Wire).

Share this post


Link to post
Share on other sites

I published my article regarding USB benchmarks.  It's making the rounds on various blog sites today.

 

Yesterday I put quite a bit more effort into reading through Energia's code.  There's definitely not any native USB code in the lm4f core.  There are 3 libraries in hardware/lm4f, for EEPROM, SPI and I2C (Wire).

Hi Paul,

Could you share the link of your blog page?

Share this post


Link to post
Share on other sites

I put the complete source code on that page, so please feel free to help yourself to the code and give it a try.  As you can see in the blurb at the end of that page, I tried it on the LM4F120 board, but it only ran at slow serial speed through the debug port.  I was never able to get any way to communicate on the native port.

 

If Energia ever does support that native USB port, please let me know.  I have the board right here, so I'll be happy to run the benchmark and update my web page.

Share this post


Link to post
Share on other sites

Don't know about Energia USB support, but for the LM4F120 board there are TI USB examples, and target USB port must be used, not one for debugging.

Don't understand to what is related your benchmarking. Most of devices with hardware USB support are limited only due software stack side and (with ideal stack) will give same (max USB) rate almost without any CPU usage (ARM for sure).

 

For example,  MSP430F5xx (24 MHz) with my (assembler) stack (can use full 6 KB RAM space for buffering) will go till 800 KB/s with CDC, and 1000 KB/s with Generic Bulk, basically without CPU usage (because hardware USB module is working in parallel with CPU).

 

http://forum.43oh.com/topic/2775-msp430-usb-benchmark/?p=23696

Share this post


Link to post
Share on other sites

Yes, of course.  Well, if this forum lets me post a link.  Normally I never try to post anything like this in the first several messages, since so many forums have anti-spam filters that don't like links from new users.

 

Here's the benchmarks page.

 

http://www.pjrc.com/teensy/benchmark_usb_serial_receive.html

Any reason why Energia?

As Jazz mentioned, there is a good library stack for the Tiva series. Including ready to use USB examples.

 

I guess you are the developer of the Teensy! Nice to have you here.

Share this post


Link to post
Share on other sites

I'm a little late to the party but I would venture to say that he did it this way because the article is a comparison on Arduino-style boards with Arduino code (check the sources).

For Arduino Due and Maple board the SerialUSB configuration was used, as well as for LM4F120. AFAIK, for the Stellaris the Energia hardware serial implementation does not make use of advanced features. See hardware\lm4f\cores\lm4f\HardwareSerial.cpp.

 

This is why I'm pushing towards Energia since it unifies all these different platforms and allows better collaboration and easy entry. Even though I like TIs toolchain I have the impression that for most hobbyists it's a moving target. If you buy a fairly popular module you can get try a sketch and maybe it will work in 5 minutes with minimal modifications or you might have to spend the time to look into the datasheet for both the uC and the module and write everything from scratch in a day/week. Sorry for ranting but this double effort always annoys me and I come from a PIC background (triple effort then, nothing like AVR or ARM).

Share this post


Link to post
Share on other sites

I think that Energia team is doing great job, and my posts on this topic are not related to Energia on any way.

I completely understand situation where you have some general algorithm written in C code on IAR (for example). Then you compile it (same source) for Atmel/PIC/MSP430/ARM, and after benchmark execution on target device publish results somewhere.

I don't understand what kind of testing is he doing (UART / USB)? And don't see any meaning of his results because USB is completely another animal, and making some universal code, that will work on all platforms (uC side) can be far away from real power of target hardware USB module (and possible software realization). And how LM4F target chip can be benchmarked (UART / USB) over debugging port, don't understand.

BTW, I checked the code, but I am not familiar with it, and don't understand it.

Share this post


Link to post
Share on other sites

I don't understand what kind of testing is he doing (UART / USB)?

 

Brainwash got it.  The idea is to measure how fast Arduino code can receive data when running on various boards.  Only boards with native USB ports were tested, because reception with ordinary UART ports is limited by their relatively slow baud rates.

 

I know this may be hard to understand from a perspective of traditional (or "professional") embedded design, where code designed and optimized to the traits of a specific chip.  Most projects using Arduino code are more like "rapid prototyping".  The common approach is to use already-written examples and libraries, which are built on top of a simple, hardware-neutral API.  Because it's rapid prototyping that does NOT involve optimizing to a particular platform (at least the application level code which ordinary users copy from websites into the Arduino editor), this benchmark attempts to measure the speeds Arduino code can achieve when running on each board.

 

In other words, the question these benchmarks address is "if you run code X on board Y, it will receive at rate Z".  The question is not "how fast can board Y receive with the most optimal code".  That 2nd question is important if you're a designing a high volume commercial product that's carefully optimized to a particular chip.  The first question matters if you're rapidly prototyping an application, where you just grab existing Arduino code from a website and use it with little or no tweaking.

 

In the context of this benchmark, it does not matter how fast a non-Arduino USB stack for Stellaris might be.

Share this post


Link to post
Share on other sites

In the context of this benchmark, it does not matter how fast a non-Arduino USB stack for Stellaris might be.

That seems to be overstating the case a little bit. If a highly optimized non-Arduino USB stack can

achieve no better than X bytes/second, then an Arduino stack will probably not do much better.

(e.g. if the hardware can only handle USB 1.0 speeds, then the Arduino libraries may make it slower,

but are unlikely to go a lot faster.)

Share this post


Link to post
Share on other sites

Yes, you're right, an optimized implementation would show an upper limit of the speeds that might be possible with an easy-to-use Arduino implementation.

 

If Energia ever does support the native USB port on the Stellaris board, whatever speed the most Stellaris-specific code can achieve would be a useful comparison if anyone wanted to optimize Energia.

Share this post


Link to post
Share on other sites
In the context of this benchmark, it does not matter how fast a non-Arduino USB stack for Stellaris might be.

 

As I understand (but still complete picture is not clear, maybe also due to language barrier), Serial.read and Serial.readBytes are functions that are at the end part of Arduino target board firmware. There must be point where hardware-neutral API functions are linked to target device USB stack, and stack implementation will have impact on final performance.

 

There are 2 possible cases. The first one when uC is too slow and USB module is waiting, and anther when uC is fast enough to serve USB module on time. In general, if USB stack is written badly, than faster target platform will give better results. If USB stack is done right, than faster target platform will not give higher transfer rate, only CPU Free interval will be larger.

 

Just some numbers related to my MSP430F5510 USB stack (calculation is done fast, so maybe missed something somewhere).

 

For receiving (PC -> MSP) is used almost complete RAM, 5.75 KB. This buffer size is enough to go with CDC (at once) over 800 KB/s (win32 "usbser.sys"). For USB RAM is used pointer changing, without copying data, about 30 cycles. For non USB RAM is used DMA transfer, with copying 64 endpoint bytes, about 50 + 2 * 32 = 114 cycles. Average number of cycles is (1.75 * 30 + 4 * 114) / 5.75 = 90. For transfer of 800 KB, 800 * 1024 / 64 = 12800 transaction are needed, total 12800 * 90 = 1152000 cycles. So, uC running on 2 MHz, will be able to do 800 KB/s transfer with CPU Free around 40%.

 

The same calculation is for sending (MSP -> PC), but in my case MSP generate data, so there is no need for buffering. It storing data in endpoint buffers directly and firing over USB module on maximum transfer rate, without storing data somewhere before.

 

My code is completely arranged to my needs, and it is core part of my SBW multi-programer.

 

LM4F120 have more RAM and at least USB module good as one on MSP430F5xx. So even with generic TI USB stack it must have good enough benchmark results (like other tested ARM chips).

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...