简单的 USB 主机堆栈

发布于 2024-07-13 08:36:49 字数 169 浏览 5 评论 0原文

我正在尝试使用 Atmel 处理器上的 USB 主机端口连接到单个 USB 设备。 我有一个内存有限且没有操作系统的嵌入式系统。 我想实现一个简单的专用主机来连接到单个 USB 从设备。

谁能指导我实现一个简单的 USB 主机?

处理器是Atmel AT91SAM9261S。

I am trying to connect to a single USB device using the USB host port on an Atmel processor. I have an embedded system with limited memory and no OS. I want to implement a simple dedicated host to interface to a single USB slave device.

Can anyone guide me to a simple USB host implementation?

The processor is the Atmel AT91SAM9261S.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

罪#恶を代价 2024-07-20 08:36:49

首先,如果我没记错的话 AT91SAM9261S 板上有 OHCI USB 控制器并且你至少需要实现简单的主机控制器驱动程序(你可以看看Linux实现)。 根据您的设备将使用的传输类型,它可能不是很难 - 到非常难:) 没有简单的方法来实现 USB 堆栈。
实现控制器驱动程序后,您需要注意 USB 设备枚举部分,请查看 的第 9 章USB 规范。 只有在此之后,您才能开始实现您的设备逻辑。

对于简化的用例,有很多代码可以省略,但如果没有良好的 USB 背景,很难决定什么是相关的,什么是不相关的。

无论如何,如果您正在寻找商业解决方案我的公司可以提供一个。

First of all if i remember correctly AT91SAM9261S have OHCI usb controller on board and you need to implement at least simple host controller driver (you can take a look on Linux implementation) . Depending on the transfer types your device will be using it might be not very hard - to very hard :) There is no trivial way to implement usb stack.
After implementing a controller driver you will need to take care usb device enumeration part take a look at Chapter 9 of USB spec. And only after this you can start implementing your device logic.

For simplified use case there is a lot of code that could be omitted, but without good usb background is hard to decide what is relevant and what is not.

Any way if you are looking for commercial solution my company can provide one.

一指流沙 2024-07-20 08:36:49

我使用了 On-Time 的 RTUSB-32 堆栈。 它的占用空间很小,很容易集成到我们的环境中,而且文档也很好。 它们很好地抽象出了所需的支持,因此它完全是平台和操作系统中立的,并且您需要提供的钩子数量相对较少 - 即:它封装得很好。

既然您获得了所有源代码,您会发现该代码当然不是世界上构建得最好的代码,但如果需要的话,无需做大量工作就可以破译它。 无论如何,它基本上“正常工作”,没有任何问题。 我们已经让它在一些产品中运行了几年,并且只遇到了一个与堆栈的兼容性问题,即它对于某种类型的 USB 2.0 集线器不能完全正确地进行自动发现。 我们向他们发送了集线器的样本,他们在几天内就获得了补丁。 很难打败它。 总的来说,我认为它很有价值,而且肯定比坐下来从头开始写东西要好。

I've used the RTUSB-32 stack from On-Time. It is a small foot print stack and was easy to integrate into our environment and the documentation is good. They abstract out nicely the needed support so that it is completely platform and OS neutral and has a relatively small number of hooks you need to provide to it - ie: It is well encapsulated.

Since you get all the source, you'll see that the code is not the most well constructed code in the world, certainly, but it can be deciphered without a whole lot of work if needed. In any case, it basically "just works" without issue. We have had it running in some products for a few years now and have only run into one compatibility problem with the stack where it wasn't quite doing auto-discovery quite right with a certain type of USB 2.0 hub. We sent them a sample of the hub and they had a patch for it within a few days. Hard to beat that. Overall, I consider it a good value and certainly beats sitting down to write the thing from scratch.

时光沙漏 2024-07-20 08:36:49

如果您的设备不必是主机,这会容易得多:-P,因为 Atmel 提供了 USB 设备的示例源代码。 如果我是您,我会考虑在 Atmel 上使用一款支持 USB 的 RTOS AT91SAM 第三方页面,可能需要 Ilya 所建议的 jungo 的 USB 堆栈。

如果您确实编写了自己的 OHCI 驱动程序,libusb 作为上层的实现可能会有所帮助USB 堆栈。

This would be so much easier if your device didn't have to be a host :-P, because Atmel provides example source code for USB devices. If I were you, I'd look into using one of the USB-loving RTOSs on Atmel's AT91SAM third party page which might entail the USB stack from jungo as suggested by Ilya.

If you do write your own OHCI driver, libusb could be helpful as an implementation of the upper layers of the USB stack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文