阅读:2095回复:15
用EZ-USB时,能不能把程序放到ROM里?
??
|
|
沙发#
发布于:2002-06-14 16:07
你指的程序应该是固件firmware吧,现在固件在上电后被下载到片内的RAM里,我觉得应该可以放到开发板的EEPROM里,至于怎么放进去,我也想知道:)
|
|
|
板凳#
发布于:2002-06-14 22:26
当然可以
|
|
地板#
发布于:2002-06-15 08:14
如果可以,是和普通51的工作过程一样吗?上电后怎么识别是要使用rom中的程序,而不用下载?
|
|
地下室#
发布于:2002-06-15 17:06
附件中INITIAL DOWNLOAD PROCESS部分也许对你有所启发
|
|
5楼#
发布于:2002-06-15 17:31
它是根据有效的EEPROM里的第一个字节来判断的,分为三种情况:
第一字节不为0xB0、0xB2,Supplies descriptors,PID/VID/DID from EZ-USB Core,Sets ReNum=0. 第一字节为0xB0,Supplies descriptors from EZ-USB core ,PID/VID/DID from EEPROM. Sets ReNum=0. 第一字节为0xB2,Loads EEPROM into EZ-USB RAM. Sets ReNum=1; therefore 8051 supplies descriptors, PID/VID/DID. EEPROM的内容按相关说明格式存放。 详细的过程序可参考EZ-USB的DATASHEET。 |
|
|
6楼#
发布于:2002-06-17 11:10
INITIAL DOWNLOAD PROCESS说的仍是每次上电后都要下载firmware.
我的意思是能把程序存在rom中,不用每次都下载。而I2c接eeprom时,即使第一个字节是0xb2,它是把eeprom中的内容载到ez-usb 的RAM中,如果程序很大怎么办? |
|
7楼#
发布于:2002-06-17 18:18
不太可能太大,难道有几十k的firmware么?写了2000多行编译后也不过4-5k,如果你必须要写20000行的程序,只能说明整个系统设计成问题.
|
|
8楼#
发布于:2002-06-18 19:54
有道理,谢谢!!
|
|
9楼#
发布于:2002-06-19 21:14
谢谢还不给分?等银子讨老婆呢,:)
实际上,.hex文件有4-5k,真正的大小只有2k左右,各程序段的起始地址(org XXXX)尽量紧凑点. 写到eeprom中其实意义不大,也浪费money,你说\"应该放到eeprom中\"的道理是什么?实在想这样做就用编程器烧好了. |
|
10楼#
发布于:2002-06-21 13:48
I2C上不接只包含设备ID的EEPROM也能把FIRMWARE直接DOWNLOAD到RAM里运行吗?我试了要接一个SMALL EEPROM才行。
|
|
11楼#
发布于:2002-06-21 14:41
那位大侠帮我一把,我做2131SC时,下载FIRMWARE的起始地址出问题了,已经另开了帖子,我快急死了
|
|
12楼#
发布于:2002-06-21 15:07
TEN所说是不是说如果程序只是放在FLASH里,而不用一个SMALL E2PROM的话是不可以的?另外,如果程序确实比较大,如果都用EEPROM的话需要较大的E2,这会很贵,可是用FLASH可以吗?困惑!
|
|
|
13楼#
发布于:2002-06-21 19:32
下面是cypress的驱动源代码,可以下载到内部ram也可以下载到外部ram,有兴趣可以自己研究,我不懂.
NTSTATUS Ezusb_DownloadIntelHex( PDEVICE_OBJECT fdo, PINTEL_HEX_RECORD hexRecord ) /*++ Routine Description: This function downloads Intel Hex Records to the EZ-USB device. If any of the hex records are destined for external RAM, then the caller must have previously downloaded firmware to the device that knows how to download to external RAM (ie. firmware that implements the ANCHOR_LOAD_EXTERNAL vendor specific command). Arguments: fdo - pointer to the device object for this instance of an Ezusb Device hexRecord - pointer to an array of INTEL_HEX_RECORD structures. This array is terminated by an Intel Hex End record (Type = 1). Return Value: STATUS_SUCCESS if successful, STATUS_UNSUCCESSFUL otherwise --*/ { NTSTATUS ntStatus; PURB urb = NULL; PINTEL_HEX_RECORD ptr = hexRecord; urb = ExAllocatePool(NonPagedPool, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST)); if (urb) { // // The download must be performed in two passes. The first pass loads all of the // external addresses, and the 2nd pass loads to all of the internal addresses. // why? because downloading to the internal addresses will probably wipe out the firmware // running on the device that knows how to receive external ram downloads. // // // First download all the records that go in external ram // while (ptr->Type == 0) { if (!INTERNAL_RAM(ptr->Address)) { RtlZeroMemory(urb,sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST)); urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST); urb->UrbHeader.Function = URB_FUNCTION_VENDOR_DEVICE; urb->UrbControlVendorClassRequest.TransferBufferLength = ptr->Length; urb->UrbControlVendorClassRequest.TransferBuffer = ptr->Data; urb->UrbControlVendorClassRequest.Request = ANCHOR_LOAD_EXTERNAL; urb->UrbControlVendorClassRequest.Value = ptr->Address; urb->UrbControlVendorClassRequest.Index = 0; ntStatus = Ezusb_CallUSBD(fdo, urb); if (!NT_SUCCESS(ntStatus)) break; } ptr++; } // // Now download all of the records that are in internal RAM. Before starting // the download, stop the 8051. // Ezusb_8051Reset(fdo,1); ptr = hexRecord; while (ptr->Type == 0) { if (INTERNAL_RAM(ptr->Address)) { RtlZeroMemory(urb,sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST)); urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST); urb->UrbHeader.Function = URB_FUNCTION_VENDOR_DEVICE; urb->UrbControlVendorClassRequest.TransferBufferLength = ptr->Length; urb->UrbControlVendorClassRequest.TransferBuffer = ptr->Data; urb->UrbControlVendorClassRequest.Request = ANCHOR_LOAD_INTERNAL; urb->UrbControlVendorClassRequest.Value = ptr->Address; urb->UrbControlVendorClassRequest.Index = 0; ntStatus = Ezusb_CallUSBD(fdo, urb); if (!NT_SUCCESS(ntStatus)) break; } ptr++; } } else { ntStatus = STATUS_NO_MEMORY; } if (urb) ExFreePool(urb); return ntStatus; } |
|
14楼#
发布于:2002-06-21 22:30
TEN所说是不是说如果程序只是放在FLASH里,而不用一个SMALL E2PROM的话是不可以的?另外,如果程序确实比较大,如果都用EEPROM的话需要较大的E2,这会很贵,可是用FLASH可以吗?困惑! EZUSB的firmware只能放在EEPROM或编译在驱动程序中,在上电后自动加载,怎么可能放在FLASH中呢?再者,大容量的EEPROM也不贵,只有20元左右,但是建议不要将程序放在EEPROM中,不爽! |
|
|
15楼#
发布于:2002-06-25 14:49
8K以内的FIRMWARE才能放在EEPROM或者编译在驱动程序中吧,8K以上的可以直接放在FLASH中运行了,我试过,从端口输出来看是是没问题的,但枚举失败了,只好用更加简单的方式。
我试了什么EEPROM也不接,直接把FIWMWARE下载到FX2中去,任何反应都没有,反复看了资料“If no off-chip memory (either on the I²C-compatible bus or on the address/data bus) is con-nected to the FX2, it enumerates as the Default USB Device, with descriptors and VID / PID / DID supplied by hardwired internal logic (Table 3-3). RENUM is set to 0, indicating that the Default USB Device automatically handles device requests.”,如果要用自己的VID / PID是应该接一个含有DID的SMALL EEPROM的。不知道我的理解对不对。 |
|