我用375串口连接单片机做USB主设备,连接入U盘可以读取数据,但尝试用命令DISK_WRITE 写数据到U盘的时候就收不到375的中断回复了,谁能帮忙看下,谢谢!!!
u8 mWriteSector( unsigned long iLbaStart, unsigned char iSectorCount , u8 * ubuffer ) { unsigned char mIntStatus ; unsigned char *mBufferPoint; unsigned int mBlockCount; unsigned char mLength ; //ÿ´ÎдÈë64×Ö½ÚµÄÊý¾Ý CH375_WR_CMD( CMD_DISK_WRITE ); CH375_WR_DAT( (unsigned char)iLbaStart ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 8 ) ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 16 ) ); CH375_WR_DAT( (unsigned char)( iLbaStart >> 24 ) ); CH375_WR_DAT( iSectorCount ); for ( mBlockCount = iSectorCount * CH375_BLK_PER_SEC; mBlockCount != 0; mBlockCount -- ) { mLength = 0x40 ; mIntStatus = mWaitInterrupt( ); if ( mIntStatus == USB_INT_DISK_WRITE ) { CH375_WR_CMD( CMD_WR_USB_DATA7 ); CH375_WR_DAT( mLength ); while ( mLength -- ) CH375_WR_DAT( *ubuffer++ ); CH375_WR_CMD( CMD_DISK_WR_GO ); } else break; } if ( mBlockCount == 0 ) { mIntStatus = mWaitInterrupt( ); if ( mIntStatus == USB_INT_SUCCESS ) return( 0 ); } return( mIntStatus ); }