پاسخ : کتابخانه ff.h در Codevision
این سوال مشترک بین آقای اسدی و صرامی
من برنامه هر دوی شما رو که شبیه سازی میکنم مثل عکس پست 6
پورت E رو که مقدارش 1 میشد فهمیدم مال اینجا بود :
که خودشم نوشته اگر سوکت پاور کنترل نداره این قسمتو پاک کنید ( فعلا این مشکلی نداره )
ولی پایه های SPI درست تعریف نمیشن
همونطور که قبلا گفته بودید رفتم سراغ mmc_avr.c و توی این قسمت :
دیدم درست آمده 3 تا پین اول پروت B رو که به ترتیب SS و SCK و MOSI هستن 1 کرده ( یعنی خروجی )
و پین 4ام رو هم ورودی تعریف کرده ولی وقتی دستور init اجرا میشه باز این پایه ها خاکستری رنگ هستن توی پرونئوس
و این که مقدار 0x06 برمیگردونه که بیشتر بررسی کردم دیدم تابع res = disk_initialize(0); مقدار استاتوس رو برمیگردونه
و توی status :
Return Values
The disk status is returned in combination of following flags. FatFs refers only STA_NOINIT and STA_PROTECT.
STA_NOINIT
Indicates that the device is not initialized. This flag is set on system reset, media removal or failure of disk_initialize() function. It is cleared on disk_initialize() function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. When media change detection feature is not supported, application program needs to de-initialize the file system object with f_mount() function after the media change.
STA_NODISK
Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.
STA_PROTECT
Indicates that the medium is write protected. This is always cleared on the drives without write protect feature. Not valid while no medium in the drive.
حالا 0x06 کدومشونه یا اصلا اشتباهه نمیدونم
واین که کلا قسمت مموری فعلا کار نمیکنه :sad:
این سوال مشترک بین آقای اسدی و صرامی
من برنامه هر دوی شما رو که شبیه سازی میکنم مثل عکس پست 6
پورت E رو که مقدارش 1 میشد فهمیدم مال اینجا بود :
کد:
{ /* Remove this block if no socket power control */ PORTE |= _BV(7); /* Socket power off (PE7=high) */ for (Timer1 = 20; Timer1; ); /* Wait for 20ms */ }
ولی پایه های SPI درست تعریف نمیشن
همونطور که قبلا گفته بودید رفتم سراغ mmc_avr.c و توی این قسمت :
کد:
PORTB |= 0b00000101; /* Configure SCK/MOSI/CS as output */ DDRB |= 0b00000111; SPCR = 0x52; /* Enable SPI function in mode 0 */ SPSR = 0x01; /* SPI 2x mode */
و پین 4ام رو هم ورودی تعریف کرده ولی وقتی دستور init اجرا میشه باز این پایه ها خاکستری رنگ هستن توی پرونئوس
و این که مقدار 0x06 برمیگردونه که بیشتر بررسی کردم دیدم تابع res = disk_initialize(0); مقدار استاتوس رو برمیگردونه
This function returns a disk status as the result.
Return Values
The disk status is returned in combination of following flags. FatFs refers only STA_NOINIT and STA_PROTECT.
STA_NOINIT
Indicates that the device is not initialized. This flag is set on system reset, media removal or failure of disk_initialize() function. It is cleared on disk_initialize() function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. When media change detection feature is not supported, application program needs to de-initialize the file system object with f_mount() function after the media change.
STA_NODISK
Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.
STA_PROTECT
Indicates that the medium is write protected. This is always cleared on the drives without write protect feature. Not valid while no medium in the drive.
واین که کلا قسمت مموری فعلا کار نمیکنه :sad:
دیدگاه