如何通过USB为外部设备虚拟创建内存闪存?(How to create a memory flash virtually via USB for an external device?)

编程入门 行业动态 更新时间:2024-10-27 05:27:06
如何通过USB为外部设备虚拟创建内存闪存?(How to create a memory flash virtually via USB for an external device?)

我正在开发一个项目,我希望通过我的USB端口为外部设备制作虚拟USB闪存,例如,需要内存来录制电视频道的卫星接收器。 我想将PC USB端口连接到卫星USB端口,并将文件直接记录到文件中。 我在C#/ .NET工作。

I'm working on a project in which I want to make a virtual USB flash memory via my USB port for an external device, for example, a satellite receiver that needs a memory for recording TV channels. I want to connect the PC USB port to the satellite USB port and record files directly to a file. I'm working in C#/.NET.

最满意答案

USB协议通常位于两个不同的设备之间: 主机客户端 。 主机说明传输了什么数据以及何时客户端必须收听。 然后,客户端有不同的设备类 。 有USB可移动媒体,打印机,网络摄像头等。 USB otg略有不同,因为设备可以是客户端或主机,具体取决于另一个。 例如,当您连接到PC或主机时,您的移动电话车是客户端,它连接到USB记忆棒。

现在有你的卫星接收器。 它想成为主持人。 (你知道当它使用大型A型插座时)它需要一个可移动的媒体设备,如USB棒。 当您连接打印机时,它将不知道该怎么做。 与网络适配器或串行端口相同。

注意:你不可能通过串口实现“闪存协议”。 因为串行端口已经是客户端设备类。 此外,USB和串行之间没有电线兼容性。

由于您的PC具有相同的角色,并且不会在USB连接中充当客户端,因此没有简单的解决方案。 (我打赌你已经知道了,对吧?)

即使你有一个像闪存驱动器一样的PCIexpress卡,也会有更多的障碍。 例如,文件系统不能同时由两台计算机访问。

回到建设性的回答: 灵感来自这个链接你可以抓住一些高端微控制器并连接(微)SD卡。 然后你让它在其USB端口上充当闪存驱动器。 使用其以太网连接(或wifi),并通过samba访问(微)SD卡。

对于微处理器来说,这是一些非常高端的东西,所以最好不要使用非常便宜的微处理器。 我想到了RasberryPI Model A(不是B,不能充当USB客户端)或Arduino / Netduino(最强大的)。 我找不到即用型设备。

重要的是,与PC的连接使用某种网络而不是USB。 因为网络协议具有并发性(访问相同数据的多台PC),而本地文件系统则没有。

USB Protocol is generally between two distinct devices: The host and the client. The host says what data gets transferred and when, the client has to listen. Then there are different device classes for clients. There are USB removable media, printer, webcam ans others. USB otg differs slightly as a device can be client or host depending on the other one. For example your mobile phone van be client when connected to a PC or host wehn it's connected to a USB stick.

Now there is your satellite receiver. It wants to be host. (You know that when it uses the big Type-A socket) And it expects a removable media device like a USB stick. When you connect a printer it will not know what to to with it. Same with a network adapter or serial port.

N.B.: You cannot possibly implement "Flash Memory protocol via serial port". Because Serial Port is already the client device class. Also, there is no wire compatibility between USB and serial.

As your PC is in the same role and will not act as client in the USB connection, there is no simple solution. (I bet you knew this already, huh?)

Even if you got a PCIexpress card that acted like a flash drive, there would be more hurdles. For example file systems are not designed to be accessed by two computers simultaneously.

Back to constructive answering: Inspired from this link you could grab some higher end microcontroller and attach a (micro)SD card. Then you let it act as a flash drive on its USB port. Use its Ethernet connection (or wifi for that matter) and provide access to the (micro)SD card via samba.

This is some really high end stuff for a microprocessor, so better not use the very cheap ones. RasberryPI Model A (not the B one, that cannot act as a USB client) or Arduino/Netduino (the most powerful) came to my mind. I could not find a ready-to-use device.

The important thing is, that the connection to you PC uses some kind of networking and not USB. Because networking protocols have the concurrency (multiple PCs accessing the same data) covered whereas local file systems don't.

更多推荐

本文发布于:2023-07-25 22:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1267152.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:闪存   内存   设备   create   USB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!