My questions are centered around what RTOS to choose given our connectivity requirements. A little bit of background on connectivity requirements for our new family of products:
Based on the initial literature survey, we thought that lwIP TCP/IP stack and StellarisWare USB library would be able to satisfy these two requirements. Our questions are:
Thanks
Derek
Derek,
There a few different RTOSs to choose from. One is SYS/BIOS. We have an application note to demonstrate how to create SYS/BIOS examples using StellarisWare. Using SYS/BIOS and Ethernet is a common request and although there are challenges, we have assisted customers in the past with this task. I'll have to do more research as to what these challenges were and how they were resolved.
SafeRTOS is another option which has additional software components to support USB and TCP/IP; free trial versions of this software can be found here. The LM3S9D96 has SafeRTOS in the ROM. For the DK-LM3S9D96, there is an example in StellarisWare called safertos_demo which utilizes SafeRTOS to perform a variety of tasks including lwIP.
We don't have any StellarisWare examples that use RTOS and USB concurrently. However, StellarisWare generally works well with both of these RTOS solutions. I'll have to consult our RTOS/USB experts if there are any known issues with using these together.
What are your plans with USB OTG? Are you using the Stellaris device as a hub for all of these devices? Are you connecting to either only a PC or only a joystick at any given time? The current Stellaris USB library can accomplish OTG functionality where you can switch between Host and Device using API functions which will work for the case when the Stellaris device is only connected to a PC or only connected to a joystick or the like. You can use the Stellaris USB Library without a third USB stack. If you had a different topology in mind, please elaborate.
-Rebecca
DerekGthird-party drivers (lwIP and StellarisWare)
StellarisWare is not 3rd party
are recommended by TI
I don't know that they're specifically "recommended" - TI may just have found them useful for the purpose of demonstrating their products.
they would all play well together. Is this correct?
No, I don't think you can draw that conclusion.
It may well happen to be the case, but I don't think that it necessarily follows as a conclusion.
If you don't need a pre-emptive RTOS try looking at utasker www.utasker.com
Works well for us and brilliant support from the author
Cheers
Martin Honeywill
In answer to your questions:
What are your plans with USB OTG?
We must be able to connect our device to a host PC or be able to connect a joystick to the device. In the first case, our device must be configured as an Embedded Host, and in the second case our device must be configured as a Peripheral. Our device will have one Micro-AB receptacle. At the present time. we do not foresee a need for Host Negotiation Protocol.
Are you using the Stellaris device as a hub for all of these devices?
No
Are you connecting to either only a PC or only a joystick at any given time?
Yes
After talking to our RTOS/USB expert, the current Stellaris USB library is not thread-safe, therefore it shouldn't run under an RTOS, including SafeRTOS and SYS/BIOS. The current Stellaris USB library is interrupt driven and not meant to work with a task scheduler as should be done under an RTOS.
The lwIP Ethernet stack is RTOS compatible (including SafeRTOS and SYS/BIOS). The safertos_demo, as mentioned previously, is a great starting example for this application. There shouldn't be any compatibility challenges using an RTOS with lwIP due to thread safety.
To accomplish your task of using all three of these together, you may want to look at third party USB stacks or modify the current USB OTG examples to be more thread-safe.
Rebecca,
I know lwip is not thread safe but I have an application that runs safe RTOS with a 9D96 and I use both lwip and USB. I created a thread for lwip and a thread for usb along with other threads for my app. Callbacks from lwip (interrupts) send a message to the tcpip thread and any task wishing to send data via TCP/IP will also send a message to the lwip task so anything using lwip is all done in the one tcpip task . The USB task is implemented in a similar way but as far as sending data I only send USB data from the one USB thread/task so if I am sending data from a low priority task and higher priority task send data it will not mix the data up.
Doug
While the lwIP stack may not be thread-safe in the general sense, it is designed to be used under an RTOS in a multi-threaded environment. This requires the programmer to allocate threads in a certain way to prevent conflicts. There is documentation on the lwIP website that explains how to use the APIs in this manner.
http://www.sics.se/~adam/lwip/doc/lwip.pdf
USBLib is also not generally thread-safe, but a careful programmer may incorporate it into an RTOS-based application (as you have done).
Regards,Christian
you proposed one option of modifying the “current USB OTG examples”. I looked through the latest Stellarisware downloaded from TI, and could not find any OTG examples. Where can i find the USB OTG examples?
thanks
You will find one of the OTG examples here: C:\StellarisWare\boards\dk-lm3s9b96\otg_detect
Note that this is the default location, if you changed the location at install the directory will be: <root>:\StellarisWare\boards\dk-lm3s9b96\otg_detect and that this is for the DK-LM3S9B96.
There is also the same OTG example for the 512k Flash parts using the DK-LM3S9D96.
Best regards,
Austin Miller
Digital Field Applications
If my reply answers your question please click on the green button "Verify Answer".