谢谢大侠,问题解决了
我在编译msp430f149读U盘出现下面提示是什么原因我用的是IAR4.11 Building configuration: demo - Debug Updating build tree... Linking Warning[w6]: Type conflict for external/entry "mCmdParam", in module CH375MAI against external/entry in module CH375HFT; class/struct/union field names do not match: Other16 vs Query /* In module CH375MAI: */ CMD_PARAM_I mCmdParam; typedef CMD_PARAM CMD_PARAM_I; typedef union _CMD_PARAM CMD_PARAM; /* In module CH375HFT: */ CMD_PARAM_I mCmdParam; typedef CMD_PARAM CMD_PARAM_I; typedef union _CMD_PARAM CMD_PARAM; Warning[w35]: There is more than one definition for the struct/union type with tag '_CMD_PARAM'; class/struct/union field names do not match: Query vs Other16 union _CMD_PARAM /* Elements: 19, Bytes: 30 */ { struct /* Elements: 1, Bytes: 30 */ { UINT8 mBuffer[30]; } Other; struct /* Elements: 4, Bytes: 14 */ { UINT32 mReserved; UINT32 mTotalSector; UINT32 mFreeSector; UINT8 mDiskFat; } Query; struct /* Elements: 1, Bytes: 30 */ { UINT8 mPathName[30]; } Open; struct Enumer; struct /* Elements: 1, Bytes: 1 */ { UINT8 mUpdateLen; } Close; struct Create; struct Erase; struct /* Elements: 4, Bytes: 10 */ { UINT32 mFileSize; UINT16 mFileDate; UINT16 mFileTime; UINT8 mFileAttr; } Modify; struct /* Elements: 1, Bytes: 4 */ { UINT32 mSectorOffset; } Locate; struct /* Elements: 1, Bytes: 1 */ { UINT8 mSectorCount; } Read; struct Write; struct /* Elements: 3, Bytes: 10 */ { UINT8 mSectorCount; UINT8 mReserved[7]; PUINT8 mDataBuffer; } ReadX; struct WriteX; struct /* Elements: 1, Bytes: 4 */ { UINT32 mDiskSizeSec; } DiskSize; struct /* Elements: 1, Bytes: 4 */ { UINT32 mByteOffset; } ByteLocate; struct /* Elements: 2, Bytes: 30 */ { UINT8 mByteCount; UINT8 mByteBuffer[29]; } ByteRead; struct ByteWrite; struct /* Elements: 3, Bytes: 6 */ { UINT8 mSaveVariable; UINT8 mReserved[3]; PUINT8 mBuffer; } SaveVariable; union /* Elements: 2, Bytes: 22 */ { struct /* Elements: 10, Bytes: 22 */ { UINT32 mCBW_Sig; UINT32 mCBW_Tag; UINT8 mCBW_DataLen; UINT8 mCBW_DataLen1; UINT8 mCBW_DataLen2; UINT8 mCBW_DataLen3; UINT8 mCBW_Flag; UINT8 mCBW_LUN; UINT8 mCBW_CB_Len; UINT8 mCBW_CB_Buf[6]; } mCBW; struct /* Elements: 5, Bytes: 14 */ { UINT32 mCSW_Sig; UINT32 mCSW_Tag; UINT32 mCSW_Residue; UINT8 mCSW_Status; UINT8 mReserved; } mCSW; } BOC; }; typedef unsigned char UINT8; typedef unsigned long UINT32; typedef unsigned short UINT16; typedef unsigned char * PUINT8; union _CMD_PARAM /* Elements: 19, Bytes: 30 */ { struct /* Elements: 1, Bytes: 30 */ { UINT8 mBuffer[30]; } Other; struct /* Elements: 1, Bytes: 30 */ { UINT16 mBuffer16[15]; } Other16; struct /* Elements: 1, Bytes: 28 */ { UINT32 mBuffer32[7]; } Other32; struct /* Elements: 4, Bytes: 14 */ { UINT32 mReserved; UINT32 mTotalSector; UINT32 mFreeSector; UINT8 mDiskFat; } Query; struct /* Elements: 1, Bytes: 30 */ { UINT8 mPathName[30]; } Open; struct Enumer; struct /* Elements: 1, Bytes: 1 */ { UINT8 mUpdateLen; } Close; struct Create; struct Erase; struct /* Elements: 6, Bytes: 16 */ { UINT32 mFileSize; UINT16 mFileDate; UINT16 mFileTime; UINT8 mFileAttr; UINT8 mReserved[3]; UINT32 mOldSize; } Modify; struct /* Elements: 1, Bytes: 4 */ { UINT32 mSectorOffset; } Locate; struct /* Elements: 6, Bytes: 10 */ { UINT8 mSectorCount; UINT8 mActualCount; UINT8 mLbaCount; UINT8 mRemainCount; UINT32 mLbaStart; PUINT8X mDataBuffer; } Read; struct /* Elements: 7, Bytes: 14 */ { UINT8 mSectorCount; UINT8 mActualCount; UINT8 mLbaCount; UINT8 mAllocCount; UINT32 mLbaStart; PUINT8X mDataBuffer; UINT32 mSaveValue; } Write; struct /* Elements: 1, Bytes: 4 */ { UINT32 mDiskSizeSec; } DiskSize; struct /* Elements: 1, Bytes: 4 */ { UINT32 mByteOffset; } ByteLocate; struct /* Elements: 2, Bytes: 30 */ { UINT8 mByteCount; UINT8 mByteBuffer[29]; } ByteRead; struct ByteWrite; struct /* Elements: 3, Bytes: 6 */ { UINT8 mSaveVariable; UINT8 mReserved[3]; PUINT8X mBuffer; } SaveVariable; union /* Elements: 2, Bytes: 22 */ { struct /* Elements: 9, Bytes: 22 */ { UINT32 mCBW_Sig; UINT32 mCBW_Tag; UINT8 mCBW_DataLen; UINT8 mCBW_DataLen1; UINT16 mCBW_DataLen2; UINT8 mCBW_Flag; UINT8 mCBW_LUN; UINT8 mCBW_CB_Len; UINT8 mCBW_CB_Buf[6]; } mCBW; struct /* Elements: 5, Bytes: 14 */ { UINT32 mCSW_Sig; UINT32 mCSW_Tag; UINT32 mCSW_Residue; UINT8 mCSW_Status; UINT8 mReserved; } mCSW; } BOC; }; typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned long UINT32; typedef unsigned char * PUINT8X; Total number of errors: 0 Total number of warnings: 2
这2个警告可以不关心,不影响使用
谢谢楼主,确实不影响使用,我从网站上下载的ch375读CP2102程序,里面有"HAL.H""HAL_BASE.C"在那能找到
CH374EVT.ZIP,到在线下载里面去搜索就可以了.
请问大侠ch374的 * 寄存器及缓冲区 */
#define RAM_ENDP0_SIZE 0x08 /* 端点0的缓冲区长度 */ #define RAM_ENDP0_TRAN 0x20 /* 端点0发送缓冲区的起始地址 */ #define RAM_ENDP0_RECV 0x28 /* 端点0接收缓冲区的起始地址 */ #define RAM_ENDP1_SIZE 0x08 /* 端点1的缓冲区长度 */ #define RAM_ENDP1_TRAN 0x30 /* 端点1发送缓冲区的起始地址 */ #define RAM_ENDP1_RECV 0x38 /* 端点1接收缓冲区的起始地址 */ #define RAM_ENDP2_SIZE 0x40 /* 端点2的缓冲区长度 */ #define RAM_ENDP2_TRAN 0x40 /* 端点2发送缓冲区的起始地址 */ #define RAM_ENDP2_RECV 0xC0 /* 端点2接收缓冲区的起始地址 */ #define RAM_ENDP2_EXCH 0x80 /* 端点2备用缓冲区的起始地址 */ #define RAM_HOST_TRAN 0x40 /* 主机发送缓冲区的起始地址 */ #define RAM_HOST_RECV 0xC0 /* 主机接收缓冲区的起始地址 */ #define RAM_HOST_EXCH 0x80 /* 主机备用缓冲区的起始地址 */
#define REG_HUB_SETUP 0x02 /* 仅USB主机方式: ROOT-HUB配置 */ #define REG_HUB_CTRL 0x03 /* 仅USB主机方式: ROOT-HUB控制 */ #define REG_SYS_INFO 0x04 /* 系统信息, 只读 */ #define REG_SYS_CTRL 0x05 /* 系统控制, 不受软件复位影响 */ #define REG_USB_SETUP 0x06 /* USB配置 */ #define REG_INTER_EN 0x07 /* 中断使能 */ #define REG_USB_ADDR 0x08 /* USB设备地址 */ #define REG_INTER_FLAG 0x09 /* 中断标志, 只读, 位写1清0 */ #define REG_USB_STATUS 0x0A /* USB状态, 只读 */ #define REG_USB_LENGTH 0x0B /* USB长度, 读为当前USB接收长度, 设备方式下写为USB端点2, 主机方式下写为USB主机发送长度 */ #define REG_USB_ENDP0 0x0C /* 仅USB设备方式: USB端点0控制 */ #define REG_USB_ENDP1 0x0D /* 仅USB设备方式: USB端点1控制 */ #define REG_USB_H_PID 0x0D /* 仅USB主机方式: USB主机令牌 */ #define REG_USB_ENDP2 0x0E /* 仅USB设备方式: USB端点2控制 */ #define REG_USB_H_CTRL 0x0E /* 仅USB主机方式: USB主机控制 */ 这些定义对于ch375能用吗
对CH375不适用,CH374/5两者的内部结构是完全不同的,CH374是通过访问寄存器的方式,而375是命令驱动方式。
谢谢楼主,请问有没有ch375做主机控制cp2012通讯的相关例程,可供参考
http://wch.cn/bbs/View.asp?S=101&I=19463 这个链接上有CH374操作CP2102的例程,可以参考一下
楼主你好,请您给看一下这段程序里面 UINT8 CP2102_Start_stop( UINT16 Value )//Value=0X0000-->Stop,Value=0x0001-->Start { Buffer[0]=0x41;Buffer[1]=0x00;Buffer[2]=(UINT8)(Value&0xff);Buffer[3]=(UINT8)((Value>>8)&0xff); Buffer[4]=0x00;Buffer[5]=0x00;Buffer[6]=0x00;Buffer[7]=0x00; return ( HostCtrlTransfer375( Buffer, NULL, NULL ) ); } 的 41 00 01 00 00 00 00 00 是什么意思,有没有关于端点命令的资料可以参考一下,谢谢
这个你没有必要详细追问,你直接移植就可以了. 41 00 01 00 00 00 00 00 没有什么意思,就是CP2102自己定义的一个命令,关于这些操作你不必关心,这些是经过我们数据分析看出来的.这个资料估计是不公开的,我们也没有.
请问:我在ICC6.31A下可以编译,而在ICC7.14C下不能编译,如何解决
编译器版本不兼容,要更换不同的库,我们有ICCAVR_7.13@AVR 的库,你可以试试.
这个库在哪里能找到 ICCAVR_7.13@AVR
网上下载CH375LIB.ZIP或CH374LIB.ZIP,AVR/LIBB_V7